X509 Certificates and Riijndael encryption

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Mattia Saccotelli ("m.saccotelli)
Date: 11/23/04


Date: Tue, 23 Nov 2004 14:49:29 +0100

Hi
I would like to encrypt data using AES (Rijndael) algorithm, providing
as the key the key from a given certificate. Just for testing I'm using
the public key..

Shouldn't I use the private key instead of the public one?

Is there a way to get it or to use such algorithm with a specified
private key from a certificate (which may eventually be on a regular file)?

-- 
About the public key I did the following to get an appropriate key length:
private byte[] getKey() {
	X509Certificate cer = 
X509Certificate.CreateFromCertFile(@"c:\tmp\certificates\mattia.cer");
	byte[] certKey = cer.GetPublicKey();
	byte[] theKey = new byte[keySize / 8];
	for (int i = 0; i < (keySize / 8) && i < certKey.Length; i++) {
		theKey[i] = certKey[i];
	}
	
	return theKey;
}
BTW I think it's not the right way to solve the problem, I can't simply 
truncate the key to the needed length.


Relevant Pages

  • Obtaining Private Key out of a JKCS8 file
    ... maybe I could get some further insight ... and serial are then fed to the algorithm. ... providing me with a JKCS10/8 and the actual certificate. ... Is there any way/tool/API with which I can extract the Private Key as ...
    (comp.security.misc)
  • Extracting Private Key
    ... maybe I could get some further insight ... and serial are then fed to the algorithm. ... providing me with a JKCS10/8 and the actual certificate. ... Is there any way/tool/API with which I can extract the Private Key as ...
    (microsoft.public.dotnet.security)
  • Re: secrets of the EFS key pair maker
    ... > "If the certificate is not available, the private key will not be ... > and I can't find details on the algorithm that creates the key pairs. ... If you do not have the certificate and you do not have a key recovery agent ...
    (microsoft.public.windowsxp.security_admin)
  • Re: Unable to use third-party cert after Exch Sp2 update on SBS200
    ... Every *server* certificate in IIS has to ... The public key is sent when a request from a browser ... The public key is used to *decrypt* data. ... The private key is used ...
    (microsoft.public.windows.server.sbs)
  • RE: SIMple SSL question ??
    ... I believe your book is instructing you to keep the private key secure. ... you use the certificate request wizard in IIS to install the cert after it's ... the certificate that's just been installed. ... If an attacker retrievs the SSL certificate, ...
    (microsoft.public.dotnet.security)