yoy.be "Why-o-Why"

DIY Google Authenticator

2021-02-25 20:12  diytotp  coding delphi internet freeware  [permalink]

Recently, I've got a few things asking to enable two-factor-authentication, and I started using the Google Authenticator app.

I kind of like it. It's a simple enough app, there's a shared secret involved, but it gets pretty close to being airgapped and perfectly forward secure and all of those things. So I got thinking... What would it take to start using it for myself, in those little software things I create now and then...

Is there black magic or stick whittling involved? Nah, a little searching around, and it all appears to be cleanly described in RFC's 6287 and 4226... There has to be a warning here about not rolling your own crypto, but the world of hashing and encrypting really is interesting! I did SHA1 and HMAC before, and Unix' time apparently is UTC... So all you need* is the correct format of URL to put into a QR-code to load up a new key in the app. Then you can use this code to generate the 'current' pass-code for the secret:

github.com/stijnsanders/tools/.../crypto/totp.pas

*: and apparently base32-encoding, HashUtils was missing that...

twitter reddit linkedin facebook