Encryption with RSA public key on iOS

后端 未结 1 367
心在旅途
心在旅途 2020-12-08 16:41

I write an iOS app to communicate with an existing server. The server generates RSA key pair(public key and private key), and sends public key to the client.

The cli

相关标签:
1条回答
  • 2020-12-08 17:21

    I will answer my qustion:

    1. create SecKeyRef with public key string

    I am helped by this post: http://blog.flirble.org/2011/01/05/rsa-public-key-openssl-ios/#its-all-in-the-format

    It led to my code: https://github.com/ideawu/Objective-C-RSA/blob/master/RSA.m#L34

    2. use the SecKeyRef to encrypt input data

    Use Apple's SecKeyEncrypt(https://developer.apple.com/library/ios/documentation/Security/Reference/certifkeytrustservices/index.html)

    3. the full code on github

    https://github.com/ideawu/Objective-C-RSA

    0 讨论(0)
提交回复
热议问题