首页 新闻 赞助 找找看

.net RSA 使用Exponent 和 Modulus 加密

0
悬赏园豆:50 [已解决问题] 解决于 2017-01-05 12:27

对接方给了我 modulus: 139692467408029117276727234775408185265788583360693315923674753923420741299460389539541065959255860734159914984030728051112977755963014319502820581359359137523148000552655715538268379509894546496002216598777762461039909896712894989079359712053071286554423165340267924305304914691212765001109000584929723449569

public exponent: 65537

已使用方法

1         RSAParameters para = new RSAParameters();
2             para.Exponent = Encoding.Default.GetBytes("65537");
3             para.Modulus = Encoding.Default.GetBytes("139692467408029117276727234775408185265788583360693315923674753923420741299460389539541065959255860734159914984030728051112977755963014319502820581359359137523148000552655715538268379509894546496002216598777762461039909896712894989079359712053071286554423165340267924305304914691212765001109000584929723449569");
4 
5             RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
6             rsa.ImportParameters(para);

用.net的加密类加密之后的位数已经达到400多位.但是能被服务器解密的数据长度为172

然后我又尝试使用大数类,所谓最标准的RSA算法

      BigInteger e = new BigInteger("65537", 10);
      BigInteger n = new BigInteger("139692467408029117276727234775408185265788583360693315923674753923420741299460389539541065959255860734159914984030728051112977755963014319502820581359359137523148000552655715538268379509894546496002216598777762461039909896712894989079359712053071286554423165340267924305304914691212765001109000584929723449569", 10);
       BigInteger m = new BigInteger(Encoding.Default.GetBytes("123456"));
       var c = m.modPow(e, n).ToString();

这次生成的位数是172位.但是服务器提示解密返回空,解析失败.

我想问下.Net 通过 e 和 m的加密算法还有没有其他的

 

 

  modulus: 139692467408029117276727234775408185265788583360693315923674753923420741299460389539541065959255860734159914984030728051112977755963014319502820581359359137523148000552655715538268379509894546496002216598777762461039909896712894989079359712053071286554423165340267924305304914691212765001109000584929723449569
  public exponent: 65537
微风12x的主页 微风12x | 菜鸟二级 | 园豆:205
提问于:2017-01-03 18:59
< >
分享
最佳答案
0

http://www.cnblogs.com/wangshisuifeng/p/6251865.html

收获园豆:50
微风吹过12x | 初学一级 |园豆:73 | 2017-01-05 12:25
其他回答(1)
0
dudu | 园豆:31075 (高人七级) | 2017-01-03 20:15
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册