I found this and thought it was the answer to my prayers. However, using openssl (1.0.0e Mac os x) to generate pubs / private keys, I cannot get clear text back from ciphertext - is there a GetBytes / Baseencode method that I skip? did you come across this?
EDIT: as soon as I sent the message, I came across another example using UTF8 encoding, not ASCII, which works!
Ben
namespace testopenssl2 { class Program { public static byte[] AsymmetricEncrypt(string publicKeyAsPem, byte[] payload) { CryptoKey d = CryptoKey.FromPublicKey(publicKeyAsPem, null); RSA rsa = d.GetRSA(); byte[] result = rsa.PublicEncrypt(payload, RSA.Padding.PKCS1); rsa.Dispose(); return result; } public static byte[] AsymmetricDecrypt(string privateKeyAsPem, byte[] payload) {
source share