喜逢身体 我建立客户机/服务器系统的会议RSA加密基于公钥
我有一个问题“无法隐式转换类型‘字符串’到‘System.Security.Cryptography.RSAParameters’”
我会解释这个过程很快
- 客户端连接到服务器
- 服务器送回他的公钥
- 客户端将加密的用户名+他的公钥通过服务器的公钥
我收到服务器回复(公钥),但是当我尝试使用RSA加密上述错误出现
这是我的代码:
RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
// mess is Server response as string
RSAParameters publickey = mess;
rsa.ImportParameters(publickey);
byte[] encryptedData = rsa.Encrypt(StringToByte(uname.Text + "|||" + PUBKEY), true);
亲爱Ranhiru 谢谢您的回复 我要问你的公钥格式应该怎么样子 低于正确我的公钥:E = 010001, N = 9060434af1e861fef7b918e31067fcacf62ebed29dcfb5deb251e3190d29bf32c63107b9f0301632c4f36a62387028c0d78dc4158a4f7299d0bd77daa66a1a036745d1bd7608b887b7330e2b8b630a7797e7e374635360905965e7a7000aaf6687f406cafc1f9d9309fdc23a04a139c1403335297e925badeb206c87735b326b – 2011-05-03 10:14:54
你是如何产生的?从'ExportCspBlob'方法? – 2011-05-03 10:26:04