【问题标题】:Shared Secret based on Elliptic curve Diffie–Hellman with CommonCrypto基于椭圆曲线 Diffie-Hellman 和 CommonCrypto 的共享密钥
【发布时间】:2014-11-05 05:49:11
【问题描述】:

我正在寻找 CommonCrypto 中基于 ECDH(椭圆曲线 Diffie-Hellman)生成共享密钥的方法。我可以找到像 https://github.com/surespot/surespot-ios/blob/master/surespot/encryption/EncryptionController.mm 这样的专有实现,但这个没有使用 CommonCrypto。计算共享秘密的方法有时称为密钥交换,包括计算共享秘密。有人可以将链接发送到正确的文档或使用 CommonCrypto 根据椭圆曲线 Diffie-Hellman 生成共享密钥的示例吗?

【问题讨论】:

    标签: ios cryptography diffie-hellman shared-secret


    【解决方案1】:

    查看 CommonECCryptor.h 中的 CommonCrypto 函数

    CCECCryptorComputeSharedSecret(CCECCryptorRef privateKey, CCECCryptorRef 公钥, 无效*出, size_t *outLen)

    它使用私有和公共 ECC 密钥构造 Diffie-Hellman 共享密钥。 他们提供的大部分信息都在头文件的开始行中。 Header of CCECCryptorComputeSharedSecret is here

    【讨论】:

    • 很好,但是你有包含路径吗? #import <CommonCrypto/CommonECCryptor.h> 不起作用。这是在安全框架中吗?它是公共 API 吗?
    • #import ?我的答案的 URL 链接到 C/C++ 标头。 C 包含带有#include 的标头。
    • 我不像你那么现代:) 我使用旧 C。特别调用此函数的测试是 here
    • 问题在于 iOS 只能使用公共 API。
    • 问题的作者正在寻找 CommonCrypto 中的方法来生成基于 ECDH 的共享密钥。我指了指函数。该问题不包含任何限制(应用商店、语言等)。作者应该决定他的环境是否允许这种方法。
    猜你喜欢
    • 2020-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-17
    • 2018-12-20
    相关资源
    最近更新 更多