Re: X509Certificate2 and en/decryption
- From: "Pieter Philippaerts" <pieter.nospam@xxxxxxxxxxxx>
- Date: Sat, 17 Jun 2006 22:55:13 +0200
<b.fokke@xxxxxxxxx> wrote in message
// Retrieve RSA CSP containing public key
RSACryptoServiceProvider rsa =
(RSACryptoServiceProvider)certificate.PublicKey.Key;
byte[] encrypted = rsa.Encrypt(toEncrypt , false);
// Retrieve RSA CSP containing private key
RSACryptoServiceProvider rsa =
(RSACryptoServiceProvider)certificate.PrivateKey;
byte[] decrypted = rsa.Encrypt(encrypted , false);
You're calling the Encrypt method twice; you should first call the Encrypt
method of the PublicKey or PrivateKey (it doesn't make a difference) and
then call the Decrypt method of the PrivateKey object.
Regards,
Pieter Philippaerts
.
- References:
- X509Certificate2 and en/decryption
- From: b . fokke
- X509Certificate2 and en/decryption
- Prev by Date: Re: Determine AD group membership
- Next by Date: Re: Determine AD group membership
- Previous by thread: X509Certificate2 and en/decryption
- Next by thread: Re: How can I test My CSP?
- Index(es):