Shared Secret based on Elliptic curve Diffie–Hellman with CommonCrypto

一世执手 提交于 2019-12-12 11:07:42

问题


I am looking for the methods in CommonCrypto to generate the shared secret based on ECDH (Elliptic curve Diffie–Hellman). I can find proprietary implementations like this one https://github.com/surespot/surespot-ios/blob/master/surespot/encryption/EncryptionController.mm but this one is not using CommonCrypto. The method to calculate the shared secret is called sometimes Key Exchange and includes the calculation of the shared secret. Can someone send a link to the right documentation or to an example that uses CommonCrypto for generating the shared secret based on Elliptic curve Diffie–Hellman?


回答1:


Look at CommonCrypto function from CommonECCryptor.h

CCECCryptorComputeSharedSecret( CCECCryptorRef privateKey, CCECCryptorRef publicKey, void *out, size_t *outLen)

It constructs a Diffie-Hellman shared secret with a private and public ECC key. Most information they provide are in the header file's commence lines. Header of CCECCryptorComputeSharedSecret is here



来源:https://stackoverflow.com/questions/26750532/shared-secret-based-on-elliptic-curve-diffie-hellman-with-commoncrypto

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!