Anurag Maurya

Anurag Maurya

  • NA
  • 275
  • 16.2k

I want to generate RSA key pair in C#. I am able to get xml

Sep 25 2017 6:57 AM
I want to generate RSA key pair in C#. I am able to get XML strings of keys, but I need base64 representations of them. Here is my code for XML
  1. RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();   
  2. privateKeyXmlText = rsa.ToXmlString(true);   
  3. publicKeyXmlText = rsa.ToXmlString(false);  
but what I want is something like
  1. privateKeyStr=="MIICITAjBgoqhkiG9w0BDAEDMBUEEKaTCK5mE2MsQANxDAfaJe8CAQoEggH47qb6bFO+a2Fj...";  
  2. publicKeyStr == "MIIBKjCB4wYHKoZIzj0CATCB1wIBATAsBgcqhkjOPQEBAiEA/////wAA...";  
any ideas?

Answers (1)