I am writing a method that encrypts session keys. It needs to do this such that the key can be decrypted by a different program that has been tested successfully. The decryp
RSA encryption with PKCS padding and public key acquired from certificate:
openssl rsautl -encrypt -in sesskey -inkey cert.pem -certin -out temp
openssl base64 -e -in temp -out enc_sesskey
RSA decryption with PKCS padding and private key:
openssl base64 -d -in enc_sesskey -out temp
openssl rsautl -decrypt -in temp -inkey privkey.pem -out sesskey2
Tested and confirmed to be OK because content of the "sesskey" file is the same as content of the "sesskey2" file.