pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

  1. <legend id='ZmDRx'><style id='ZmDRx'><dir id='ZmDRx'><q id='ZmDRx'></q></dir></style></legend>

      <small id='ZmDRx'></small><noframes id='ZmDRx'>

      <tfoot id='ZmDRx'></tfoot>
      <i id='ZmDRx'><tr id='ZmDRx'><dt id='ZmDRx'><q id='ZmDRx'><span id='ZmDRx'><b id='ZmDRx'><form id='ZmDRx'><ins id='ZmDRx'></ins><ul id='ZmDRx'></ul><sub id='ZmDRx'></sub></form><legend id='ZmDRx'></legend><bdo id='ZmDRx'><pre id='ZmDRx'><center id='ZmDRx'></center></pre></bdo></b><th id='ZmDRx'></th></span></q></dt></tr></i><div class="0uusisw" id='ZmDRx'><tfoot id='ZmDRx'></tfoot><dl id='ZmDRx'><fieldset id='ZmDRx'></fieldset></dl></div>
        <bdo id='ZmDRx'></bdo><ul id='ZmDRx'></ul>

      使用純 .net 框架生成和簽署證書請求

      Generate and Sign Certificate Request using pure .net Framework(使用純 .net 框架生成和簽署證書請求)
    1. <tfoot id='SFDXk'></tfoot>

          <small id='SFDXk'></small><noframes id='SFDXk'>

          <i id='SFDXk'><tr id='SFDXk'><dt id='SFDXk'><q id='SFDXk'><span id='SFDXk'><b id='SFDXk'><form id='SFDXk'><ins id='SFDXk'></ins><ul id='SFDXk'></ul><sub id='SFDXk'></sub></form><legend id='SFDXk'></legend><bdo id='SFDXk'><pre id='SFDXk'><center id='SFDXk'></center></pre></bdo></b><th id='SFDXk'></th></span></q></dt></tr></i><div class="igmucqu" id='SFDXk'><tfoot id='SFDXk'></tfoot><dl id='SFDXk'><fieldset id='SFDXk'></fieldset></dl></div>

          <legend id='SFDXk'><style id='SFDXk'><dir id='SFDXk'><q id='SFDXk'></q></dir></style></legend>
              • <bdo id='SFDXk'></bdo><ul id='SFDXk'></ul>
                  <tbody id='SFDXk'></tbody>
              • 本文介紹了使用純 .net 框架生成和簽署證書請求的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                限時送ChatGPT賬號..

                我正在嘗試使用純 .net 代碼創建證書請求,并根據我現有的 CA 證書(在 Windows 證書存儲中或作為單獨的文件)從證書請求創建證書.

                I am trying to use pure .net code to create a certificate request and create a certificate from the certificate request against an existing CA certificate I have available (either in the Windows Certificate store or as a separate file).

                我知道我有類 X509CertificateX509Certificate2 可用于加載證書并訪問其信息,但我在 System.Security.Cryptography 命名空間,可用于創建證書請求或簽署此類證書請求以創建新的簽名證書.

                I know that I have the classes X509Certificate and X509Certificate2 available to load certificates and get access to their information, but I don't see any classes or functionality within the System.Security.Cryptography namespace that could be used to create a certificate request or to sign such a certificate request to create a new signed certificate.

                雖然 文檔在 System.Security.Cryptography.Pkcs 命名空間 說:

                And that although the documentation on the System.Security.Cryptography.Pkcs namespace says:

                System.Security.Cryptography.Pkcs 命名空間提供編程公鑰加密標準 (PKCS) 的元素,包括簽署數據、交換密鑰、請求證書的方法,公鑰加解密等安全功能.

                The System.Security.Cryptography.Pkcs namespace provides programming elements for Public Key Cryptography Standards (PKCS), including methods for signing data, exchanging keys, requesting certificates, public key encryption and decryption, and other security functions.

                那么,我如何創建證書請求并滿足該請求以僅使用來自 System.Security.Cryptography 的純 .net 類來創建新的 X509 證書?

                So, how can I create a certificate request and fulfill that request to create a new X509 certificate using only pure .net classes from System.Security.Cryptography?

                注意:

                • 我不想使用像 openssl 或 MakeCert 這樣的外部可執行文件
                • 我不想使用 BouncyCastle
                • 我不想使用 Windows 證書注冊 API
                • 我不想使用本機 Win32 API 函數

                推薦答案

                簡答:你可以從 .NET Framework 4.7.2 開始.

                Short answer: You can starting in .NET Framework 4.7.2.

                此功能最初以 CertificateRequest 類,可以構建 PKCS#10 證書簽名請求或 X.509(自簽名或鏈式)公鑰證書.

                This functionality was originally added to .NET Core 2.0 in the form of the CertificateRequest class, which can build a PKCS#10 certification signing request or an X.509 (self-signed or chained) public key certificate.

                該功能的類在 .NET Framework 4.7.2 中可用.

                The classes for that feature were made available in .NET Framework 4.7.2.

                using (RSA parent = RSA.Create(4096))
                using (RSA rsa = RSA.Create(2048))
                {
                    CertificateRequest parentReq = new CertificateRequest(
                        "CN=Experimental Issuing Authority",
                        parent,
                        HashAlgorithmName.SHA256,
                        RSASignaturePadding.Pkcs1);
                
                    parentReq.CertificateExtensions.Add(
                        new X509BasicConstraintsExtension(true, false, 0, true));
                
                    parentReq.CertificateExtensions.Add(
                        new X509SubjectKeyIdentifierExtension(parentReq.PublicKey, false));
                
                    using (X509Certificate2 parentCert = parentReq.CreateSelfSigned(
                        DateTimeOffset.UtcNow.AddDays(-45),
                        DateTimeOffset.UtcNow.AddDays(365)))
                    {
                        CertificateRequest req = new CertificateRequest(
                            "CN=Valid-Looking Timestamp Authority",
                            rsa,
                            HashAlgorithmName.SHA256,
                            RSASignaturePadding.Pkcs1);
                
                        req.CertificateExtensions.Add(
                            new X509BasicConstraintsExtension(false, false, 0, false));
                
                        req.CertificateExtensions.Add(
                            new X509KeyUsageExtension(
                                X509KeyUsageFlags.DigitalSignature | X509KeyUsageFlags.NonRepudiation,
                                false));
                
                        req.CertificateExtensions.Add(
                            new X509EnhancedKeyUsageExtension(
                                new OidCollection
                                {
                                    new Oid("1.3.6.1.5.5.7.3.8")
                                },
                                true));
                
                        req.CertificateExtensions.Add(
                            new X509SubjectKeyIdentifierExtension(req.PublicKey, false));
                
                        using (X509Certificate2 cert = req.Create(
                            parentCert,
                            DateTimeOffset.UtcNow.AddDays(-1),
                            DateTimeOffset.UtcNow.AddDays(90),
                            new byte[] { 1, 2, 3, 4 }))
                        {
                            // Do something with these certs, like export them to PFX,
                            // or add them to an X509Store, or whatever.
                        }
                    }
                }
                

                如果您卡在舊版本上,答案更長:要在不添加任何新 P/Invokes 的情況下實現您的目標,您需要閱讀并理解以下文檔:

                Longer answer if you're stuck on older versions: To accomplish your goal without adding any new P/Invokes, you would need to read and understand the following documents:

                • ITU-T X.680-201508,ASN.1 語言
                • IETF RFC 5280 或 ITU-T X.509,解釋 X.509 證書中的字段的文檔.
                • IETF RFC 2986,解釋了 PKCS#10 認證簽名請求
                • ITU-T X.690,解釋了 ASN.1(包括 DER)的 BER 編碼系列,告訴您如何讀取和寫入字節以實現 X.509 的語義含義/PKCS#10.
                • ITU-T X.680-201508, the ASN.1 language
                • IETF RFC 5280 or ITU-T X.509, the documents that explain the fields in X.509 certificates.
                • IETF RFC 2986, explains the PKCS#10 certification signing request
                • ITU-T X.690, explains the BER encoding family for ASN.1 (including DER) which tells you how to read and write bytes to achieve the semantic meaning from X.509 / PKCS#10.

                然后您可以編寫一個 DER 寫入器/讀取器,然后只發出您想要的字節.

                And then you could write a DER writer/reader, and just emit the bytes for what you want.

                這篇關于使用純 .net 框架生成和簽署證書請求的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                What are good algorithms for vehicle license plate detection?(車牌檢測有哪些好的算法?)
                onClick event for Image in Unity(Unity中圖像的onClick事件)
                Running Total C#(運行總 C#)
                Deleting a directory when clicked on a hyperlink with JAvascript.ASP.NET C#(單擊帶有 JAvascript.ASP.NET C# 的超鏈接時刪除目錄)
                asp.net listview highlight row on click(asp.net listview 在單擊時突出顯示行)
                Calling A Button OnClick from a function(從函數調用按鈕 OnClick)
                <tfoot id='hw5EZ'></tfoot>
                <i id='hw5EZ'><tr id='hw5EZ'><dt id='hw5EZ'><q id='hw5EZ'><span id='hw5EZ'><b id='hw5EZ'><form id='hw5EZ'><ins id='hw5EZ'></ins><ul id='hw5EZ'></ul><sub id='hw5EZ'></sub></form><legend id='hw5EZ'></legend><bdo id='hw5EZ'><pre id='hw5EZ'><center id='hw5EZ'></center></pre></bdo></b><th id='hw5EZ'></th></span></q></dt></tr></i><div class="aw2cqsu" id='hw5EZ'><tfoot id='hw5EZ'></tfoot><dl id='hw5EZ'><fieldset id='hw5EZ'></fieldset></dl></div>

                <small id='hw5EZ'></small><noframes id='hw5EZ'>

                • <bdo id='hw5EZ'></bdo><ul id='hw5EZ'></ul>
                  <legend id='hw5EZ'><style id='hw5EZ'><dir id='hw5EZ'><q id='hw5EZ'></q></dir></style></legend>

                        <tbody id='hw5EZ'></tbody>

                          主站蜘蛛池模板: 拉力机-万能试验机-材料拉伸试验机-电子拉力机-拉力试验机厂家-冲击试验机-苏州皖仪实验仪器有限公司 | 没斑啦-专业的祛斑美白嫩肤知识网站-去斑经验分享 | 馋嘴餐饮网_餐饮加盟店火爆好项目_餐饮连锁品牌加盟指南创业平台 | 净化车间装修_合肥厂房无尘室设计_合肥工厂洁净工程装修公司-安徽盛世和居装饰 | 手持式线材张力计-套帽式风量罩-深圳市欧亚精密仪器有限公司 | 曙光腾达官网-天津脚手架租赁-木板架出租-移动门式脚手架租赁「免费搭设」 | 防火门-专业生产甲级不锈钢钢质防火门厂家资质齐全-广东恒磊安防设备有限公司 | 可程式恒温恒湿试验箱|恒温恒湿箱|恒温恒湿试验箱|恒温恒湿老化试验箱|高低温试验箱价格报价-广东德瑞检测设备有限公司 | 温控器生产厂家-提供温度开关/热保护器定制与批发-惠州市华恺威电子科技有限公司 | 葡萄酒灌装机-食用油灌装机-液体肥灌装设备厂家_青州惠联灌装机械 | 工程管道/塑料管材/pvc排水管/ppr给水管/pe双壁波纹管等品牌管材批发厂家-河南洁尔康建材 | 政府回应:200块在义乌小巷能买到爱情吗?——揭秘打工族省钱约会的生存智慧 | 智能终端_RTU_dcm_北斗星空自动化科技| 莱州网络公司|莱州网站建设|莱州网站优化|莱州阿里巴巴-莱州唯佳网络科技有限公司 | 杜康白酒加盟_杜康酒代理_杜康酒招商加盟官网_杜康酒厂加盟总代理—杜康酒神全国运营中心 | 贴片电感_贴片功率电感_贴片绕线电感_深圳市百斯特电子有限公司 贴片电容代理-三星电容-村田电容-风华电容-国巨电容-深圳市昂洋科技有限公司 | 温州食堂承包 - 温州市尚膳餐饮管理有限公司 | 东莞螺杆空压机_永磁变频空压机_节能空压机_空压机工厂批发_深圳螺杆空压机_广州螺杆空压机_东莞空压机_空压机批发_东莞空压机工厂批发_东莞市文颖设备科技有限公司 | 扒渣机,铁水扒渣机,钢水扒渣机,铁水捞渣机,钢水捞渣机-烟台盛利达工程技术有限公司 | 石英砂矿石色选机_履带辣椒色选机_X光异物检测机-合肥幼狮光电科技 | 聚氨酯复合板保温板厂家_廊坊华宇创新科技有限公司 | 恒温恒湿试验箱厂家-高低温试验箱维修价格_东莞环仪仪器_东莞环仪仪器 | 本安接线盒-本安电路用接线盒-本安分线盒-矿用电话接线盒-JHH生产厂家-宁波龙亿电子科技有限公司 | 东莞精密模具加工,精密连接器模具零件,自動機零件,冶工具加工-益久精密 | 铁素体测量仪/检测仪/铁素体含量测试仪-苏州圣光仪器有限公司 | 深圳善跑体育产业集团有限公司_塑胶跑道_人造草坪_运动木地板 | 河南空气能热水器-洛阳空气能采暖-洛阳太阳能热水工程-洛阳润达高科空气能商行 | 中高频感应加热设备|高频淬火设备|超音频感应加热电源|不锈钢管光亮退火机|真空管烤消设备 - 郑州蓝硕工业炉设备有限公司 | 纸布|钩编布|钩针布|纸草布-莱州佳源工艺纸布厂 | 连续密炼机_双转子连续密炼机_连续式密炼机-南京永睿机械制造有限公司 | 大连海岛旅游网>>大连旅游,大连海岛游,旅游景点攻略,海岛旅游官网 | 礼堂椅厂家|佛山市艺典家具有限公司 | 全自动五线打端沾锡机,全自动裁线剥皮双头沾锡机,全自动尼龙扎带机-东莞市海文能机械设备有限公司 | 灰板纸、灰底白、硬纸板等纸品生产商-金泊纸业 | 免费网站网址收录网_海企优网站推荐平台 | 美名宝起名网-在线宝宝、公司、起名平台 | 塑料脸盆批发,塑料盆生产厂家,临沂塑料广告盆,临沂家用塑料盆-临沂市永顺塑业 | 微波消解仪器_智能微波消解仪报价_高压微波消解仪厂家_那艾 | HDPE土工膜,复合土工膜,防渗膜价格,土工膜厂家-山东新路通工程材料有限公司 | 点胶机_点胶阀_自动点胶机_智能点胶机_喷胶机_点胶机厂家【欧力克斯】 | 27PR跨境电商导航 | 专注外贸跨境电商 |