protected static string DecryptData(string data2Decrypt) { //AssignParameter(); const int PROVIDER_RSA_FULL = 1; const string CONTAINER_NAME = "MyContainer"; CspParameters cspParams; cspParams = new CspParameters(PROVIDER_RSA_FULL); cspParams.KeyContainerName = CONTAINER_NAME; cspParams.Flags = CspProviderFlags.UseMachineKeyStore; cspParams.ProviderName = "Microsoft Strong Cryptographic Provider"; byte[] getpassword = Convert.FromBase64String(data2Decrypt); using (RSACryptoServiceProvider RSA = new RSACryptoServiceProvider(2048, cspParams)) { byte[] decryptedData = RSA.Decrypt(getpassword, false); return Encoding.Unicode.GetString(decryptedData); } }
DecryptData(EncryptData("datatodecrypt"))
cspParams.Flags = CspProviderFlags.UseMachineKeyStore;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)