C#操作java平台生成的公钥

RSAParameters Exponent 是三个字节,一般固定是0x01, 0, 0x01

byte[] plainData = new byte[117];// 明文数据;
RSACryptoServiceProvider rsaPub = new RSACryptoServiceProvider();
RSAParameters rparam = new RSAParameters();
rparam.Modulus = mods;  // 就是你的modulus,把你的那个字符串转换成字节,你的那个字符串应该是两个字符为一个字节
rparam.Exponent = new byte[] { 1, 0, 1 };
rsaPub.ImportParameters(rparam);
byte[] enData = rsaPub.Encrypt(plainData, false);

posted @ 2013-06-04 16:18  韶纥  阅读(690)  评论(0编辑  收藏  举报