如何使用OpenSSL.net创建证书

use*_*036 3 c# openssl

我用C#.网络编程.我的问题是使用OpenSSL.net创建证书Personal和CA并通过CA的私钥签署个人证书.

我已经在我的项目中管理了集成的OpenSSL.net,但是我找不到创建证书的代码行.

如何使用OpenSSL.net创建证书?

Dim*_*mka 6

试试这个:

 X509Name issuer = new X509Name("issuer");

 X509Name subject = new X509Name("subject");
 RSA rsa = new RSA();
 rsa.GenerateKeys(512,0x10021,null,null);
 CryptoKey key = new CryptoKey(rsa);

 X509Certificate cert = new X509Certificate(123, subject, issuer, key, DateTime.Now,
                                                       DateTime.Now.AddDays(200));

 File.WriteAllText("C:\\temp\\public.txt",rsa.PublicKeyAsPEM);
 File.WriteAllText("C:\\temp\\private.txt", rsa.PrivateKeyAsPEM);

 BIO bio = BIO.File("C:/temp/cert.cer", "w");
 cert.Write(bio);
Run Code Online (Sandbox Code Playgroud)

X509Certificate正在创建证书; cert.Write将此证书写入文件.