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

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

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

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

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

        將 Coldfusion 加密代碼轉換為 C#

        Converting Coldfusion encryption code to C#(將 Coldfusion 加密代碼轉換為 C#)
        <legend id='ohOgz'><style id='ohOgz'><dir id='ohOgz'><q id='ohOgz'></q></dir></style></legend>

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

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

            • <tfoot id='ohOgz'></tfoot>

                1. 本文介紹了將 Coldfusion 加密代碼轉換為 C#的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我有一個 Coldfusion 頁面,其中包含一段加密變量的代碼,如下所示:

                  I have a Coldfusion page that includes a section of code that encrypts a variable like this:

                  <cfset data64 = toBase64(key)>
                  <cfset encryptedID = encrypt(getUser.ID, data64, "BLOWFISH", "Base64")>
                  

                  我們正在將該站點移至基于 .NET 的 CMS,我需要將此頁面轉換為 C#,但遇到了麻煩.

                  We're moving the site to a .NET-based CMS, and I need to convert this page to C#, but I'm running into trouble.

                  我已成功將第一行轉換為:

                  I've successfully converted the first line to this:

                  byte[] keyBytes = System.Text.Encoding.UTF8.GetBytes(key);
                  string keyBase64 = System.Convert.ToBase64String(keyBytes);
                  

                  我還添加了在 https://defuse.ca/blowfish.htm,但我對如何將其與密鑰一起使用(以及我是否要使用 ECB、CBC 或 CTR)有點模糊.我也不確定在 Coldfusion 中使用 base64 編碼的模擬是什么......這是我目前正在嘗試的,它不會產生與原始代碼相同的結果:

                  I've also added the blowfish.cs class found at https://defuse.ca/blowfish.htm, but I'm a little fuzzy on how to use this with the key (and whether I want to be using ECB, CBC, or CTR). I'm also not sure what the analog is to using the base64 encoding in Coldfusion... this is what I'm currently trying, which is not producing the same results as the original code:

                  BlowFish b = new BlowFish(keyBase64);
                  byte[] idBytes = System.Text.Encoding.UTF8.GetBytes(thisUser["ID"].ToString());
                  byte[] idBytesEncrypted = b.Encrypt_ECB(idBytes);
                  string idBase64 = System.Convert.ToBase64String(idBytesEncrypted);
                  

                  我在一般加密方面沒有太多經驗,Coldfusion 代碼是在另一個沒有 C# 經驗的開發人員的幫助下設置的.任何建議將不勝感激.謝謝!

                  I don't have much experience with encryption in general, and the Coldfusion code was set up with the help of another developer who doesn't have C# experience. Any suggestions would be much appreciated. Thank you!

                  推薦答案

                  你可能想試試 BouncyCastle C#API.我為 POC 運行了一些測試,它似乎產生了與您的 CF 代碼相同的結果.

                  You might want to try the BouncyCastle C# API. I ran a few tests, for POC, and it seemed to produce the same results as your CF code.

                  需要記住的幾點:如果您閱讀 ColdFusion 中的強加密 它解釋了 ColdFusion 默認使用 ECB 模式和 PKCS5Padding.因此,當指定簡寫 Blowfish 時,您實際上是在說使用 Blowfish/ECB/PKCS5Padding.為了在 C#(或任何語言)中復制加密,您必須使用相同的設置.

                  A few things to keep in mind: If you read Strong Encryption in ColdFusion it explains that ColdFusion uses ECB mode and PKCS5Padding by default. So when specifying the shorthand Blowfish, you are actually saying use Blowfish/ECB/PKCS5Padding. In order to duplicate the encryption in C# (or any language), you must to use those same settings.

                  C# 端口的文檔似乎并不多,但據我所知,BlowfishEngine 默認為 ECB 模式.因此,如果將其包裝在 PaddedBufferedBlockCipher 中,則結果應該是 PKCS5 填充的.這應該會給您與您的 CF 代碼相同的結果:

                  There does not seem to be a lot of documentation for the C# port, but from what I can tell the BlowfishEngine defaults to ECB mode. So if you wrap it in a PaddedBufferedBlockCipher the result should be PKCS5 padded. That should give you the same result as your CF code:

                      byte[] inputBytes = System.Text.Encoding.UTF8.GetBytes(userIDString);
                      byte[] keyBytes = System.Convert.FromBase64String(keyInBase64);
                  
                      // initialize for ECB mode and PKCS5/PKCS7 padding
                      PaddedBufferedBlockCipher cipher = new PaddedBufferedBlockCipher(new BlowfishEngine());
                      KeyParameter param = new KeyParameter(keyBytes);
                      cipher.Init(true, param);
                  
                      // encrypt and encode as base64
                      byte[] encryptedBytes =  cipher.DoFinal(inputBytes);
                      string idBase64 = System.Convert.ToBase64String(encryptedBytes);
                  

                  注意:我不是加密專家,但會說不鼓勵使用ECB"模式.請參閱 wiki 了解原因.所以你應該認真考慮選擇不同的模式.

                  NB: I am not an expert on encryption, but will say that use of "ECB" mode is discouraged. See wiki for a good illustration of why. So you should seriously consider choosing a different mode.

                  這篇關于將 Coldfusion 加密代碼轉換為 C#的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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='Ux5KO'></small><noframes id='Ux5KO'>

                      <tbody id='Ux5KO'></tbody>

                      • <bdo id='Ux5KO'></bdo><ul id='Ux5KO'></ul>
                        <legend id='Ux5KO'><style id='Ux5KO'><dir id='Ux5KO'><q id='Ux5KO'></q></dir></style></legend>
                        • <tfoot id='Ux5KO'></tfoot>
                          • <i id='Ux5KO'><tr id='Ux5KO'><dt id='Ux5KO'><q id='Ux5KO'><span id='Ux5KO'><b id='Ux5KO'><form id='Ux5KO'><ins id='Ux5KO'></ins><ul id='Ux5KO'></ul><sub id='Ux5KO'></sub></form><legend id='Ux5KO'></legend><bdo id='Ux5KO'><pre id='Ux5KO'><center id='Ux5KO'></center></pre></bdo></b><th id='Ux5KO'></th></span></q></dt></tr></i><div class="y0wmmym" id='Ux5KO'><tfoot id='Ux5KO'></tfoot><dl id='Ux5KO'><fieldset id='Ux5KO'></fieldset></dl></div>
                          • 主站蜘蛛池模板: 包塑软管|金属软管|包塑金属软管-闵彬管业 | 恒温槽_恒温水槽_恒温水浴槽-上海方瑞仪器有限公司 | 政府园区专业委托招商平台_助力企业选址项目快速落地_东方龙商务集团 | 聚丙烯酰胺PAM-聚合氯化铝PAC-絮凝剂-河南博旭环保科技有限公司 巨野电机维修-水泵维修-巨野县飞宇机电维修有限公司 | 焊缝跟踪系统_激光位移传感器_激光焊缝跟踪传感器-创想智控 | 塑钢课桌椅、学生课桌椅、课桌椅厂家-学仕教育设备首页 | 专业甜品培训学校_广东糖水培训_奶茶培训_特色小吃培训_广州烘趣甜品培训机构 | 真空乳化机-灌装封尾机-首页-温州精灌 | 房屋质量检测-厂房抗震鉴定-玻璃幕墙检测-房屋安全鉴定机构 | 巨野电机维修-水泵维修-巨野县飞宇机电维修有限公司 | 防水接头-电缆防水接头-金属-电缆密封接头-不锈钢电缆接头 | 成都顶呱呱信息技术有限公司-贷款_个人贷款_银行贷款在线申请 - 成都贷款公司 | 半容积式换热器_北京浮动盘管换热器厂家|北京亿丰上达 | 贝朗斯动力商城(BRCPOWER.COM) - 买叉车蓄电池上贝朗斯商城,价格更超值,品质有保障! | 南汇8424西瓜_南汇玉菇甜瓜-南汇水蜜桃价格 | 科威信洗净科技,碳氢清洗机,超声波清洗机,真空碳氢清洗机 | 天津市能谱科技有限公司-专业的红外光谱仪_红外测油仪_紫外测油仪_红外制样附件_傅里叶红外光谱技术生产服务厂商 | 除甲醛公司-甲醛检测治理-杭州创绿家环保科技有限公司-室内空气净化十大品牌 | 杭州翻译公司_驾照翻译_专业人工翻译-杭州以琳翻译有限公司官网 组织研磨机-高通量组织研磨仪-实验室多样品组织研磨机-东方天净 | 假肢-假肢价格-假肢厂家-河南假肢-郑州市力康假肢矫形器有限公司 | 锂电池生产厂家-电动自行车航模无人机锂电池定制-世豹新能源 | 深圳工程师职称评定条件及流程_深圳职称评审_职称评审-职称网 | 企小优-企业数字化转型服务商_网络推广_网络推广公司 | 气动绞车,山东气动绞车,气动绞车厂家-烟台博海石油机械有限公司 气动隔膜泵厂家-温州永嘉定远泵阀有限公司 | 济南展厅设计施工_数字化展厅策划设计施工公司_山东锐尚文化传播有限公司 | 今日扫码_溯源二维码_产品防伪一物一码_红包墙营销方案 | 5nd音乐网|最新流行歌曲|MP3歌曲免费下载|好听的歌|音乐下载 免费听mp3音乐 | 熔体泵_熔体出料泵_高温熔体泵-郑州海科熔体泵有限公司 | 开平机_纵剪机厂家_开平机生产厂家|诚信互赢-泰安瑞烨精工机械制造有限公司 | 小程序开发公司-小程序制作-微信小程序开发-小程序定制-咏熠软件 | 青海电动密集架_智能密集架_密集架价格-盛隆柜业青海档案密集架厂家 | 水环真空泵厂家,2bv真空泵,2be真空泵-淄博真空设备厂 | 碳纤维布-植筋胶-灌缝胶-固特嘉加固材料公司 | HDPE土工膜,复合土工膜,防渗膜价格,土工膜厂家-山东新路通工程材料有限公司 | 珠海白蚁防治_珠海灭鼠_珠海杀虫灭鼠_珠海灭蟑螂_珠海酒店消杀_珠海工厂杀虫灭鼠_立净虫控防治服务有限公司 | 球盟会·(中国)官方网站| 地磅-电子地磅维修-电子吊秤-汽车衡-无人值守系统-公路治超-鹰牌衡器 | 济南品牌设计-济南品牌策划-即合品牌策划设计-山东即合官网 | 大学食堂装修设计_公司餐厅效果图_工厂食堂改造_迈普装饰 | 航空障碍灯_高中低光强航空障碍灯_民航许可认证航空警示灯厂家-东莞市天翔航天科技有限公司 | 浙江红酒库-冰雕库-气调库-茶叶库安装-医药疫苗冷库-食品物流恒温恒湿车间-杭州领顺实业有限公司 |