【问题标题】:How does a Two-Factor Authentication app generate the code?双重身份验证应用程序如何生成代码?
【发布时间】:2021-12-29 18:33:50
【问题描述】:

我正在尝试为私人应用程序复制 Authy/Google Authenticator 的功能。我应该使用什么算法从已知秘密中获取 6 位或 8 位 2fa 代码?有这方面的开源包吗?

【问题讨论】:

    标签: two-factor-authentication


    【解决方案1】:

    这些是使用基于时间的一次性密码 (TOTP) 算法生成的。 RFC https://datatracker.ietf.org/doc/html/rfc6238。根据您首选的编程语言,有许多可用的软件包。 (您可以在 google 上搜索 TOTP <your language> 以找到执行此操作的包)

    一旦你有了key,就可以根据当前时间生成OTP。

    【讨论】:

      猜你喜欢
      • 2020-09-02
      • 1970-01-01
      • 1970-01-01
      • 2022-01-13
      • 2015-02-06
      • 1970-01-01
      • 1970-01-01
      • 2018-01-26
      • 1970-01-01
      相关资源
      最近更新 更多