Re: Using X509Certificates with RSACryptoServiceProvider

From: Michel Gallant (neutron_at_istar.ca)
Date: 07/19/03


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:
   http://pages.istar.ca/~neutron/dotnet/DecodeCertKey

 - Mitch

"Marcello Drewanz" <mdrewanz@csfbgarantia.com> wrote in message
news:eHNu50bTDHA.2480@tk2msftngp13.phx.gbl...
> Michel,
> 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" <neutron@istar.ca> wrote in message
> news:utQGTPyRDHA.2432@TK2MSFTNGP10.phx.gbl...
> > 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
> Modulus
> > properties. Currently in .NET, X509Certificates are not easily "connected"
> to
> > 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
> key
> > modulus and exponent in big-endian byte ordered arrays, suitable for
> passing
> > directly to RSAParameters.Exponent and RSAParameters.Modulus
> > http://pages.istar.ca/~neutron/dotnet/DecodeCertKey
> >
> > - Michel Gallant
> > MVP Security
> >
> >
>
>