How do I get RSA public key from X509Certificate ?

From: Kishore (kishorerc@hotmail.com)
Date: 07/24/02


From: "Kishore" <kishorerc@hotmail.com>
Date: Tue, 23 Jul 2002 21:10:24 -0700


Hi Everyone,
I have a X509Certificate, I want to get a RSA object using the public key
from the cert. Is this code correct ?

public RSA GetKey(X509Certificate cert)
{
    RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
    RSAParameters keyInfo = new RSAParameters();
    keyInfo.Exponent = key;
    keyInfo.Modulus = key;
    rSA.ImportParameters(keyInfo);
    return rsa;
}

Or should I use {1,0,1} for the Exponent ?
Thanks,
Kishore



Relevant Pages

  • Re: Storage of Client Certificates
    ... I guess the idea of using SCT comes from how SSL works, using the cert ... > used during Key exchange to generate a private session key on both sides. ... > your cert (and the public key in that cert). ...
    (microsoft.public.dotnet.framework.webservices.enhancements)
  • Re: VPN: RSA vs Pre-Shared
    ... I use rsa-encr or rsa-sig, ... With either of the RSA methods, you will need to generate an RSA key pair on each router. ... RSA-ENCR requires manual entry of the peer's public key into your local config. ...
    (comp.dcom.sys.cisco)
  • Re: OE Encryption
    ... It will include identification of your cert. ... It will also include your public key which will be needed by anyone who wants to send you an encrypted message. ... They use your public key to encrypt their message and you use your private key to decrypt it. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: PGP scripting...
    ... It looks like you're talking about how RSA works. ... public key consists of the modulus and the public exponent. ... >> private key is by definition also in possession of the public key. ...
    (SecProg)
  • Re: VPN: RSA vs Pre-Shared
    ... Pre-shared keys are the least secure, and I don't use them for site-to-site VPNs. ... With either of the RSA methods, you will need to generate an RSA key pair on each router. ... RSA-ENCR requires manual entry of the peer's public key into your local config. ...
    (comp.dcom.sys.cisco)