OTP is short for One-Time Password, which means one-time password.
Common products on the market:
- Ning shield token
- Alibaba's identity treasure
- Google's authenticator (google-authenticator)
- QQ token
Let's create a new .NET 4.5 project.
nuget install the plugin with the following command:
We try to generate a password every 60 seconds, using the SHA1 algorithm, and the code is as follows:
I found a website for an online TOTP Token Generator, and the default algorithm is sha1.
The hyperlink login is visible.
Try to run the program, and the generated dynamic password is as shown in the figure below:
Remark:The SecretKey must be a base32 string,Otherwise, the error will be as follows:
Character is not a Base32 character Source code download:
Tourists, if you want to see the hidden content of this post, please Reply
(End)
|