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

<tfoot id='LBvpZ'></tfoot>
    • <bdo id='LBvpZ'></bdo><ul id='LBvpZ'></ul>

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

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

      2. <legend id='LBvpZ'><style id='LBvpZ'><dir id='LBvpZ'><q id='LBvpZ'></q></dir></style></legend>

      3. 如何在 C# 中使用 RSA 加密文件(大數(shù)據(jù))

        how to use RSA to encrypt files (huge data) in C#(如何在 C# 中使用 RSA 加密文件(大數(shù)據(jù)))
            <tbody id='SuXKH'></tbody>

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

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

          <tfoot id='SuXKH'></tfoot>

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

                  <bdo id='SuXKH'></bdo><ul id='SuXKH'></ul>
                  本文介紹了如何在 C# 中使用 RSA 加密文件(大數(shù)據(jù))的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  限時(shí)送ChatGPT賬號(hào)..

                  我是加密新手.我需要實(shí)現(xiàn)非對(duì)稱加密算法,我認(rèn)為它使用私鑰/公鑰.我開始使用 RSACryptoServiceProvider 的示例.可以加密小數(shù)據(jù).但是當(dāng)在相對(duì)較大的數(shù)據(jù)2行"上使用它時(shí),我得到異常 CryptographicException Bad Length"!

                  I'm new to encryption. I need to implement asymmetric encryption algorithm, which i think it uses private/public key. I started using a sample of RSACryptoServiceProvider. it was ok with small data to encrypt. But when using it on relatively larger data "2 lines", i get the exception CryptographicException "Bad Length"!

                  //Create a new instance of RSACryptoServiceProvider.
                  using (RSACryptoServiceProvider RSA = new RSACryptoServiceProvider())
                  {
                  
                      //Import the RSA Key information. This only needs
                      //toinclude the public key information.
                      //RSA.ImportParameters(RSAKeyInfo);
                      byte[] keyValue = Convert.FromBase64String(publicKey);
                      RSA.ImportCspBlob(keyValue);
                  
                      //Encrypt the passed byte array and specify OAEP padding.  
                      //OAEP padding is only available on Microsoft Windows XP or
                      //later.  
                      encryptedData = RSA.Encrypt(DataToEncrypt, DoOAEPPadding);
                  }
                  

                  然后我發(fā)現(xiàn)了一些使用 CryptoStream 加密大數(shù)據(jù)(或文件)的示例,并且僅使用 DES 或 3DES 等對(duì)稱算法,這些算法具有 CreateEncryptor 函數(shù)以返回 ICryptoTransform 作為 CryptoStream 構(gòu)造函數(shù)的輸入之一!!!

                  Then I found some samples of encrypting large data (or files) by using CryptoStream, and only use symmetric algorithms like DES or 3DES, which have the function CreateEncryptor to return ICryptoTransform as one of the input to the constructor of CryptoStream!!!

                  CryptoStream cStream = new CryptoStream(fStream,
                                  new TripleDESCryptoServiceProvider().CreateEncryptor(Key, IV),
                                  CryptoStreamMode.Write);
                  

                  使用 RSA 加密文件的方法是什么?

                  What is the way to encrypt files using RSA?

                  推薦答案

                  正如其他答案中提到的,非對(duì)稱加密僅用于加密小于其密鑰大小的數(shù)據(jù).

                  As mentioned in other answers asymmetric encryption is only designed for encrypting data smaller than its key size.

                  當(dāng)需要在兩個(gè)系統(tǒng)之間傳輸大量加密數(shù)據(jù)時(shí),我實(shí)現(xiàn)的一個(gè)選項(xiàng)是擁有一個(gè) RSA 密鑰對(duì),其公鑰對(duì)于發(fā)送方和接收方都是已知的,然后當(dāng)需要發(fā)送數(shù)據(jù)時(shí),接收方會(huì)生成一個(gè)新的 RSA 密鑰對(duì),使用公共公鑰加密該密鑰對(duì)的公鑰,并將加密的公鑰發(fā)送給發(fā)送者.發(fā)送方使用自己的私鑰解密接收方的公鑰(接收方不需要知道,就像發(fā)送方不需要知道接收方生成的私鑰一樣),生成對(duì)稱加密密鑰,用對(duì)稱密鑰加密數(shù)據(jù)然后使用從接收方收到的公鑰加密對(duì)稱密鑰.然后將加密的對(duì)稱密鑰和加密的數(shù)據(jù)發(fā)送給接收方,接收方使用其生成的私鑰解密對(duì)稱密鑰,然后解密數(shù)據(jù).

                  One option that I have implemented when needing to transfer large amounts of encrypted data between two systems is to have an RSA keypair whose public key is known to both the sender and the receiver then when data needs to be sent the receiver generates a new RSA keypair, encrypts the public key of that keypair with the common public key and sends the encrypted public key to the sender. The sender decrypts the receivers public key using its private key (which the receiver does not need to know, just as the sender does not need to know the receivers generated private key), generates a symmetric encryption key, encrypts the data with the symmetric key and then encrypts the symmetric key using the public key received from the receiver. Both the encrypted symmetric key and the encrypted data are then sent to the receiver which uses its generated private key to decrypt the symmetric key and then decrypts the data.

                  您可以使用 RSACryptoServiceProvider.ToXMLString()RSACryptoServiceProvider.FromXMLString() 方法將公共公鑰作為 XML 字符串文字存儲(chǔ)在接收方應(yīng)用程序中.

                  You can use the RSACryptoServiceProvider.ToXMLString() and RSACryptoServiceProvider.FromXMLString() methods to store the common public key as an XML string literal in the receiver application.

                  不要忘記,當(dāng)您生成對(duì)稱加密密鑰時(shí),要使用 RNGCryptoServiceProvider() 來生成密鑰,因?yàn)樗且环N更安全的生成(偽)隨機(jī)數(shù)的方法.

                  Don't forget, when you generate the symmetric encryption key to use RNGCryptoServiceProvider() to generate the key as it is a much more secure method of generating (pseudo) random numbers.

                  另外,我強(qiáng)烈建議不要使用 3DES 作為對(duì)稱加密算法,它已經(jīng)過時(shí)并且開始顯示其年齡.對(duì) AesCryptoServiceProvicerRijndaelManaged 類使用 AES 對(duì)稱加密.

                  Also, I strongly recommend against using 3DES as your symmetric encryption algorithm, it is old and starting to show its age. Use AES symmetric encryption with either the AesCryptoServiceProvicer or RijndaelManaged classes.

                  這篇關(guān)于如何在 C# 中使用 RSA 加密文件(大數(shù)據(jù))的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  What are good algorithms for vehicle license plate detection?(車牌檢測(cè)有哪些好的算法?)
                  onClick event for Image in Unity(Unity中圖像的onClick事件)
                  Running Total C#(運(yùn)行總 C#)
                  Deleting a directory when clicked on a hyperlink with JAvascript.ASP.NET C#(單擊帶有 JAvascript.ASP.NET C# 的超鏈接時(shí)刪除目錄)
                  asp.net listview highlight row on click(asp.net listview 在單擊時(shí)突出顯示行)
                  Calling A Button OnClick from a function(從函數(shù)調(diào)用按鈕 OnClick)
                    <tbody id='ITVhy'></tbody>

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

                  • <small id='ITVhy'></small><noframes id='ITVhy'>

                    1. <legend id='ITVhy'><style id='ITVhy'><dir id='ITVhy'><q id='ITVhy'></q></dir></style></legend>
                    2. <tfoot id='ITVhy'></tfoot>

                        <bdo id='ITVhy'></bdo><ul id='ITVhy'></ul>
                            主站蜘蛛池模板: 一区二区三区四区av | av成人在线观看 | 九一视频在线观看 | 国产精品日韩在线 | 91视频.| 久久精品久久久久久 | 一区中文字幕 | 国产视频久久久 | 免费观看一区二区三区毛片 | 久久久亚洲 | 天堂综合网 | 亚洲视频三区 | 91一区| 亚洲精品2| 99国产精品久久久 | 国产成人久久久 | 日韩在线中文字幕 | 亚洲成人一区 | 国产成人网 | 欧美日韩国产一区 | 久久久91精品国产一区二区三区 | 欧美日韩第一页 | 成人啊啊啊 | 欧美成人免费在线视频 | 国产免费色 | 国产我和子的乱视频网站 | 99免费看 | 日韩欧美一区二区三区免费观看 | 综合一区二区三区 | 国产美女在线观看 | 国产高清一区二区三区 | 视频一区中文字幕 | 国产精品a级 | 999久久久久久久久6666 | 欧美一区二区大片 | 欧美性猛片aaaaaaa做受 | 国产在线1 | 在线观看av网站永久 | 国内精品视频免费观看 | 亚洲韩国精品 | 亚洲综合婷婷 |