views:

252

answers:

2

Hello,

I want to read the contents of a csr in c#, however I haven't found any way to do it in c#. What I've found was the namespace System.Security.Cryptography.X509Certificates, but it only handles existing certificates, not certificate requests:/

Can anyone give me an hint about it? Thanks in advance.

Jorge

A: 

It seems to me the best way for you is usage unmanaged CryptoAPI or P/Invoke. CryptoAPI has CERT_REQUEST_INFO data struct and CryptSignAndEncodeCertificate function which can be used with X509_CERT_REQUEST_TO_BE_SIGNED parameter. Of cause theoretically it's possible to encode request manually with respect of AsnEncodedData, because CSR is not complex (see http://en.wikipedia.org/wiki/Certificate_signing_request and http://www.rfc-editor.org/rfc/rfc2311.txt), but I don't think that it has a sense if an implementation already exist in CryptoAPI.

A good examples to create CSR with respect of CryptoAPI you will find in http://msdn.microsoft.com/en-us/library/aa382364(VS.85).aspx and http://msdn.microsoft.com/en-us/library/ms867026.aspx.

Oleg
A: 

You would need a third-party library. You can generate, read, write and use CSRs in .NET using PKIBlackbox package of SecureBlackbox.

Eugene Mayevski 'EldoS Corp