Yubico / yubikey-personalization

YubiKey Personalization cross-platform library and tool
https://developers.yubico.com/yubikey-personalization/
BSD 2-Clause "Simplified" License
300 stars 82 forks source link

Added TOTP (6 digits) functionality to ykchalresp.c #41

Closed joernchen closed 10 years ago

joernchen commented 10 years ago

This should implement TOTP with a fixed time step of 30 seconds and 6 digits output.

klali commented 10 years ago

Hello, Good job!

If you're interested I'd like one refactor before we merge this: let -t mean take challenge from time and a new flag (-o?) for outputting the result as an oath code

that way you could also get oath output from a chosen challenge.

Maybe the -8 could also be refactored to be -d {digits}, but that's more of cosmetics.

/klas

joernchen commented 10 years ago

Hi,

those suggestions sound good, I just tried it to implement it as simple as possible.

joernchen

klali commented 10 years ago

Completely understandable, and I think it's a good addition to the tool. My questiion is mostly along the lines of if you want to implement that, or if I should merge this and have as a goal to move the code in that direction.

/klas

joernchen commented 10 years ago

I can refactor those parts. =)

joernchen commented 10 years ago

Refactored the flags as follows:

-t: take challenge form current time -6: Output 6 digits HOTP/TOTP style -8: Output 8 digits HOTP/TOTP style

so -6 and -8 can be used independently from -t

klali commented 10 years ago

Very good.

Just to be clear on the formality: Do you agree to contribute this under the license of the project?

/klas

joernchen commented 10 years ago

Yes (I wouldn't have made a pull request otherwise) ;)

klali commented 10 years ago

=)

thanks for the contribution!