久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<tfoot id='0nRob'></tfoot>
    1. <small id='0nRob'></small><noframes id='0nRob'>

        <bdo id='0nRob'></bdo><ul id='0nRob'></ul>

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

      1. RSACryptoServiceProvider(.NET 的 RSA)可以使用 SHA256 進行

        Can RSACryptoServiceProvider (.NET#39;s RSA) use SHA256 for encryption (not signing) instead of SHA1?(RSACryptoServiceProvider(.NET 的 RSA)可以使用 SHA256 進行加密(不是簽名)而不是 SHA1 嗎?) - IT屋-程序員軟件開發技術分

              <bdo id='bJE8N'></bdo><ul id='bJE8N'></ul>

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

                  <tbody id='bJE8N'></tbody>
                <i id='bJE8N'><tr id='bJE8N'><dt id='bJE8N'><q id='bJE8N'><span id='bJE8N'><b id='bJE8N'><form id='bJE8N'><ins id='bJE8N'></ins><ul id='bJE8N'></ul><sub id='bJE8N'></sub></form><legend id='bJE8N'></legend><bdo id='bJE8N'><pre id='bJE8N'><center id='bJE8N'></center></pre></bdo></b><th id='bJE8N'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='bJE8N'><tfoot id='bJE8N'></tfoot><dl id='bJE8N'><fieldset id='bJE8N'></fieldset></dl></div>
              1. <legend id='bJE8N'><style id='bJE8N'><dir id='bJE8N'><q id='bJE8N'></q></dir></style></legend>
              2. <tfoot id='bJE8N'></tfoot>

                  本文介紹了RSACryptoServiceProvider(.NET 的 RSA)可以使用 SHA256 進行加密(不是簽名)而不是 SHA1 嗎?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  加密時,RSACryptoServiceProvider(或 .NET 提供的任何其他 RSA 加密器)是否可以使用 SHA256 而不是 SHA1?

                  When encrypting, can RSACryptoServiceProvider (or any other RSA encryptor available from .NET) use SHA256 instead of SHA1?

                  SHA1 似乎是硬編碼的,無法更改.例如,RSACryptoServiceProvider.SignatureAlgorithm 被硬編碼為返回http://www.w3.org/2000/09/xmldsig#rsa-sha1".

                  SHA1 appears to be hard coded with no way to change it. For example, RSACryptoServiceProvider.SignatureAlgorithm is hard coded to return "http://www.w3.org/2000/09/xmldsig#rsa-sha1".

                  如果沒有辦法讓 RSACryptoServiceProvider 使用 SHA256,有哪些替代方案?

                  If there is no way to make RSACryptoServiceProvider use SHA256, what are the alternatives?

                  更新

                  以下代碼完美運行,但我想將 OAEPWithSHA1AndMGF1Padding 更改為 OAEPWithSHA256AndMGF1Padding.C# 端需要什么才能使用 SHA256 而不是 SHA1 進行加密?

                  The following code works perfectly, but I'd like to change the OAEPWithSHA1AndMGF1Padding to OAEPWithSHA256AndMGF1Padding. What is required on the C# side to be able to encrypt using SHA256 rather than SHA1?

                  加密在 C# 中使用:

                  The encryption is done in C# using:

                  var parameters = new RSAParameters();
                  parameters.Exponent = new byte[] {0x01, 0x00, 0x01};
                  parameters.Modulus = new byte[] {0x9d, 0xc1, 0xcc, ...};
                  rsa.ImportParameters(parameters);
                  
                  var cipherText = rsa.Encrypt(new byte[] { 0, 1, 2, 3 }, true);
                  

                  解密是在 Java 中使用:

                  The decryption is done in Java using:

                  Cipher cipher = Cipher.getInstance("RSA/NONE/OAEPWithSHA1AndMGF1Padding", "BC");
                  cipher.init(Cipher.DECRYPT_MODE, keyPair.getPrivate());
                  byte[] cipherText = ...;
                  byte[] plainText = cipher.doFinal(cipherText);
                  

                  推薦答案

                  RSACryptoServiceProvider 確實可以使用基于 SHA2 的簽名,但您必須投入一些精力.

                  RSACryptoServiceProvider does work with SHA2-based signatures, but you have to invest some effort into it.

                  當您使用證書獲取 RSACryptoServiceProvider 時,底層 CryptoAPI 提供程序是什么真的很重要.默認情況下,當您使用makecert"創建證書時,它是RSA-FULL",它僅支持 SHA1 哈希進行簽名.您需要支持 SHA2 的新RSA-AES".

                  When you use a certificate to get your RSACryptoServiceProvider it really matters what's the underlying CryptoAPI provider. By default, when you create a certificate with 'makecert', it's "RSA-FULL" which only supports SHA1 hashes for signature. You need the new "RSA-AES" one that supports SHA2.

                  因此,您可以使用附加選項創建證書:-sp "Microsoft Enhanced RSA and AES Cryptographic Provider"(或等效的 -sy 24),然后您的代碼將如下所示(在 .NET 4.0 中):

                  So, you can create your certificate with an additional option: -sp "Microsoft Enhanced RSA and AES Cryptographic Provider" (or an equivalent -sy 24) and then your code would look like (in .NET 4.0):

                  var rsa = signerCertificate.PrivateKey as RSACryptoServiceProvider;
                  //
                  byte[] signature = rsa.SignData(data, CryptoConfig.CreateFromName("SHA256"));
                  

                  如果您無法更改頒發證書的方式,則有一個半合法的解決方法,該解決方法基于默認情況下創建 RSACryptoServiceProvider 并支持 SHA2.因此,下面的代碼也可以工作,但它有點丑:(這段代碼的作用是創建一個新的 RSACryptoServiceProvider 并從我們從證書中獲得的密鑰中導入密鑰)

                  If you are unable to change the way your certificate is issued, there is a semi-ligitimate workaround that is based on the fact that by default RSACryptoServiceProvider is created with support for SHA2. So, the following code would also work, but it is a bit uglier: (what this code does is it creates a new RSACryptoServiceProvider and imports the keys from the one we got from the certificate)

                  var rsa = signerCertificate.PrivateKey as RSACryptoServiceProvider;
                  // Create a new RSACryptoServiceProvider
                  RSACryptoServiceProvider rsaClear = new RSACryptoServiceProvider();
                  // Export RSA parameters from 'rsa' and import them into 'rsaClear'
                  rsaClear.ImportParameters(rsa.ExportParameters(true));
                  byte[] signature = rsaClear.SignData(data, CryptoConfig.CreateFromName("SHA256"));
                  

                  這篇關于RSACryptoServiceProvider(.NET 的 RSA)可以使用 SHA256 進行加密(不是簽名)而不是 SHA1 嗎?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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)
                  • <small id='tWVVC'></small><noframes id='tWVVC'>

                    <tfoot id='tWVVC'></tfoot>

                          <tbody id='tWVVC'></tbody>

                      • <legend id='tWVVC'><style id='tWVVC'><dir id='tWVVC'><q id='tWVVC'></q></dir></style></legend>
                        <i id='tWVVC'><tr id='tWVVC'><dt id='tWVVC'><q id='tWVVC'><span id='tWVVC'><b id='tWVVC'><form id='tWVVC'><ins id='tWVVC'></ins><ul id='tWVVC'></ul><sub id='tWVVC'></sub></form><legend id='tWVVC'></legend><bdo id='tWVVC'><pre id='tWVVC'><center id='tWVVC'></center></pre></bdo></b><th id='tWVVC'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='tWVVC'><tfoot id='tWVVC'></tfoot><dl id='tWVVC'><fieldset id='tWVVC'></fieldset></dl></div>
                          <bdo id='tWVVC'></bdo><ul id='tWVVC'></ul>

                            主站蜘蛛池模板: 在线观看黄色大片 | 久久成人精品 | 亚洲欧洲视频 | 国产一级特黄aaa大片评分 | 国产精品美女久久久久aⅴ国产馆 | .国产精品成人自产拍在线观看6 | 一级a性色生活片久久毛片波多野 | 51ⅴ精品国产91久久久久久 | 国产成人精品免费视频大全最热 | www,黄色,com | www.久久99 | av一区二区三区四区 | 欧美视频一区二区三区 | 91超碰在线 | 亚洲精品日韩综合观看成人91 | 欧美性生活网 | 精品亚洲一区二区三区 | 老头搡老女人毛片视频在线看 | 911精品国产| 色网站在线 | 国产精品久久久久久 | 久久最新 | 在线免费观看毛片 | 一区二区不卡 | 精品国产一二三区 | 中文字幕免费在线 | 国产成人精品久久二区二区91 | 亚洲欧美日韩在线不卡 | 日韩在线高清 | 正在播放国产精品 | 欧美综合一区 | 成年人在线观看 | 久久久91精品国产一区二区三区 | 亚洲狠狠爱 | 亚洲一区二区三区免费在线 | 国产精品视频免费观看 | 免费看黄视频网站 | 欧美中文一区 | 国产福利视频导航 | 午夜伦理影院 | 一级毛片视频在线 |