These days have been concentrated on the development of iOS, just to record the problems encountered. The problem this time is that if the user name and password are encrypted on the iOS client based on the public key that is obtained.
The public key is as follows:
-----BEGIN Public KEY-----MIGFMA0GCSQGSIB3DQEBAQUAA4GNADCBIQKBGQCP0WHYBG/ nopo3nzmd3dndws0mccumexchgvlgooyyfwlds24im2e7yyhb0wrusyyf0/ nhzczbk8zc9ecwqd0ahbdgoqt6cufqbmjbygyvlvyu2zp7kg9ft6yv6oc9ambuo7npzh+ Bvxh0zdkfi02prknrscakc0xhadtht3al0qidaqab-----END Public KEY-----
Then Google search in iOS for RSA encryption, found several articles as follows:
RSA encryption method on IOS
RSA encryption method on IOS
After a closer look at these two articles, I found that they were all read from the file Public_key for encryption, and I encountered the scene is Public_key is given, rather than generate their own public_key to encrypt, so these two articles on my help is not much.
Then find this problem on StackOverflow, the link is: Encryption with the RSA public key on IOS, @ideawu have already exposed this encryption algorithm, and then according to their own attempts to find this method is feasible. The following is the direct call he wrote the method to encrypt, and the server side to decrypt the process of encryption and decryption completed.
NSString *encryptusername =*encryptpassword = [RSA encryptstring:password Publickey:pubkey];
Finally, if there is a problem accessing GitHub, I upload the RSA file to my space for easy download.
RSA file
Encrypt with the public Key for OpenSSL in iOS