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

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

        <bdo id='tKIjk'></bdo><ul id='tKIjk'></ul>
      <i id='tKIjk'><tr id='tKIjk'><dt id='tKIjk'><q id='tKIjk'><span id='tKIjk'><b id='tKIjk'><form id='tKIjk'><ins id='tKIjk'></ins><ul id='tKIjk'></ul><sub id='tKIjk'></sub></form><legend id='tKIjk'></legend><bdo id='tKIjk'><pre id='tKIjk'><center id='tKIjk'></center></pre></bdo></b><th id='tKIjk'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='tKIjk'><tfoot id='tKIjk'></tfoot><dl id='tKIjk'><fieldset id='tKIjk'></fieldset></dl></div>
      <legend id='tKIjk'><style id='tKIjk'><dir id='tKIjk'><q id='tKIjk'></q></dir></style></legend>
      <tfoot id='tKIjk'></tfoot>
    1. 填充無效,無法刪除?

      Padding is invalid and cannot be removed?(填充無效,無法刪除?)

              <tfoot id='3cfBP'></tfoot>

              <small id='3cfBP'></small><noframes id='3cfBP'>

              <i id='3cfBP'><tr id='3cfBP'><dt id='3cfBP'><q id='3cfBP'><span id='3cfBP'><b id='3cfBP'><form id='3cfBP'><ins id='3cfBP'></ins><ul id='3cfBP'></ul><sub id='3cfBP'></sub></form><legend id='3cfBP'></legend><bdo id='3cfBP'><pre id='3cfBP'><center id='3cfBP'></center></pre></bdo></b><th id='3cfBP'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='3cfBP'><tfoot id='3cfBP'></tfoot><dl id='3cfBP'><fieldset id='3cfBP'></fieldset></dl></div>
            • <legend id='3cfBP'><style id='3cfBP'><dir id='3cfBP'><q id='3cfBP'></q></dir></style></legend>
                <tbody id='3cfBP'></tbody>
              • <bdo id='3cfBP'></bdo><ul id='3cfBP'></ul>
                本文介紹了填充無效,無法刪除?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                限時送ChatGPT賬號..

                我已在網上查找此異常與我的程序相關的含義,但似乎找不到解決方案或我的特定程序發生此異常的原因.我一直在使用我的 msdn 提供的示例來使用 Rijndael 算法加密和解密 XmlDocument.加密工作正常,但當我嘗試解密時,出現以下異常:

                I have looked online for what this?exception means in relation to my?program?but can't seem to find a solution or the reason why it's happening to my specific program. I have been using the example provided my msdn for encrypting and decrypting an XmlDocument using the Rijndael algorithm. The encryption works fine but when I try to decrypt, I get the following exception:

                填充無效,無法移除

                誰能告訴我我能做些什么來解決這個問題?下面的代碼是我獲取密鑰和其他數據的地方.如果cryptoMode為false,就會調用decrypt方法,也就是異常發生的地方:

                Can anyone tell me what I can do to solve this issue? My code below is where I get the key and other data. If the cryptoMode is false, it will call the decrypt method, which is where the exception occurs:

                public void Cryptography(XmlDocument doc, bool cryptographyMode)
                {
                    RijndaelManaged key = null;
                    try
                    {
                    // Create a new Rijndael key.
                    key = new RijndaelManaged();
                    const string passwordBytes = "Password1234"; //password here 
                
                    byte[] saltBytes = Encoding.UTF8.GetBytes("SaltBytes");
                    Rfc2898DeriveBytes p = new Rfc2898DeriveBytes(passwordBytes, saltBytes);
                    // sizes are devided by 8 because [ 1 byte = 8 bits ] 
                    key.IV = p.GetBytes(key.BlockSize/8);
                    key.Key = p.GetBytes(key.KeySize/8);
                
                    if (cryptographyMode)
                    {
                        Ecrypt(doc, "Content", key);
                    }
                    else
                    {
                        Decrypt(doc, key);
                    }
                
                    }
                    catch (Exception ex)
                    {
                    MessageBox.Show(ex.Message);
                    }
                    finally
                    {
                    // Clear the key.
                    if (key != null)
                    {
                        key.Clear();
                    }
                    }
                
                }
                
                private void Decrypt(XmlDocument doc, SymmetricAlgorithm alg)
                {
                    // Check the arguments.  
                    if (doc == null)
                    throw new ArgumentNullException("Doc");
                    if (alg == null)
                    throw new ArgumentNullException("alg");
                
                    // Find the EncryptedData element in the XmlDocument.
                    XmlElement encryptedElement = doc.GetElementsByTagName("EncryptedData")[0] as XmlElement;
                
                    // If the EncryptedData element was not found, throw an exception.
                    if (encryptedElement == null)
                    {
                    throw new XmlException("The EncryptedData element was not found.");
                    }
                
                
                    // Create an EncryptedData object and populate it.
                    EncryptedData edElement = new EncryptedData();
                    edElement.LoadXml(encryptedElement);
                
                    // Create a new EncryptedXml object.
                    EncryptedXml exml = new EncryptedXml();
                
                
                    // Decrypt the element using the symmetric key.
                    byte[] rgbOutput = exml.DecryptData(edElement, alg); <----  I GET THE EXCEPTION HERE
                    // Replace the encryptedData element with the plaintext XML element.
                    exml.ReplaceData(encryptedElement, rgbOutput);
                
                }
                

                推薦答案

                Rijndael/AES 是一個塊密碼.它以 128 位(16 個字符)塊加密數據.加密填充用于確保消息的最后一個塊始終是大小正確.

                Rijndael/AES is a block cypher. It encrypts data in 128 bit (16 character) blocks. Cryptographic padding is used to make sure that the last block of the message is always the correct size.

                您的解密方法期望它的默認填充是什么,并且沒有找到它.正如@NetSquirrel 所說,您需要為加密和解密顯式設置填充.除非您有理由不這樣做,否則請使用 PKCS#7 填充.

                Your decryption method is expecting whatever its default padding is, and is not finding it. As @NetSquirrel says, you need to explicitly set the padding for both encryption and decryption. Unless you have a reason to do otherwise, use PKCS#7 padding.

                這篇關于填充無效,無法刪除?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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)
                    <legend id='f2v7C'><style id='f2v7C'><dir id='f2v7C'><q id='f2v7C'></q></dir></style></legend>
                      <bdo id='f2v7C'></bdo><ul id='f2v7C'></ul>
                    • <tfoot id='f2v7C'></tfoot>

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

                        <tbody id='f2v7C'></tbody>

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

                        1. 主站蜘蛛池模板: 日韩视频一区二区三区 | 国产精品久久久久久久久久久免费看 | 一起操网站 | av在线伊人 | 91资源在线| 久久精品久久久久久 | 免费人成在线观看网站 | 久久精品免费 | 一区二区三区免费 | 成人av播放| 偷拍第一页 | 日韩a在线 | 91在线看网站 | 欧美人人| 国产精品久久久久久久7电影 | 视频一区二区在线观看 | 国产精品国产精品国产专区不卡 | 91伊人网| 国产激情免费视频 | 狠狠躁天天躁夜夜躁婷婷老牛影视 | 青青草国产在线观看 | 欧美成人激情 | 欧美猛交| 亚洲精品一区在线观看 | 日批的视频 | 毛片大全| 亚洲国产一区二区三区四区 | 久久福利 | 久久国产精品视频 | 国产精品久久久久无码av | 欧美日韩三级 | 99re99 | 久久综合欧美 | 亚洲国产高清高潮精品美女 | 日韩久久在线 | 三级成人在线 | 精品毛片 | 精品国产乱码久久久久久闺蜜 | 色婷婷精品久久二区二区蜜臂av | 国产成人一区二 | 精品久久久久久中文字幕 |