Click here to Skip to main content
15,921,028 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello,
i want to generate the public key and private key by passing our own string.

Suppose my string is "hello how are you" and i want to generate the public and private key for this string.

What I have tried:

RSACryptoServiceProvider rsa;
           const int PROVIDER_RSA_FULL = 1;
           const string CONTAINER_NAME = "test";
           CspParameters cspParams;
           cspParams = new CspParameters(PROVIDER_RSA_FULL);
           cspParams.KeyContainerName = CONTAINER_NAME;
           cspParams.Flags = CspProviderFlags.UseMachineKeyStore;

           rsa = new RSACryptoServiceProvider(cspParams);
           string publicPrivateKeyXML = rsa.ToXmlString(true);
           string publicOnlyKeyXML = rsa.ToXmlString(false);



here i am using this code by copied it from one site. here i am confuse in can we pass our own string to get public key and private key.
Posted
Updated 13-Jun-17 20:40pm

1 solution

const string CONTAINER_NAME = "hello how are you";
or
string friendlyString = "hello how are you";

const string CONTAINER_NAME = friendlyString;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900