Home All Groups Group Topic Archive Search About

Extract Public Key From certificate and RSACryptoServiceProvider

Author
9 Dec 2006 3:45 PM
msnews.microsoft.com
I am using .NET Framework 2.0. I used X509Certificate class to obtain the
public key from a certificate file.

        // The path to the certificate.
        string Certificate = "C:\\Certificate.cer";

        // Load the certificate into an X509Certificate object.
        X509Certificate cert = new X509Certificate(Certificate);

        byte[] key = cert.GetPublicKey();

My question is how do i use the key to instantiate data to instantiate
RSACryptoServiceProvider. I need this in order to verify a signature
received from a client machine.

Thanks.

Author
9 Dec 2006 4:02 PM
Dominick Baier
Hi,

use the X509Certificate2 class - The public/private Property returns a RSACryptoServiceProvider...


-----
Dominick Baier (http://www.leastprivilege.com)

Show quoteHide quote
> I am using .NET Framework 2.0. I used X509Certificate class to obtain
> the public key from a certificate file.
>
> // The path to the certificate.
> string Certificate = "C:\\Certificate.cer";
> // Load the certificate into an X509Certificate object.
> X509Certificate cert = new X509Certificate(Certificate);
> byte[] key = cert.GetPublicKey();
>
> My question is how do i use the key to instantiate data to instantiate
> RSACryptoServiceProvider. I need this in order to verify a signature
> received from a client machine.
>
> Thanks.
>
Author
9 Dec 2006 5:22 PM
msnews.microsoft.com
Hi,

I couldn't find such property in X509Certificate2.

Show quoteHide quote
"Dominick Baier" <dbaier@pleasepleasenospam_leastprivilege.com> wrote in
message news:51eb3048393a8c8e9cafbaf7bd0@news.microsoft.com...
> Hi,
> use the X509Certificate2 class - The public/private Property returns a
> RSACryptoServiceProvider...
>
>
> -----
> Dominick Baier (http://www.leastprivilege.com)
>
>> I am using .NET Framework 2.0. I used X509Certificate class to obtain
>> the public key from a certificate file.
>>
>> // The path to the certificate.
>> string Certificate = "C:\\Certificate.cer";
>> // Load the certificate into an X509Certificate object.
>> X509Certificate cert = new X509Certificate(Certificate);
>> byte[] key = cert.GetPublicKey();
>>
>> My question is how do i use the key to instantiate data to instantiate
>> RSACryptoServiceProvider. I need this in order to verify a signature
>> received from a client machine.
>>
>> Thanks.
>>
>
>
Author
9 Dec 2006 10:10 PM
Joe Kaplan
You actually want the Key property of the PublicKey property on the
X509Certificate2 class.

--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
--
Show quoteHide quote
"msnews.microsoft.com" <annonym***@microsoft.com> wrote in message
news:ehVDRa7GHHA.4056@TK2MSFTNGP03.phx.gbl...
> Hi,
>
> I couldn't find such property in X509Certificate2.
>
> "Dominick Baier" <dbaier@pleasepleasenospam_leastprivilege.com> wrote in
> message news:51eb3048393a8c8e9cafbaf7bd0@news.microsoft.com...
>> Hi,
>> use the X509Certificate2 class - The public/private Property returns a
>> RSACryptoServiceProvider...
>>
>>
>> -----
>> Dominick Baier (http://www.leastprivilege.com)
>>
>>> I am using .NET Framework 2.0. I used X509Certificate class to obtain
>>> the public key from a certificate file.
>>>
>>> // The path to the certificate.
>>> string Certificate = "C:\\Certificate.cer";
>>> // Load the certificate into an X509Certificate object.
>>> X509Certificate cert = new X509Certificate(Certificate);
>>> byte[] key = cert.GetPublicKey();
>>>
>>> My question is how do i use the key to instantiate data to instantiate
>>> RSACryptoServiceProvider. I need this in order to verify a signature
>>> received from a client machine.
>>>
>>> Thanks.
>>>
>>
>>
>
>