Reading a certificate signing request with C#

后端 未结 5 2139
谎友^
谎友^ 2021-02-15 07:11

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.X509Certifica

5条回答
  •  无人及你
    2021-02-15 07:44

    Look at BouncyCastle's C# implementation. Used it for PGP stuff in the past, worked great. Something like this should get you started (not tested):

    var textReader = File.OpenText(...);
    var reader = new Org.BouncyCastle.OpenSsl.PEMReader(textReader);
    var req = reader.ReadObject() as Org.BouncyCastle.Pkcs.Pkcs10CertificationRequest;
    var info = req.GetCertificationRequestInfo();
    Console.WriteLine(info.Subject);
    

提交回复
热议问题