MSMVPS.COM
The Ultimate Destination for Blogs by Current and Former Microsoft Most Valuable Professionals.

Get public key from certificate, and Convert the key to the RSAParameter

 byte[] pk = cer.GetPublicKey();
   byte[] m = new byte[pk.Length - 3];
   Buffer.BlockCopy(pk, 0, m, 0, m.Length);
   byte[] e = new byte[3];
   Buffer.BlockCopy(pk, m.Length, e, 0, 3);
   String key = "<RSAKeyValue><Modulus>" + Convert.ToBase64String(m)+"</Modulus><Exponent>"+Convert.ToBase64String(e)+"</Exponent></RSAKeyValue>";
   Console.WriteLine(key);
   RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
   rsa.FromXmlString(key);
   Console.WriteLine(rsa.ToXmlString(false));

Posted Apr 08 2004, 12:28 PM by Montaque
Filed under:

Comments

Montaque wrote re: Get public key from certificate, and Convert the key to the RSAParameter
on 04-08-2004 12:28
Here cer is a X509Certificate
Montaque wrote re: Get public key from certificate, and Convert the key to the RSAParameter
on 09-28-2004 15:01
d
TrackBack wrote re:Get public key from certificate, and Convert the key to the RSAParameter
on 04-12-2005 23:12
^_^,Pretty Good!
TrackBack wrote re:Get public key from certificate, and Convert the key to the RSAParameter
on 04-16-2005 2:37
^_~
Montaque wrote Pretty Good
on 08-04-2005 14:06
excellent !! you fu'n rule, dude
contact me, please
nirvfan_mty (at) hot... blah blah blah

cheers
Get public key from certificate, and Convert the key to the RSAParameter wrote Get public key from certificate, and Convert the key to the RSAParameter
on 12-05-2007 16:34

Pingback from  Get public key from certificate, and Convert the key to the RSAParameter

Add a Comment

(required)  
(optional)
(required)  
Remember Me?


Copyright © is the original authors. Blog site is an independent site not sponsored by Microsoft. The Yoda blog server and the Brianna SQL server would like to thank www.ownwebnow.com and www.exchangedefender.com. They wouldn't be here and broadcasting without the generosity of Vlad Mazek and his companies.

Powered by Community Server (Commercial Edition), by Telligent Systems