Re: Suggested additional constructor for RSACryptoServiceProvider
From: Ivan Medvedev [MS] (ivanmed_at_online.microsoft.com)
Date: Mon, 16 Jun 2003 22:09:49 GMT
we are working on making this easier in the next version. We may have
something that would allow one to load a certificate and grab a public key
directly off of it, all in just a couple of lines of code.
Thanks for your valuable suggestions and for helping us make our product
This message is provided "AS IS" with no warranties, and confers no rights.
>From: "Michel Gallant" <email@example.com>
>Subject: Re: Suggested additional constructor for RSACryptoServiceProvider
>Date: Tue, 10 Jun 2003 22:02:03 -0400
>X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
>NNTP-Posting-Host: hse-windsor-ppp252269.sympatico.ca 22.214.171.124
>Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.security:1597
>No, not particularly (the publickeyfile exported by sn or secutil is in
>just a CAPI public key blob, with 3 extra headers as seen in strongname.h).
>For discussion, the RSA signature verification example at:
>shows initializing the RSACryptoServiceProvider instance by setting
>modulus and exponent.
>I am just requesting that in next release, there be some
>methods to make instantiating an RSACryptoServiceProvider object, for
>cases where only public parts are required like signature verification, a
bit easier. e.g.:
> RSACryptoServiceProvider(string exportedpublickeyfile)
>or perhaps even better, why not have
>and have the constructors extract the modulus and exponent as a
> - Mitch
>"Steven Grayson [MSFT]" <firstname.lastname@example.org> wrote in message
>> Are you wanting to use a CAPI key blob as input to the constructor?
>> This posting is provided "AS IS" with no warranties, and confers no
>> Use of included script samples are subject to the terms specified at
>> "Michel Gallant" <email@example.com> wrote in message
>> > Currently with 1.0/1.1 .NET Framework classes,
>> > constructors support initializing with existing RSA credentials using
>> > argument.
>> > I think it would be very useful to have a constructor supporting an
>> > exported public-key file argument. This would be very handy, for
>> > in using signature verification where end-users currently need to
>> > CspParameters explicitly with modulus and exponent properties.
>> > However, tools like sn.exe can export to a file the encapsulated RSA
>> > *public* key credentials (from either a keypair.snk or ANY CryptoAPI
>> > The format of this public key file is a thin wrapper around the
>> > format and is identical to that stored in SN'd assembly as the
>> part of
>> > assembly name.
>> > So why not have a "convenience" constructore like:
>> > RSACryptoServiceProvider(string publickeyfile) ?
>> > Of course one can simply serialize the public parts of CspParameters
>> > RSAParameters rsaParams = rsaCSP.ExportParameters(false) ;
>> > FileStream fs = new FileStream(rsapubparms, FileMode.CreateNew);
>> > BinaryFormatter formatter = new BinaryFormatter();
>> > formatter.Serialize(fs, rsaParams);
>> > and pass this to users (for signature verification), but I think the
>> > is a simpler approach.
>> > - Michel Gallant
>> > MVP Security