如何使用 OpenSSL.net 创建证书

发布于 2024-11-03 01:54:00 字数 150 浏览 0 评论 0原文

我用C#。 NET在编程中。我的问题是使用 OpenSSL.net 创建证书个人和 CA 并由 CA 的私钥签署个人证书。

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

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

I use C #. net in programming. My problem is using a OpenSSL.net to create certificate Personal and CA and signed personally certificate by a private key of CA.

I have already managed the integrated OpenSSL.net in my project, but I can not find the line of code to create the certificate.

How do I create a certificate with OpenSSL.net?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

鲜肉鲜肉永远不皱 2024-11-10 01:54:00

试试这个:

 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);

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

Try this one:

 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);

X509Certificate is creating a certificate; cert.Write writes this certificate to a file.

微暖i 2024-11-10 01:54:00

你也可以尝试一下这个。
使用 X509CertificateAuthority 和 X509Certificate 类创建 SSL X509 证书。
http://manmoahn-openssl-net.blogspot.com/

You can try this one also.
Creating SSL X509 certificates using X509CertificateAuthority and X509Certificate classes.
http://manmoahn-openssl-net.blogspot.com/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文