IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    google authenticator 一次性验证码TOTP java 代码实现

    asuncool@gmail.com(yihaomen)发表于 2015-04-15 16:12:05
    love 0
    越来越多的应用系统,开启了双重因子验证,最典型的就是银行,在交易的时候,还会发送给你一个验证码,一般通过短信方式,这个验证码是一次性验证码,而且一般有效期很短, 这就是一个典型的OTP, 关于OTP 的算法有很多种,这里是用的google authenticator, 基于时间的OTP, 所以也叫TOTP. google authenticator 是开源的,可以下载代码参考。我这里主要是想如果要改成自己的用的OTP, 需要服务端也能实现类似的算法。所以在github 上找到了这个开源的东西。

    以后难得去找,这里把代码整理在这里下载:
    下载文件 google authenticator totp java source code

    其他参考文章:
    [RFC6238]: https://tools.ietf.org/html/rfc6238
    [gauth]: https://code.google.com/p/google-authenticator/
    [tgb]: http://thegreyblog.blogspot.com/2011/12/google-authenticator-using-it-in-your.html?q=google+authenticator
    [serviceLoader]: http://docs.oracle.com/javase/6/docs/api/java/util/ServiceLoader.html
    [SecureRandom]: http://docs.oracle.com/javase/8/docs/api/java/security/SecureRandom.html
    [sr-algorithms]: http://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#SecureRandom
    [githubIssues]: https://github.com/wstrange/GoogleAuth/issues


沪ICP备19023445号-2号
友情链接