Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when TOTP is padded with = characters #130

Closed
p1nky14 opened this issue Apr 22, 2020 · 3 comments · Fixed by #131
Closed

Error when TOTP is padded with = characters #130

p1nky14 opened this issue Apr 22, 2020 · 3 comments · Fixed by #131
Assignees
Labels

Comments

@p1nky14
Copy link

p1nky14 commented Apr 22, 2020

There is an issue when the TOTP seed is padded with = characters, then when trying to copy the TOTP an error message will be shown "Error, bad seed! (-1)", with the -1 part of the error being repeated once per each occurence of a padding = character.

I noticed this when scanning QR codes using Strongbox on iOS, which will add these padding characters, and then trying to create a TOTP in KeePass using Tray TOTP plugin.
After manually removing the padding = characters everything works fine.

I am not 100% whether it is incorrect of Strongbox to add the padding = characters or of Tray TOTP plugin to fail when they exist.

See also here my reddit post to the Strongbox author and his response:
https://www.reddit.com/r/strongbox/comments/g5i2fe/totp_qr_scanning_switching_to_new_device/

@dannoe dannoe added the bug label Apr 23, 2020
@dannoe
Copy link
Contributor

dannoe commented Apr 23, 2020

Nice find, that's right. We should accept the equal sign(s) if they are needed, because the RFC 4648 - The Base16, Base32, and Base64 Data Encodings states so.

@robinvanpoppel robinvanpoppel self-assigned this Apr 24, 2020
@mmcguill
Copy link

Thanks for looking into this one @dannoe
-Mark (Strongbox Dev)

@robinvanpoppel
Copy link
Collaborator

The Key Uri Format secret section states:

REQUIRED: The secret parameter is an arbitrary key value encoded in Base32 according to RFC 3548. The padding specified in RFC 3548 section 2.2 is not required and should be omitted.

So we should indeed accept with and without padding, and omit padding when exporting to a Key Uri.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants