Archived Forum Post

Index of archived forum posts

Question:

RSA Encryption on iOS (RSA/ECB/PKCS1Padding)

Jun 27 '14 at 13:23

I need to encrypt a NSString using a public key from a webserver certificate on iOS. Can i use Chilkat lib for this? How could i do this?


Answer

Probably, but it depends on what you want to do. Typically, if a digital certificate is involved the need is to produce PKCS7 encrypted output. If this is the case, then you would use Chilkat Crypt with the CryptAlgorithm property set to "pki". The Certificate is specified by calling SetEncryptCert (see http://www.chilkatsoft.com/refdoc/objcCkoCrypt2Ref.html ). The string would be encrypted by calling EncryptString or EncryptStringENC, depending on whether you want binary output or output encoded in printable string form (base64, hex, etc.)