首页
论坛
课程
招聘
[讨论]求助RSA用msieve 1024分解
2020-2-6 22:35 10233

[讨论]求助RSA用msieve 1024分解

2020-2-6 22:35
10233
看雪大神云集,高手汇集,想问下以下的代码只有公钥,密文根据公钥可以算出,再用私钥解密出加密的明文,想求私钥,请问通过msieve能算出来吗?烦请大神指点或推荐工具吗? 不胜感谢,雪币重谢!

package lnqttioan;

import java.math.BigInteger;
import java.security.KeyFactory;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.RSAPrivateKeySpec;
import java.security.spec.RSAPublicKeySpec;

import javax.crypto.Cipher;

public class RSA3 {
public static void main(String[] args) throws Exception{
//公钥加密
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
BigInteger modulus = new BigInteger("74012333486664938781784917319558621132853116184330140056431518519045738769048519249056658298166167763470840652490749373904013083030606481430471831114359564218640421134865601541504510679730861155149074228202153555958396574024051859098069905430336909436487040882153838831388394227045818116146099262275363316229",10);
BigInteger publicExponent = new BigInteger("65537");
RSAPublicKeySpec rsaPublicKeySpec = new RSAPublicKeySpec(modulus,publicExponent);
PublicKey publicKey = keyFactory.generatePublic(rsaPublicKeySpec);
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE,publicKey);
byte[]  encryptData = cipher.doFinal("Hello,RSA!".getBytes());
//System.out.println("encryptData:" + new String(encryptData));
//私钥解密
BigInteger privateExponent = new BigInteger("11894012485795125429143212982125995968250133812249035431503850146369069696745639939744949039417215906814088129637190783922930036322662731928921514950278998682712848452472751188416695902648346915331619305800219832154430379586340557456420648400558539747973551728237870781526760012558742029523629863397333781297",10);
RSAPrivateKeySpec rsaPrivateKeySpec = new RSAPrivateKeySpec(modulus,privateExponent);
PrivateKey privateKey = keyFactory.generatePrivate(rsaPrivateKeySpec);
cipher.init(Cipher.DECRYPT_MODE,privateKey);
byte[] decryptData = cipher.doFinal(encryptData);
System.out.println("decryptData:" + new String(decryptData));
}
}

【看雪培训】《Adroid高级研修班》2022年夏季班招生中!

收藏
点赞0
打赏
分享
最新回复 (3)
雪    币: 2500
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
mb_xghoecki 活跃值 2020-2-6 23:02
2
1
帮顶
雪    币: 6
活跃值: 活跃值 (102)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
shark凯 活跃值 2020-9-28 18:20
3
0
这个帖子是凉了没人了吗?
雪    币: 9807
活跃值: 活跃值 (2092)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
tDasm 活跃值 2020-9-28 19:21
4
0
想做注册机?
大数分解看多久能完成
游客
登录 | 注册 方可回帖
返回