I have a task, that I must change our openssl codes to iOS native codes, and I'm stuck at this RSA_private_encrypt function. I can't find a way to do RSA encryption with private key. (I must use PKCS1 padding too.)
I tried SecKeyCreateEncryptedData but it accepts only public keys, even if I specify the kSecAttrCanEncrypt:true on private key generation. I tried SecKeyCreateSignature also, because it requires private key, but with no success.
Is there any way that I can use an RSA private key for encryption?