如何为 MAC 密钥生成 OpenID 共享密钥?

发布于 2024-10-04 20:07:24 字数 328 浏览 1 评论 0原文

基本上,到目前为止,我对这个过程的理解是,我选择一个模数 (p)、一个生成器 (g) 和一个介于 1 和 p-1(含)之间的随机私钥 (xa)。提供者选择一个随机私钥(xb)。共享秘密是 g ^ (xa * xb) mod p = (g ^ xa) ^ xb mod p = (g ^xb) ^ xa mod p。

我已经大约三年没有学过数学了,所以我不知道这意味着什么(一旦 mod 函数被击中),也不知道为什么有三个等号(我最好的猜测是这三个语句需要等于每个其他)。我正在尝试使用 Javascript 为 MAC 密钥生成共享密钥,以针对 Google 服务器执行 OpenID 请求。任何人都可以提供一些帮助或澄清吗?

Basically, my understanding of the process so far is that I choose a modulus (p), a generator (g), and a random private key (xa) that is between 1 and p-1, inclusive. The provider chooses a random private key (xb). The shared secret is g ^ (xa * xb) mod p = (g ^ xa) ^ xb mod p = (g ^xb) ^ xa mod p.

I haven't taken math in about three years, so I have no idea what that means (once the mod function is hit) and have no idea why there are three equals signs (my best guess is that those three statements need to equal each other). I'm trying to use Javascript to generate a shared secret for a MAC key to do OpenID requests against Google's servers. Can anyone offer some assistance or clarification?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

明天过后 2024-10-11 20:07:24

您描述的过程称为Diffie-Hellman 密钥交换。您可以找到 javascript 的实现例如,这里

The process you describe is known as Diffie-Hellman Key Exchange. You can find an implementation for javascript here, for example.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文