无法解密RSA加密密钥
长话短说,我使用的DES和我使用RSA加密密码交换,密码不超过16个字符 问题是当我加密密钥,加密大小变得对我来说太大解密 这里是我的RSA加密和解密代码:无法解密RSA加密密钥
加密: - 我一直在努力的localpwd为“ASD”
byte[] plaintext = utf8.GetBytes(localpwd);
byte[] ciphertext = rsaservice.Encrypt(plaintext, false);
string cipherresult = Convert.ToBase64String(ciphertext);
然后我打印加密的密钥对文本框并尝试解密
byte[] ciphertext = utf8.GetBytes(filetest.Text);
byte[] plain = rsaservice.Decrypt(ciphertext, true);
string plaintext = utf8.GetString(plain);
我得到“要解密的数据超过这个256字节模数的最大值”。 我试图增加密钥大小能够加密和解密较大的密钥大小,但增加密钥只是增加了加密数据的大小导致相同的错误 请帮助!
//byte[] ciphertext = utf8.GetBytes(filetest.Text);
byte[] ciphertext = Convert.FromBase64String(filetest.Text);
WOW从来没有想到会那么简单,你先生有刚刚救了我的命:D谢谢 – 2012-04-28 10:46:37
我可以使用unicode吗?我试图通过网络流发送,而且我无法为Base64字符串执行 – 2012-04-28 12:10:14
所有字符串都可以编码为Unicode ...在这里应该没关系。 – 2012-04-28 12:32:53
我没有看到ToBase64String的'反向()' – 2012-04-28 09:52:39
我使用utf8编码来获得转换为字节NAD回串再次 – 2012-04-28 10:20:20