I use C #. net in programming. My problem is using a OpenSSL.net to create certificate Personal and CA and signed personally c开发者_开发百科ertificate 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?
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.
You can try this one also. Creating SSL X509 certificates using X509CertificateAuthority and X509Certificate classes. http://manmoahn-openssl-net.blogspot.com/
精彩评论