HighTechTalks DotNet Forums  

RsaCryptoServiceProvider doubt

Dotnet Security microsoft.public.dotnet.security


Discuss RsaCryptoServiceProvider doubt in the Dotnet Security forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Victor Pereira
 
Posts: n/a

Default RsaCryptoServiceProvider doubt - 02-14-2007 , 01:48 PM






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



Reply With Quote
  #2  
Old   
Joe Kaplan
 
Posts: n/a

Default Re: RsaCryptoServiceProvider doubt - 02-14-2007 , 09:51 PM






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 (AT) gmail (DOT) com> wrote

Quote:
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




Reply With Quote
  #3  
Old   
Victor Pereira
 
Posts: n/a

Default Re: RsaCryptoServiceProvider doubt - 02-15-2007 , 07:42 AM



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 (AT) removethis (DOT) accenture.com> escreveu na mensagem
news:emermwKUHHA.528 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
Quote:
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 (AT) gmail (DOT) com> wrote in message
news:%23gDM4iGUHHA.1208 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
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






Reply With Quote
  #4  
Old   
Dominick Baier
 
Posts: n/a

Default Re: RsaCryptoServiceProvider doubt - 02-15-2007 , 09:20 AM



are you sure you really wanna use the raw RSA key - or rather use the higher
level PKCS classes to encrypt the data?

Have a look at this article:
http://msdn.microsoft.com/msdnmag/is...y/default.aspx


-----
Dominick Baier (http://www.leastprivilege.com)

Developing More Secure Microsoft ASP.NET 2.0 Applications (http://www.microsoft.com/mspress/books/9989.asp)

Quote:
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 (AT) removethis (DOT) accenture.com> escreveu na
mensagem
news:emermwKUHHA.528 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
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 (AT) gmail (DOT) com> wrote in message
news:%23gDM4iGUHHA.1208 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
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




Reply With Quote
  #5  
Old   
Smorn
 
Posts: n/a

Default Re: RsaCryptoServiceProvider doubt - 02-18-2007 , 04:23 AM



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:

Quote:
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 (AT) removethis (DOT) accenture.com> escreveu na mensagem
news:emermwKUHHA.528 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
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 (AT) gmail (DOT) com> wrote in message
news:%23gDM4iGUHHA.1208 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
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







Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.