News  [SoftwareSite

Latest News
Older News
RSS Feed
Complete Projects
Useful Classes
Top Downloads
Message Board
Send Comments
Software License Buttons
Forums -> Security Library Forum
Can the Certificate's private key be used to encrypt with RSA?  
by Sarah Boaz [sarahb at loansoft dot com]
posted on 2004/08/26

In attempting to encrypt with a private key, I created a Org.Mentalis.Security.Certificate object "cert" and used it's private key to instantiate a OAEPKeyExchangeFormatter:

Dim RSAFormatter As New RSAOAEPKeyExchangeFormatter(cert.PrivateKey)
encryptedData = RSAFormatter.CreateKeyExchange(decryptedData)

But, when I do this, I can only decrypt it with the PRIVATE key, which makes me think it's actually using the public key to encrypt. I can't access the key directly since it itself is encrypted in a PFX file so I have limited ways to test if it's really using the private key.

Does passing the private key to a RSAOAEPKeyExchangeFormatter guarantee it's using the private key?

Thanks again.

by Pieter Philippaerts [Pieter at mentalis dot org]
posted on 2004/08/26

Encryption with an asymmetric algorithm such as RSA always uses the public key, not the private key.
The RSAOAEPKeyExchangeFormatter will only use the public key of the RSA key pair.


Copyright © 2002-2007, The Team. All rights reserved.
This site is located at
Send comments to the webmaster.