久久久久久久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. 填充無(wú)效,無(wú)法刪除?

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

              <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>
                本文介紹了填充無(wú)效,無(wú)法刪除?的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                問(wèn)題描述

                限時(shí)送ChatGPT賬號(hào)..

                我已在網(wǎng)上查找此異常與我的程序相關(guān)的含義,但似乎找不到解決方案或我的特定程序發(fā)生此異常的原因.我一直在使用我的 msdn 提供的示例來(lái)使用 Rijndael 算法加密和解密 XmlDocument.加密工作正常,但當(dāng)我嘗試解密時(shí),出現(xiàn)以下異常:

                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:

                填充無(wú)效,無(wú)法移除

                誰(shuí)能告訴我我能做些什么來(lái)解決這個(gè)問(wèn)題?下面的代碼是我獲取密鑰和其他數(shù)據(jù)的地方.如果cryptoMode為false,就會(huì)調(diào)用decrypt方法,也就是異常發(fā)生的地方:

                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 是一個(gè)塊密碼.它以 128 位(16 個(gè)字符)塊加密數(shù)據(jù).加密填充用于確保消息的最后一個(gè)塊始終是大小正確.

                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.

                您的解密方法期望它的默認(rèn)填充是什么,并且沒(méi)有找到它.正如@NetSquirrel 所說(shuō),您需要為加密和解密顯式設(shè)置填充.除非您有理由不這樣做,否則請(qǐng)使用 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.

                這篇關(guān)于填充無(wú)效,無(wú)法刪除?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                相關(guān)文檔推薦

                What are good algorithms for vehicle license plate detection?(車(chē)牌檢測(cè)有哪些好的算法?)
                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)
                    <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免费观看 | 男女污网站 | 国产免费一区二区三区 | 国产成人在线视频 | 欧美日韩一区二区在线 | 亚洲免费在线观看 | 成人区精品 | 日韩在线视频观看 | 欧美日韩中文字幕在线 | 99r在线 | 美女在线一区二区 | 久久久久久免费看 | 亚洲精品乱 | 国产一区二区毛片 | 精品九九 | 欧洲av一区 | 国产91精品久久久久久久网曝门 | 日韩一及片| 国产精品久久久久久久久免费樱桃 | 99精品国产一区二区三区 | 久久久在线视频 | 日韩在线视频一区 | 精品日韩 | 欧美自拍第一页 | 亚洲女人的天堂 | a级片在线观看 | 一级毛片色一级 | 97碰碰碰 | 成人免费福利 | 久久免费国产 | 亚洲欧美网站 | 狼色网| 人妖一区| 午夜成人在线视频 | 欧美乱人伦视频 |