我在网上搜索了很多,但在RSA公钥和私钥密码学中遇到了疑问。C#公钥中的RSA与私钥是一样的吗?
当我检查MSDN网站,我想这
RSACryptoServiceProvider rsaEncryptDecrypt = new RSACryptoServiceProvider();
byte[] privateKeyByte = rsaEncryptDecrypt.ExportParameters(true).Modulus;
byte[] publicKeyByte = rsaEncryptDecrypt.ExportParameters(false).Modulus;
string privateKey = Convert.ToBase64String(privateKeyByte);
string publicKey = Convert.ToBase64String(publicKeyByte);
字符串公钥和私钥是同! 这是正确的吗?我的意思是字符串如何能够相同?是不是假设是两个不同的钥匙?
如果我错了,请纠正我。我很困惑 !
预先感谢您!
UPDATE
我弄错了参数,
但后来当我发现
https://stackoverflow.com/questions/6592990/simple-rsa-encryption-decryption-in-net#answer-6593054"
我怎样才能得到的字符串值?因为我必须将它存储在App.config中并随时访问它。我的意思是我需要的公钥和私钥存储无论在App.config中
UPDATE2
我很抱歉,我刚才用的RSACryptoServiceProvider的实例ToXmlString财产。 得到了私钥和公钥。
你刚刚改变了模量!对于这两个密钥,这部分是相同的;) - 在RSA上进行一些研究并不困难:您可以在这里阅读模数(N):http://en.wikipedia.org/wiki/RSA_%28algorithm%29 #Key_generation – Carsten 2012-02-24 11:22:02