Re: RsaCryptoServiceProvider doubt



Guys,
How about this approach("cert" is X509Certificate2)?

RSACryptoServiceProvider rsa_pub =
(RSACryptoServiceProvider)cert.PublicKey.Key;
or
RSACryptoServiceProvider rsa_prv = (RSACryptoServiceProvider)cert.PrivateKey;

Smorn

"Victor Pereira" wrote:

Hi Joe,

Ok thanks for your reply.

I think that i didn't explained very clearly my problem.

I don't know how can i get these properties and populate the
RsaCryptoServiceProvider structure to call the method Encrypt with my
private key. Understood ?

Thanks again,

Victor
"Joe Kaplan" <joseph.e.kaplan@xxxxxxxxxxxxxxxxxxxxxxxx> escreveu na mensagem
news:emermwKUHHA.528@xxxxxxxxxxxxxxxxxxxxxxx
The X509Certificate2.PublicKey.Key property will give you an
RSACryptoServiceProvider for that certificate and the
X509Certificate.PrivateKey property will give you an AsymmetricAlgorithm
class you can use.

Joe K.

--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services
Programming"
http://www.directoryprogramming.net
--
"Victor Pereira" <pelasaco@xxxxxxxxx> wrote in message
news:%23gDM4iGUHHA.1208@xxxxxxxxxxxxxxxxxxxxxxx
Hi,

I have a certificate and it's private key.

I'm accessing my certificate and my private key using the
X509Certificate2.

My problem is: I can't pass to the RsaCryptoServiceProvider class my
Private and Public key. How can i do it ?

Thanks in advance,

Victor






.



Relevant Pages

  • Re: RsaCryptoServiceProvider doubt
    ... Joe Kaplan-MS MVP Directory Services Programming ... I have a certificate and it's private key. ... I can't pass to the RsaCryptoServiceProvider class my ...
    (microsoft.public.dotnet.security)
  • Re: RsaCryptoServiceProvider doubt
    ... are you sure you really wanna use the raw RSA key - or rather use the higher level PKCS classes to encrypt the data? ... RsaCryptoServiceProvider structure to call the method Encrypt with my ... I have a certificate and it's private key. ...
    (microsoft.public.dotnet.security)
  • Re: Is RSAPKCS1SignatureDeformatter supported?
    ... the private key to an RSAParameters structure and then use ... RSACryptoServiceProvider instance. ... of the RSACryptoServiceProvider before calling the ImportParameters method. ... automatically generate an RSA key for you (which is then thrown away after ...
    (microsoft.public.dotnet.security)
  • Re: Retrieving the private key associated with a certificate
    ... I have a problem getting the private key associated with a certificate I ... RSACryptoServiceProvider to digitally sign content. ... private key data or the PrivateKey property of the X509Certificate2 ...
    (microsoft.public.dotnet.security)
  • Re: RsaCryptoServiceProvider doubt
    ... RsaCryptoServiceProvider structure to call the method Encrypt with my ... Co-author of "The .NET Developer's Guide to Directory Services ... I have a certificate and it's private key. ...
    (microsoft.public.dotnet.security)