wstrange / GoogleAuth

Google Authenticator Server side code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Secrets in Base32 are case-sensitive

rkfg opened this issue · comments

commented

Took me a while to find out what's wrong. Google prints the codes in lowercase but the library decodes them wrong because of this issue. After doing .toUpperCase() the codes match. Probably best not to confuse people and uppercase it anyway at this line. While it could be patched on the Apache's side I think it's nice to cover this default Google behavior on the library's side.

Hi @rkfg, actually I distinctly remember checking out case sensitivity on RFC 4648, which states (emphasis mine):

The Base 32 encoding is designed to represent arbitrary sequences of
octets in a form that needs to be case insensitive but that need not
be human readable.

I wasn't aware of bug CODEC-234 though. A fix seems to be in the way, but I think in the meantime we can uppercase it.

Pushing release 1.1.2 to OSSRH

Pushed 1.1.2

<dependency>
  <groupId>com.warrenstrange</groupId>
  <artifactId>googleauth</artifactId>
  <version>1.1.2</version>
</dependency>