首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >RSA令牌是如何工作的?

RSA令牌是如何工作的?
EN

Stack Overflow用户
提问于 2011-12-01 19:19:28
回答 4查看 91.9K关注 0票数 48

我想了解RSA令牌(SecurID)是如何工作的,它使用的算法是什么,它与常规的RSA加/解密算法是相同的吗?

EN

回答 4

Stack Overflow用户

发布于 2011-12-01 20:03:27

你可以在http://seclists.org/bugtraq/2000/Dec/459上看看它是如何做到的

(过于简化的)机制是

代码语言:javascript
复制
hash = <some initial value>
every x seconds do:
   hash = hashfunction(hash + secret_key)
   print hash
票数 12
EN

Stack Overflow用户

发布于 2012-10-30 05:48:27

我可以让你了解一下暴雪移动授权码是如何工作的,因为他们的代码是has been open-sourced.

基本要点是:

  • 使用各种secrets
  • 生成散列,但也包括自某个开始时间(例如1/1/1970)

以来的30秒间隔数

简而言之,伪代码是:

代码语言:javascript
复制
String GetCurrentFOBValue()
{
   // Any code is released into the public domain. No attribution required.

   // Calculate the number of intervals since January 1 1970 (in UTC)
   // The Blizzard authenticator rolls over every 30 seconds,
   // so codeInterval is the number of 30 second intervals since January 1 1970.
   // RSA tokens roll over every minute; so your counter can be the number 
   // of 1 minute intervals since January 1, 1970
   // Int64 codeInterval = GetNumberOfIntervals();
   Int64 codeInterval = (DateTime.Now - new DateTime(1970,1,1)).TotalSeconds / 30;

   // Compute the HMAC_SHA1 digest of the code interval, 
   // using some agreed-upon 20-bytes of secret key material.
   // We will generate our 20-bytes of secret key material by
   // using PBKDF2 from a password. 
   // Blizzard's mobile authenticator is given secret key material
   // when it enrolls by fetching it from the web-site.
   Byte[] secret = PBKDF2("Super-secret password that our FOB knows", 20); //20 bytes

   // Compute a message digest of codeInterval using our shared secret key
   Byte[] hmac = HMAC(secret, codeInterval);

   // Pick four bytes out of the hmac array, and convert them into a Int32.
   // Use the last four bits of the digest as an index 
   // to which four bytes we will use to construct our Int32
   int startIndex = hmac[19] & 0x0f;

   Int32 value = Copy(hmac, startIndex, 4).ToUInt32 & 0x7fffffff; 

   // The blizzard authenticator shows 8 digits
   return String.Format("%.8d", value % 100000000);

   // But we could have just as easily returned 6, like RSA FOBs do
   return String.Format("%.6d", value % 1000000);
}
票数 11
EN

Stack Overflow用户

发布于 2018-01-15 12:04:54

@VolkerK's answer链接到描述“64位”RSA令牌算法的C代码,该令牌使用基本上自定义的算法(逆向工程~2000)。

但是,如果您对更现代的“128位”令牌(包括无处不在的SID700硬件令牌和等效的软令牌)所使用的算法感兴趣,那么可以查看stoken的源代码,这是一个全面记录其工作原理的开源项目;securid_compute_tokencode是主要的入口点。

本质上,算法是这样工作的:

从当前时间和串行number

  • Repeatedly生成密钥使用128位
  • 加密秘密/种子
  • 从输出的十进制表示中提取数字,并将其添加到PIN码中以实现良好测量

它与Google Authenticator、YubiKey、Symantec VIP access等中使用的开放标准TOTP算法(Initiative For Open Authentication的一部分)并没有太大不同。只需MOAR SPESHUL和专有的EKSTRA SECURITEH!

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8340495

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档