1. RSA encryption uses the public key given by the server. Pem,rsa signing uses the client's private key. Pem.
Reference article: http://www.jianshu.com/p/4580bee4f62f
Import the folder into the project, then configure the two places OK, if the new project remember to close Bitcode.
Key code
hbrsahandler* handler = [HbrsahandlerNew]; //EncryptNSString *publicfilepath = [[NSBundle mainbundle] Pathforresource:@"Serverpubkey.pem"Oftype:nil]; [Handler Importkeywithtype:keytypepublic Andpath:publicfilepath];//Load Public KeyNSString *test =@"data that needs to be encrypted"; Test=[Handler Encryptwithpublickey:test]; NSLog (@"Encryption result =%@", test); //SignatureNSString *privatekeyfilepath = [[NSBundle mainbundle] Pathforresource:@"Clientprikey.pem"Oftype:nil]; [Handler Importkeywithtype:keytypeprivate Andpath:privatekeyfilepath];//Load Private keyNSString *xml =@"This is test message!"; XML=[Handler Signstring:xml]; NSLog (@"Signature Result:%@", XML);
Both the public and private keys are strings and can be encrypted with a string.
Dem Download Password: 4BPW
Encryption and signing for IOS RSA