Decrypt a String Using an RSA Key
To decrypt a string:
Create a NAE Session. Pass the NAE username, password, and property file path as arguments.
session = new NaeSession(user, pass, @"../../../../../../../CADP.NETCore_Properties.xml");
Create instance of the key that was used for encryption.
NaeKeyManagement nkm = new NaeKeyManagement(session); key = (NaeRsaKey)nkm.GetKey("generic_rsa_key");
Note
The
generic_rsa_key
must be present on the server.Call the
Decrypt
method of the key and pass the data you want to decrypt.
RSAEncryptionPadding padding = RSAEncryptionPadding.OaepSHA256; byte[] decrBytes = key.Decrypt(incrBytes, padding);