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

<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="w00oeia" 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 加密文件(大數據)

        how to use RSA to encrypt files (huge data) in C#(如何在 C# 中使用 RSA 加密文件(大數據))
            <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="ckkcesc" 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 加密文件(大數據)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我是加密新手.我需要實現非對稱加密算法,我認為它使用私鑰/公鑰.我開始使用 RSACryptoServiceProvider 的示例.可以加密小數據.但是當在相對較大的數據2行"上使用它時,我得到異常 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);
                  }
                  

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

                  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?

                  推薦答案

                  正如其他答案中提到的,非對稱加密僅用于加密小于其密鑰大小的數據.

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

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

                  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 字符串文字存儲在接收方應用程序中.

                  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.

                  不要忘記,當您生成對稱加密密鑰時,要使用 RNGCryptoServiceProvider() 來生成密鑰,因為它是一種更安全的生成(偽)隨機數的方法.

                  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.

                  另外,我強烈建議不要使用 3DES 作為對稱加密算法,它已經過時并且開始顯示其年齡.對 AesCryptoServiceProvicerRijndaelManaged 類使用 AES 對稱加密.

                  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.

                  這篇關于如何在 C# 中使用 RSA 加密文件(大數據)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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)
                    <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="g2mwmi0" 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>
                            主站蜘蛛池模板: 可程式恒温恒湿试验箱|恒温恒湿箱|恒温恒湿试验箱|恒温恒湿老化试验箱|高低温试验箱价格报价-广东德瑞检测设备有限公司 | 上海小程序开发-小程序制作-上海小程序定制开发公司-微信商城小程序-上海咏熠 | RTO换向阀_VOC高温阀门_加热炉切断阀_双偏心软密封蝶阀_煤气蝶阀_提升阀-湖北霍科德阀门有限公司 | 电表箱-浙江迈峰电力设备有限公司-电表箱专业制造商 | PCB厂|线路板厂|深圳线路板厂|软硬结合板厂|电路板生产厂家|线路板|深圳电路板厂家|铝基板厂家|深联电路-专业生产PCB研发制造 | 周易算网-八字测算网 - 周易算网-宝宝起名取名测名字周易八字测算网 | 郑州外墙清洗_郑州玻璃幕墙清洗_郑州开荒保洁-河南三恒清洗服务有限公司 | 西安展台设计搭建_西安活动策划公司_西安会议会场布置_西安展厅设计西安旭阳展览展示 | 昊宇水工|河北昊宇水工机械工程有限公司 | 烟雾净化器-滤筒除尘器-防爆除尘器-除尘器厂家-东莞执信环保科技有限公司 | 污水处理设备维修_污水处理工程改造_机械格栅_过滤设备_气浮设备_刮吸泥机_污泥浓缩罐_污水处理设备_污水处理工程-北京龙泉新禹科技有限公司 | 康明斯发电机,上柴柴油发电机,玉柴柴油发电机组_海南重康电力官网 | 暴风影音| 范秘书_懂你的范文小秘书| 拉力机-拉力试验机-万能试验机-电子拉力机-拉伸试验机-剥离强度试验机-苏州皖仪实验仪器有限公司 | 广州工业氧气-工业氩气-工业氮气-二氧化碳-广州市番禺区得力气体经营部 | 氟塑料磁力泵-不锈钢离心泵-耐腐蚀化工泵厂家「皖金泵阀」 | 便携式谷丙转氨酶检测仪|华图生物科技百科 | 铝合金重力铸造_铝合金翻砂铸造_铝铸件厂家-东莞市铝得旺五金制品有限公司 | 出国劳务公司_正规派遣公司[严海] | 陕西鹏展科技有限公司 | 广州办公室设计,办公室装修,写字楼设计,办公室装修公司_德科 | 400电话_400电话申请_866元/年_【400电话官方业务办理】-俏号网 3dmax渲染-效果图渲染-影视动画渲染-北京快渲科技有限公司 | 渗透仪-直剪仪-三轴仪|苏州昱创百科| 电机保护器-电动机综合保护器-上海硕吉电器有限公司 | 知网论文检测系统入口_论文查重免费查重_中国知网论文查询_学术不端检测系统 | 外贮压-柜式-悬挂式-七氟丙烷-灭火器-灭火系统-药剂-价格-厂家-IG541-混合气体-贮压-非贮压-超细干粉-自动-灭火装置-气体灭火设备-探火管灭火厂家-东莞汇建消防科技有限公司 | 曙光腾达官网-天津脚手架租赁-木板架出租-移动门式脚手架租赁「免费搭设」 | 螺纹三通快插接头-弯通快插接头-宁波舜驰气动科技有限公司 | 自清洗过滤器-全自动自清洗过反冲洗过滤器 - 中乂(北京)科技有限公司 | 色谱柱-淋洗液罐-巴罗克试剂槽-巴氏吸管-5ml样品瓶-SBS液氮冻存管-上海希言科学仪器有限公司 | 校服厂家,英伦校服定做工厂,园服生产定制厂商-东莞市艾咪天使校服 | 散热器-电子散热器-型材散热器-电源散热片-镇江新区宏图电子散热片厂家 | 聚氨酯保温钢管_聚氨酯直埋保温管道_聚氨酯发泡保温管厂家-沧州万荣防腐保温管道有限公司 | 标准件-非标紧固件-不锈钢螺栓-非标不锈钢螺丝-非标螺母厂家-三角牙锁紧自攻-南京宝宇标准件有限公司 | 智慧旅游_智慧景区_微景通-智慧旅游景区解决方案提供商 | led冷热冲击试验箱_LED高低温冲击试验箱_老化试验箱-爱佩百科 | atcc网站,sigma试剂价格,肿瘤细胞现货,人结肠癌细胞株购买-南京科佰生物 | 洗石机-移动滚筒式,振动,螺旋,洗矿机-青州冠诚重工机械有限公司 | 篮球架_乒乓球台_足球门_校园_竞技体育器材_厂家_价格-沧州浩然体育器材有限公司 | 真空粉体取样阀,电动楔式闸阀,电动针型阀-耐苛尔(上海)自动化仪表有限公司 |