不在c#中创建SSl证书

编程入门 行业动态 更新时间:2024-10-25 16:18:28
本文介绍了不在c#中创建SSl证书的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

这是我创建ssl证书的代码 ProcessStartInfo info = new ProcessStartInfo (); 处理p =新进程(); info.FileName = Server.MapPath(@〜\ Bin \ makekert.exe); info.UseShellExecute = false; info.Verb =runas; //提供以管理员身份运行 info.Arguments = @ - n+ @CN = ExampleSSL+ @ - b 12/10/2013 -e 01/05 / 2014 -r -sky exchange -pe -sr localMachine -ss my -sp+ @Microsoft RSA SChannel Cryptographic Provider+ @-sy 12 -sv example.pvk; p.StartInfo = info; p.Start(); 这个没有例外的是同时没有创建证书。 请检查我的代号我错了 谢谢 purna

Hi, this is my code to create ssl certificate ProcessStartInfo info = new ProcessStartInfo(); Process p = new Process(); info.FileName = Server.MapPath(@"~\Bin\makecert.exe"); info.UseShellExecute = false; info.Verb = "runas"; // Provides Run as Administrator info.Arguments = @" -n " + @"""CN=ExampleSSL""" + @" -b 12/10/2013 -e 01/05/2014 -r -sky exchange -pe -sr localMachine -ss my -sp " + @"""Microsoft RSA SChannel Cryptographic Provider""" + @" -sy 12 -sv example.pvk"; p.StartInfo = info; p.Start(); in this no exception is raising at the same time no certificate is created. Please check my code where I did mistake thanks purna

推荐答案

试试在需要显示 SSL证书 public void SSLCErtificate() { HttpWebRequest request =(HttpWebRequest)WebRequest.Create(adrBarTextBox.Text); HttpWebResponse response =(HttpWebResponse)request.GetResponse(); response.Close(); //检索ssl证书并将其分配给X509Certificate对象 X509Certificate cert = request.ServicePoint.Certificate; //将X509Certificate转换为X509Certificate2对象,方法是将其转换为构造函数 X509Certificate2 cert2 = new X509Certificate2(cert); //显示证书对话框 X509Certificate2UI .DisplayCertificate(cert2); } 感谢你 Try to call this fucntion where you need to display SSL Certificate public void SSLCErtificate() { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(adrBarTextBox.Text); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); response.Close(); //retrieve the ssl cert and assign it to an X509Certificate object X509Certificate cert = request.ServicePoint.Certificate; //convert the X509Certificate to an X509Certificate2 object by passing it into the constructor X509Certificate2 cert2 = new X509Certificate2(cert); //display the cert dialog box X509Certificate2UI.DisplayCertificate(cert2); } Thanking you

更多推荐

不在c#中创建SSl证书

本文发布于:2023-11-10 01:11:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1573951.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:证书   SSl

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!