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

    <small id='5pvU7'></small><noframes id='5pvU7'>

    <tfoot id='5pvU7'></tfoot>
      <bdo id='5pvU7'></bdo><ul id='5pvU7'></ul>

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

        <legend id='5pvU7'><style id='5pvU7'><dir id='5pvU7'><q id='5pvU7'></q></dir></style></legend>
      1. 為什么我需要使用 Rfc2898DeriveBytes 類(在 .NET 中)而

        Why do I need to use the Rfc2898DeriveBytes class (in .NET) instead of directly using the password as a key or IV?(為什么我需要使用 Rfc2898DeriveBytes 類(在 .NET 中)而不是直接使用密碼作為密鑰或 IV?) - IT屋-程序員軟
          <bdo id='YQbwD'></bdo><ul id='YQbwD'></ul>

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

              <tbody id='YQbwD'></tbody>
            <tfoot id='YQbwD'></tfoot>
            <legend id='YQbwD'><style id='YQbwD'><dir id='YQbwD'><q id='YQbwD'></q></dir></style></legend>

                  本文介紹了為什么我需要使用 Rfc2898DeriveBytes 類(在 .NET 中)而不是直接使用密碼作為密鑰或 IV?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  限時送ChatGPT賬號..

                  使用 Rfc2898DeriveBytes 和只使用 Encoding.ASCII.GetBytes(string object); 有什么區(qū)別?

                  What is the difference between using Rfc2898DeriveBytes and just using Encoding.ASCII.GetBytes(string object);?

                  我在這兩種方法上都取得了相對的成功,前者是一種更冗長的方法,而后者則簡單明了.兩者似乎都允許你最終做同樣的事情,但我很難看出使用前者而不是后者的意義.

                  I have had relative success with either approach, the former is a more long winded approach where as the latter is simple and to the point. Both seem to allow you to do the same thing eventually but I am struggling to the see the point in using the former over the latter.

                  我能掌握的基本概念是可以將字符串密碼轉(zhuǎn)換成要用于例如對稱加密類 AesManaged 的字節(jié)數(shù)組.通過 RFC 類,但您可以在創(chuàng)建 rfc 對象時使用鹽值和密碼.我認(rèn)為它更安全,但充其量仍然是一個沒有受過教育的猜測!此外,它還允許您返回一定大小的字節(jié)數(shù)組,以及類似的東西.

                  The basic concept I have been able to grasp is that you can convert string passwords into byte arrays to be used for e.g a symmetric encryption class, AesManaged. Via the RFC class but you get to use salt values and password when creating your rfc object. I assume its more secure but still thats an uneducated guess at best! Also that it allows you to return byte arrays of a certain size, well something like that.

                  這里有幾個例子告訴你我來自哪里:

                  Here are a few examples to show you where I am coming from:

                  byte[] myPassinBytes = Encoding.ASCII.GetBytes("some password");
                  

                  string password = "P@%5w0r]>";
                  byte[] saltArray = Encoding.ASCII.GetBytes("this is my salt");
                  Rfc2898DeriveBytes rfcKey = new Rfc2898DeriveBytes(password, saltArray);
                  

                  rfcKey"對象現(xiàn)在可用于設(shè)置 .Key 或 .IV 屬性關(guān)于對稱加密算法類.

                  The 'rfcKey' object can now be used towards setting up the the .Key or .IV properties on a symmetric encryption algorithm class.

                  即.

                  RijndaelManaged rj = new RijndaelManaged ();
                  rj.Key = rfcKey.Getbytes(rj.KeySize / 8); 
                  rj.IV = rfcKey.Getbytes(rj.Blocksize / 8);
                  

                  'rj' 應(yīng)該準(zhǔn)備好了!

                  'rj' should be ready to go !

                  令人困惑的部分......所以我可以不只使用我的rfcKey"對象嗎?'myPassInBytes' 數(shù)組來幫助設(shè)置我的 'rj' 對象?

                  The confusing part ... so rather than using the 'rfcKey' object can I not just use my 'myPassInBytes' array to help set-up my 'rj' object?

                  我曾嘗試在 VS2008 中執(zhí)行此操作,但立即回答是否定的.但是對于為什么使用 RFC 類而不是我上面提到的其他替代方案,你們有更好的回答嗎?

                  I have tried doing this in VS2008 and the immediate answer is NO. But have you guys got a better educated answer as to why the RFC class is used over the other alternative I have mentioned above?

                  推薦答案

                  你真的,真的不想直接使用用戶密碼作為加密密鑰,尤其是使用 AES.

                  You really, really do not want to use a user password directly as a crypto key, especially with AES.

                  Rfc2898DeriveBytes 是 PBKDF2 的實現(xiàn).它的作用是反復(fù)對用戶密碼和鹽進行哈希處理.這有很多好處:

                  Rfc2898DeriveBytes is an implementation of PBKDF2. What it does is repeatedly hash the user password along with the salt. This has multiple benefits:

                  首先,您可以使用任意大小的密碼 - AES 僅支持特定的密鑰大小.

                  Firstly, you can use arbitrarily sized passwords - AES only supports specific key sizes.

                  其次,添加鹽意味著您可以使用相同的密碼來生成多個不同的密鑰(假設(shè)鹽不是常數(shù),就像在您的示例中那樣).這對于密鑰分離很重要;在不同的上下文中重復(fù)使用密鑰是密碼系統(tǒng)被破壞的最常見方式之一.

                  Secondly, the addition of the salt means that you can use the same passphrase to generate multiple different keys (assuming the salt is not a constant, as it is in your example). This is important for key separation; reusing keys in different contexts is one of the most common ways cryptographic systems are broken.

                  多次迭代(默認(rèn)為 1000 次)減緩密碼猜測攻擊.考慮有人試圖猜測您的 AES 密鑰.如果您只是使用密碼,這將很簡單 - 只需嘗試每個可能的密碼作為密鑰.另一方面,對于 PBKDF2,攻擊者首先必須為 each 密碼猜測執(zhí)行 1000 次哈希迭代.因此,雖然它只會稍微減慢用戶的速度,但它對攻擊者的影響卻不成比例.(事實上??,使用更高的迭代次數(shù)是很常見的;通常建議使用 10000).

                  The multiple iterations (1000 by default) slow down password guessing attacks. Consider someone who is trying to guess your AES key. If you just used the password, this would be straightforward - just try each possible password as the key. On the other hand, with PBKDF2, the attacker first has to perform 1000 hash iterations for each password guess. So while it slows down a user only slightly, it has a disproportionate effect on an attacker. (In fact it's quite common to use much higher iteration counts; 10000 is commonly recommended).

                  這也意味著最終的輸出密鑰是均勻分布的.例如,如果您使用密碼,通常 128 位密鑰中的 16 位將為 0(高 ASCII 位).就在那里,即使忽略密碼猜測,keysearch 也會比它應(yīng)該的容易 65536 倍.

                  It also means the final output key is uniformly distributed. If you used the password, for instance, typically 16 out of 128 bits of the key would be 0 (the high ASCII bit). That right there immediately makes keysearch 65536 times easier than it should be, even ignoring the password guessing.

                  最后,AES 具有與相關(guān)密鑰攻擊相關(guān)的特定漏洞.當(dāng)攻擊者知道一些用多個密鑰加密的數(shù)據(jù),并且它們之間存在某種已知(或猜測)的關(guān)系時,相關(guān)密鑰攻擊是可能的.例如,如果您使用我的 AES 密鑰很爛"(對于 AES-128 為 16 個字節(jié))和我的 AES 密鑰很爛"的密碼密鑰加密數(shù)據(jù),則可能會發(fā)生相關(guān)的密鑰攻擊.目前最知名的攻擊實際上不允許以這種方式破壞完整的 AES,但隨著時間的推移,它們已經(jīng)逐漸變得更好 - 就在上周發(fā)布了一種新的攻擊,它使用 AES-256 破壞了 13 輪(總共 14 輪)相關(guān)的密鑰攻擊.依靠這種攻擊不會隨著時間的推移變得更好是非常不明智的.

                  Finally, AES has specific vulnerabilities with related key attacks. Related key attacks are possible when an attacker knows some data encrypted with several keys, and there is some known (or guessed) relation between them. For instance, if you encrypted data with both a password-key of "My AES key sucks" (16 bytes, for AES-128) and with "MY AES KEY SUCKS", a related key attack might be possible. The currently best known attacks do not actually allow breaking the full AES in this way, but they have been getting progressively better over time - just last week a new attack was published that breaks 13 rounds (out of 14 total) of AES-256 using a related key attack. It would be profoundly unwise to rely on such attacks not getting better over time.

                  這篇關(guān)于為什么我需要使用 Rfc2898DeriveBytes 類(在 .NET 中)而不是直接使用密碼作為密鑰或 IV?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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#(運行總 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(從函數(shù)調(diào)用按鈕 OnClick)
                        <i id='IQtX4'><tr id='IQtX4'><dt id='IQtX4'><q id='IQtX4'><span id='IQtX4'><b id='IQtX4'><form id='IQtX4'><ins id='IQtX4'></ins><ul id='IQtX4'></ul><sub id='IQtX4'></sub></form><legend id='IQtX4'></legend><bdo id='IQtX4'><pre id='IQtX4'><center id='IQtX4'></center></pre></bdo></b><th id='IQtX4'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='IQtX4'><tfoot id='IQtX4'></tfoot><dl id='IQtX4'><fieldset id='IQtX4'></fieldset></dl></div>
                        • <bdo id='IQtX4'></bdo><ul id='IQtX4'></ul>
                            <tbody id='IQtX4'></tbody>

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

                          <legend id='IQtX4'><style id='IQtX4'><dir id='IQtX4'><q id='IQtX4'></q></dir></style></legend>

                          <tfoot id='IQtX4'></tfoot>
                          • 主站蜘蛛池模板: 国产成人高清 | 中文字幕在线二区 | 免费毛片网站在线观看 | 日韩三级在线 | 夜色www国产精品资源站 | 久久成人人人人精品欧 | 亚洲 中文 欧美 日韩 在线观看 | www.亚洲.com| 欧美xxxx性xxxxx高清 | 亚洲免费一区 | 在线不卡一区 | 欧美极品在线观看 | 欧美精品一区二区三区蜜桃视频 | 午夜电影日韩 | 亚洲国产免费 | 日一区二区 | 一区二区三区四区日韩 | 亚洲成人网在线 | 麻豆国产一区二区三区四区 | 精品久久久久久久久久 | 国产一级在线视频 | 色综合网站 | 日韩av在线免费 | 天堂一区二区三区 | 中日韩av| 伊人国产精品 | 久草免费电影 | 中文字幕精品一区二区三区精品 | 91精品久久久久久久久 | 6080yy精品一区二区三区 | 日一区二区 | 日本一区二区三区免费观看 | 成人在线中文 | 国产一区二区精品 | 国产精品日韩欧美一区二区三区 | 一区二区三区四区不卡 | 中文字幕精品一区二区三区精品 | 天堂久久天堂综合色 | 一区二区中文字幕 | 午夜寂寞影院列表 | 亚洲综合区 |