pyauth / pyotp

Python One-Time Password Library
https://pyauth.github.io/pyotp/
Other
3.03k stars 326 forks source link

FortiToken Mobile compatibility #106

Closed saup007 closed 4 years ago

saup007 commented 4 years ago
>>> import pyotp
>>> import time
>>> totp = pyotp.TOTP("xxxxxxxx", interval=60)
>>> print("Current OTP:", totp.now(), time.asctime( time.localtime(time.time()) ))
Current OTP: 473903 Fri Sep 18 10:38:14 2020

FortiToken Mobile 865980

Onboard Security Algorithm: OATH time and event based OTP generator: OTP Spec RFC 6238, RFC 4226

https://www.fortinet.com/content/dam/fortinet/assets/data-sheets/fortitoken.pdf

kislyuk commented 4 years ago

Can you please explain more explicitly what your issue is?

saup007 commented 4 years ago

Can you please explain more explicitly what your issue is?

I use the FORTITOKEN MOBILE commercial product, which is an OTP Spec RFC 6238, RFC 4226 based on the OATH time algorithm.

When the token generated using pyotp totp does not match the token generated by the FORTITOKEN MOBILE IOS APP.

kislyuk commented 4 years ago

OK - I have no idea why this would be the case. It looks like you're setting a custom interval; have you tried using the standard interval of 30s?

saup007 commented 4 years ago

OK - I have no idea why this would be the case. It looks like you're setting a custom interval; have you tried using the standard interval of 30s?

The 30 second interval is also incorrect, FORTITOKEN MOBILE defaults to 60 seconds.

kislyuk commented 4 years ago

This package implements the RFC correctly, as evidenced by the test suite examples which match the RFC references. I took a quick look at the doc you linked and it does not seem to provide any information beyond what you already pasted. So I'm afraid I have no idea why you are seeing a mismatch. This thread refers to the secret being transported in an encrypted form, so perhaps you are taking an encrypted secret and passing it on to PyOTP without decrypting it first.

kislyuk commented 4 years ago

Since I'm reasonably confident this is not a problem in PyOTP, I'm going to close this issue. If you need further assistance, feel free to comment here or open a new issue if there is a specific change that you would like PyOTP to implement.