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

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

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

    1. 為什么RSAParameters Modulus不等于P和Q的乘積?

      Why is RSAParameters Modulus not equal product of P and Q?(為什么RSAParameters Modulus不等于P和Q的乘積?)
    2. <i id='7nAm9'><tr id='7nAm9'><dt id='7nAm9'><q id='7nAm9'><span id='7nAm9'><b id='7nAm9'><form id='7nAm9'><ins id='7nAm9'></ins><ul id='7nAm9'></ul><sub id='7nAm9'></sub></form><legend id='7nAm9'></legend><bdo id='7nAm9'><pre id='7nAm9'><center id='7nAm9'></center></pre></bdo></b><th id='7nAm9'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='7nAm9'><tfoot id='7nAm9'></tfoot><dl id='7nAm9'><fieldset id='7nAm9'></fieldset></dl></div>

        <small id='7nAm9'></small><noframes id='7nAm9'>

        1. <legend id='7nAm9'><style id='7nAm9'><dir id='7nAm9'><q id='7nAm9'></q></dir></style></legend>

                <bdo id='7nAm9'></bdo><ul id='7nAm9'></ul>
                <tfoot id='7nAm9'></tfoot>

                  <tbody id='7nAm9'></tbody>
                本文介紹了為什么RSAParameters Modulus不等于P和Q的乘積?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                限時送ChatGPT賬號..

                P 和 Q 的值與 .Net RSAParameters 的模量值不匹配.根據 RSA 算法和 MSDN 文檔,它應該是:P * Q = Modulus

                The values of P and Q do not match value of the Modulus of the .Net RSAParameters. According to RSA algorithm and MSDN documentation it should be: P * Q = Modulus

                我生成了一個 512 位 RSA 密鑰對并通過調用將其導出為 XML:

                I generated a 512bit RSA keypair and exported it to XML by invoking:

                RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(512);
                rsa.ToXmlString(true);
                

                這給了我以下 XML:

                This gave me the following XML:

                <RSAKeyValue>
                  <Modulus>rcLI1XTfmXtX05zq67d1wujnUvevBu8dZ5Q5uBUi2mKndH1FZLYCKrjFaDTB/mXW1l5C74YycVLS6msY2NNJYw==</Modulus>
                  <Exponent>AQAB</Exponent>
                  <P>1dwGkK5POlcGCjQ96Se5NSPu/hCm8F5EYwyqRpLVzgk=</P>
                  <Q>0AAEMHBj7CP2XHfCG/RzGldw1GdsW13rTo3uEE9Dtws=</Q>
                  <DP>PO4jMLV4/TYuElowCW235twGC3zTE0jIUzAYk2LiZ4E=</DP>
                  <DQ>ELJ/o5fSHanBZCjk9zOHbezpDNQEmc0PT64LF1oVmIM=</DQ>
                  <InverseQ>NyCDwTra3LiUin05ZCGkdKLwReFC9L8Zf01ZfYabSfQ=</InverseQ>
                  <D>EWwFTPmx7aajULFcEJRNd2R4xSXWY8CX1ynSe7WK0BCH42wf/REOS9l8Oiyjf587BhGa3y8jGKhUD7fXANDxcQ==</D>
                </RSAKeyValue>
                

                現在我成功編寫了一個小測試程序來加密、解密、簽名和驗證數據.

                Now I successfully wrote a litte test programm to encrypt, decrypt, sign and verify data.

                最后我加了一點測試代碼:

                At the end I added a little test code:

                RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(512);
                rsa.FromXmlString(key); // key = string with XML above
                
                RSAParameters param = rsa.ExportParameters(true);
                BigInteger p = new BigInteger(param.P);
                BigInteger q = new BigInteger(param.Q);
                BigInteger n = new BigInteger(param.Modulus);
                BigInteger myN = BigInteger.Multiply(p, q);
                Console.WriteLine("n   = " + n.ToString());
                Console.WriteLine("myN = " + myN.ToString());
                

                這給了我們以下輸出:

                <代碼> N = 5200154866521200075264779234483365112866265806746380532891861717388028374942014660490111623133775661411009378522295439774347383363048751390839618325234349MYN = 23508802329434377088477386089844302414021121047189424894399694701810500376591071843028984420422297770783276119852460021668188142735325512873796040092944

                為什么 P 和 Q 相乘不等于模數?

                Why does multiplying P and Q not equal the Modulus?

                我已經檢查了很多東西,比如字節序、編碼、BigInteger 類,使用上述 XML 密鑰成功加密、解密、簽名、驗證,但找不到任何解釋為什么 P 和 Q 相乘不等于模數...

                I already checked a lot of things like endian, encoding, BigInteger class, successfully encrypted, decrypted, signed, verified with the above XML keys but cannot find any explanation why P and Q multiplied is not equaling the Modulus...

                誰能幫我解釋一下為什么 P*Q 不是模數?

                Can anybody help me explain why P*Q is not the Modulus ?

                可讀格式的所有值:

                <代碼>模量= 5200154866521200075264779234483365112866265806746380532891861717388028374942014660490111623133775661411009378522295439774347383363048751390839618325234349指數 = 65537P = 4436260148159638728185416185189716006279182659244174640493183003717504785621Q = 5299238895894527538601438806093945941831432623367272568173893997325464109264DP = -57260184070162652127728137041376572684067529466727954512100856352006444159428DQ = -56270397953566513533764063103154348713259844205844432469862161942601135050224逆Q = -5297700950752995201824767053303055736360972826004414985336436365496709603273d = 5967761894604968266284398550464653556930604493620355473531132912985865955601309375321441883258487907574824598936524238049397825498463180877735939967118353

                更新:

                根據答案,我為 .Net BigInteger 類編寫了一個小擴展方法,以便與 RSAParameters 一起正常工作:

                According to the answer I wrote a little extension method for the .Net BigInteger class to work correctly with the RSAParameters:

                public static class BigIntegerExtension
                {
                    public static BigInteger FromBase64(this BigInteger i, string base64)
                    {
                        byte[] p = Convert.FromBase64String(base64).Reverse().ToArray();
                        if (p[p.Length - 1] > 127)
                        {
                            Array.Resize(ref p, p.Length + 1);
                            p[p.Length - 1] = 0;
                        }
                       return new BigInteger(p);
                    }
                
                    public static BigInteger FromBigEndian(this BigInteger i, byte[] p)
                    {
                        p = p.Reverse().ToArray();
                        if (p[p.Length - 1] > 127)
                        {
                            Array.Resize(ref p, p.Length + 1);
                            p[p.Length - 1] = 0;
                        }
                        return new BigInteger(p);
                    }
                }
                

                使用示例:

                BigInteger modulus1 = new BigInteger().FromBase64("rcLI1XTfmXtX05zq67d1wujnUvevBu8dZ5Q5uBUi2mKndH1FZLYCKrjFaDTB/mXW1l5C74YycVLS6msY2NNJYw==");
                
                BigInteger modulus2 = new BigInteger().FromBigEndian(param.Modulus);
                

                希望這可以幫助其他有同樣問題的人:-)

                Hope this helps others with the same problem :-)

                推薦答案

                這是我對你提供的 XML 參數的解析:

                Here is my parsing of the XML parameters you provided:

                <代碼> N = 9100595563660672087698322262735024483609782000266155222822537546670463733453350686171384417480667378838400923087358115007100900745853538273602044437940579P = 96731388413554317303099785843734797692955743043844132225634400270674214374921Q = 94081101418218318334927154927633016498744568046568114230258529096538660255499

                如您所見,N 確實等于 P * Q.

                As you can verify, N does indeed equal P * Q.

                您不能像現在這樣使用 BigInteger(byte []) 構造函數,因為它期望字節數組采用小端序,并且因為 Microsoft 已經做了一些事情來表示贊同.相反,顛倒字節的順序.最后,因為字節數組應該是二進制補碼并且您的數字保證為正數,您必須在數組的高位字節中添加一個零字節 if 否則高位字節將大于或等于 128.

                You cannot use the BigInteger(byte []) constructor the way you are because it expects the byte array to be in little-endian, and because Microsoft has done things bass ackwards. Instead, reverse the order of the bytes. And finally, because the bytes arrays are supposed to be twos complement and your numbers are guaranteed to be positive you must add a zero byte to the high order byte of the array if the high-order byte would otherwise be greater than or equal to 128.

                這篇關于為什么RSAParameters Modulus不等于P和Q的乘積?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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)
                  <tbody id='mMjDM'></tbody>

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

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

                      1. <tfoot id='mMjDM'></tfoot>

                          主站蜘蛛池模板: 久久久久久久久久久久91 | 亚洲热在线视频 | 欧美亚洲国产一区二区三区 | 精品国产一区二区三区久久狼黑人 | 成人亚洲视频 | 中文字幕高清 | 久草成人网 | 一区二区在线免费观看 | a免费观看 | 国产精品视频久久久 | 北条麻妃一区二区三区在线观看 | 亚洲国产aⅴ精品一区二区 免费观看av | 国产日韩中文字幕 | 亚洲综合国产 | 最近免费日本视频在线 | 亚洲日韩欧美一区二区在线 | 人人干人人干人人 | 久久久久久久一区二区三区 | 超碰人人艹| 欧美一区日韩一区 | 中文字幕 国产 | 亚洲激情在线视频 | 亚洲国产一区在线 | 午夜精品一区二区三区三上悠亚 | 日本欧美国产在线观看 | 成人a网| 五月婷婷亚洲 | 久久久91精品国产一区二区三区 | 91在线精品秘密一区二区 | 亚州成人| 中文字幕 欧美 日韩 | 欧美日韩不卡 | 日韩精品色网 | 日本 欧美 三级 高清 视频 | 精品久久久久久久 | 国产精品黄视频 | 精品亚洲一区二区三区 | 日韩精品在线观看一区二区 | 精精精精xxxx免费视频 | 日韩久久综合 | av大片|