Re: Using X509Certificates with RSACryptoServiceProvider
From: Michel Gallant (neutron_at_istar.ca)
Date: Sat, 19 Jul 2003 11:32:39 -0400
Not sure what the problem is. You should be able to instantiate an
RSACryptoServiceProvider instance (memory resident) from only specifying
the modulus and key values to RSAParameters and then import.
I updated the sample with code which I tried on a few DER cert files
with no problems. Also the sample output is updated:
"Marcello Drewanz" <firstname.lastname@example.org> wrote in message
> Included your stuff from DecodeCertKey to get the exponent and the modulus,
> but when
> I hit the rsa.ImportParameters(rsaKeyInfo) I got the message "Field is
> missing in the data."
> Any clues on what is happening ??
> -marcello drewanz
> "Michel Gallant" <email@example.com> wrote in message
> > Initializing RSACryptoServiceProvider with public key information
> > for either asymmetric encryption, or for verifying a signature
> > in .NET requires specifying the RSAParameters public key Exponent and
> > properties. Currently in .NET, X509Certificates are not easily "connected"
> > RSAParameters to make this easy.
> > The DecodeCertKey .NET sample has been extended to show one way of
> > reading any X509Certificate file (binary or b64) and decoding the public
> > modulus and exponent in big-endian byte ordered arrays, suitable for
> > directly to RSAParameters.Exponent and RSAParameters.Modulus
> > http://pages.istar.ca/~neutron/dotnet/DecodeCertKey
> > - Michel Gallant
> > MVP Security