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

  • <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="qwawimqqmiuu" id='nxTVU'><tfoot id='nxTVU'></tfoot><dl id='nxTVU'><fieldset id='nxTVU'></fieldset></dl></div>

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

        將 Coldfusion 加密代碼轉(zhuǎn)換為 C#

        Converting Coldfusion encryption code to C#(將 Coldfusion 加密代碼轉(zhuǎn)換為 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="qwawimqqmiuu" 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 加密代碼轉(zhuǎn)換為 C#的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  限時(shí)送ChatGPT賬號..

                  我有一個(gè) 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")>
                  

                  我們正在將該站點(diǎn)移至基于 .NET 的 CMS,我需要將此頁面轉(zhuǎn)換為 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.

                  我已成功將第一行轉(zhuǎn)換為:

                  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)有點(diǎn)模糊.我也不確定在 Coldfusion 中使用 base64 編碼的模擬是什么......這是我目前正在嘗試的,它不會(huì)產(chǎn)生與原始代碼相同的結(jié)果:

                  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);
                  

                  我在一般加密方面沒有太多經(jīng)驗(yàn),Coldfusion 代碼是在另一個(gè)沒有 C# 經(jīng)驗(yàn)的開發(fā)人員的幫助下設(shè)置的.任何建議將不勝感激.謝謝!

                  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 運(yùn)行了一些測試,它似乎產(chǎn)生了與您的 CF 代碼相同的結(jié)果.

                  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.

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

                  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# 端口的文檔似乎并不多,但據(jù)我所知,BlowfishEngine 默認(rèn)為 ECB 模式.因此,如果將其包裝在 PaddedBufferedBlockCipher 中,則結(jié)果應(yīng)該是 PKCS5 填充的.這應(yīng)該會(huì)給您與您的 CF 代碼相同的結(jié)果:

                  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);
                  

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

                  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.

                  這篇關(guān)于將 Coldfusion 加密代碼轉(zhuǎn)換為 C#的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  What are good algorithms for vehicle license plate detection?(車牌檢測有哪些好的算法?)
                  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)

                    <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="qwawimqqmiuu" id='Ux5KO'><tfoot id='Ux5KO'></tfoot><dl id='Ux5KO'><fieldset id='Ux5KO'></fieldset></dl></div>
                          • 主站蜘蛛池模板: 国产高清视频 | 欧美亚洲视频在线观看 | 国产精品自产拍 | 日韩在线精品强乱中文字幕 | 国内久久 | 污片在线免费观看 | 97精品国产97久久久久久免费 | 成人影院午夜 | 天天躁日日躁狠狠的躁天龙影院 | 国产免费让你躁在线视频 | 国产真实精品久久二三区 | 日本黄色片免费在线观看 | 一区二区三区免费 | 99久久精品国产麻豆演员表 | 狠狠艹 | 99在线视频观看 | 亚洲va国产日韩欧美精品色婷婷 | 精品网站999www | 日韩av在线一区二区三区 | 国产激情视频 | 另类 综合 日韩 欧美 亚洲 | 97精品国产 | 久久88| 涩涩视频在线看 | 国产三区视频在线观看 | 日韩欧美在线免费观看视频 | 亚洲最大看片网站 | 国产最新视频在线 | 久久久国产一区二区三区四区小说 | 国产网站在线免费观看 | 97天天干| 亚洲97 | 午夜视频网站 | 99热精品在线| 精品三级在线观看 | 青春草国产 | 激情欧美一区二区三区中文字幕 | 国产欧美日韩在线一区 | 精品久久一区 | 日韩精品一区二区三区 | 国产成人免费 |