Re: PKI Question
From: Michel Gallant (neutron_at_nspxistar.ca)
Date: 09/29/03
- Next message: K. Shier: "Re: WindowsPrincipal.IsInRole not working"
- Previous message: Jeff: "Signing Error"
- In reply to: mm: "PKI Question"
- Next in thread: Ivan Medvedev [MS]: "Re: PKI Question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Mon, 29 Sep 2003 10:54:19 -0400
I think PEM public keys are simply b64 encoded binary DER standard
asn.1 encoded public keys (possibly with --- Begin Certificate ---- lines?)
PEM format for private keys varies a bit. See this site for some interesting
pointers:
http://www.drh-consultancy.demon.co.uk/
To instantiate an RSACryptoServiceProvider from a PEM public key,
you can use convenience classes in WSE, or manually decode the
asn.1 public key data into a CryptoAPI PUBLICKEYBLOB, and then
extract the modulus and exponent from this and initialize like so:
RSAParameters RSAKeyInfo = new RSAParameters();
RSAKeyInfo.Modulus = modulus;
RSAKeyInfo.Exponent = exponent;
RSACryptoServiceProvider oRSA = new RSACryptoServiceProvider();
oRSA.ImportParameters(RSAKeyInfo);
A forthcoming article at MSDN Security Centre:
http://msdn.microsoft.com/security/
will discuss this in great detail (showing how to get this from certificate files, or any CryptoAPI
cert store).
Whidbey will have vastly improved support for X509 certificates and the current .NET Crypto classes.
Cheers,
- Michel Gallant
MVP Security
"mm" <mehulbv@hotmail.com> wrote in message news:ei4RpiihDHA.2296@TK2MSFTNGP09.phx.gbl...
> Hello Everyone,
>
> I am working on an application which needs to verify digitally signed MD5
> Hashes sent to us over HTTPS. Our clients application is written in Java and
> we are
> developing our side of the application in C#. They have supplied me with
> their public key in PEM format. I have two questions...
>
> 1. How do I generate a public and private key pair in PEM Format so I can
> provide my client with our public key. The only way I know is to use Open
> SSL to do this, can this be done through vs.net. I used the
> RSACryptoServiceProvider to generate the key pair and then dumped the keys
> into a text file using the ToXmlString() Method. but this gives me the
> Modules, Exponent, D, P,Q, ect. values in the file. How can I convert these
> into a PEM Format?
>
> 2. How do I import the public key supplied to us in PEM format into an
> instance of RSACryptoServiceProvider so I can use the
> RSAPKCS1SignatureFormatter class to verify the message (MD5 Hash)
>
> Thanks in advance for all your help
>
> -Zubin
>
>
- Next message: K. Shier: "Re: WindowsPrincipal.IsInRole not working"
- Previous message: Jeff: "Signing Error"
- In reply to: mm: "PKI Question"
- Next in thread: Ivan Medvedev [MS]: "Re: PKI Question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|