I have a pre-existing RSA encryption public / private key pair that I need to use in .net. All the examples that I can find on the Internet demonstrate how to create a new private / public pair and then encrypt / decrypt. i.e. something like that:
const int PROVIDER_RSA_FULL = 1;
const string CONTAINER_NAME = "SpiderContainer";
CspParameters cspParams;
cspParams = new CspParameters(PROVIDER_RSA_FULL);
cspParams.KeyContainerName = CONTAINER_NAME;
cspParams.Flags = CspProviderFlags.UseMachineKeyStore;
cspParams.ProviderName = "Microsoft Strong Cryptographic Provider";
rsa = new RSACryptoServiceProvider(cspParams);
.....
rsa.encrypt(...)
rsa.decrypt(...)
As you can see, there is no way to skip to indicate an existing public / private key.
Does anyone know how to accomplish what I'm trying to do? Any help would be greatly appreciated.
Greetings Naren
source
share