問題描述
根據我通過閱讀各種材料所了解的一點點,公私鑰對是非對稱加密的基礎,也是選擇 2 個素數(大致是您的私鑰)并將它們相乘(大致是您的公鑰)的基礎).在我看來,如果您知道私鑰,則可以生成公鑰.是正確的還是我弄錯了什么?
From whatever little I understand by reading various material, public-private key pair are the basis of asymmetric encryption and also something about choosing 2 prime numbers (which is roughly your private key) and multiplying them (which is roughly your public key). It appears to me that it is possible to generate a public key if you know the private key. Is it correct or I am mistaking something?
讓我更困惑的是,無法使用 only 私鑰(使用 .NET 類 RSACryptoServiceProvider)將 RSA 密鑰序列化為 XML.不知道這個限制是不是故意的!
What made me more confusing was that it is not possible to serialize the RSA key to XML with only private key (using .NET class RSACryptoServiceProvider). Not sure whether this limitation is intentional or not!
推薦答案
這取決于加密系統.
在 RSA 中,我們有(引用維基百科):
In RSA, we have (citing Wikipedia):
公鑰由模數 n 和公開(或加密)指數 e 組成.這私鑰由模數 n 和私鑰(或解密)指數 d 組成,其中必須保密.
The public key consists of the modulus n and the public (or encryption) exponent e. The private key consists of the modulus n and the private (or decryption) exponent d which must be kept secret.
現在,如果我們有 n 和 d(私鑰),我們只缺少 e 作為公鑰.但 e 通常相當小(小于三位數),甚至是固定的(常見值為 65537).在這些情況下,獲取公鑰是微不足道的.
Now if we have n and d (the private key), we are only missing e for the public key. But e is often fairly small (less than three digits), or even fixed (a common value is 65537). In these cases getting the public key is trivial.
對于Elliptic Curve Diffie-Hellman,私鑰是d,公鑰是dG(G也是公開的),所以也很簡單.
For Elliptic Curve Diffie-Hellman, the private key is d, and the public key dG (with G also public), so it's trivial as well.
這篇關于給定一個私鑰,是否可以導出它的公鑰?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!