Auto commit

上级 f9e5ad11
...@@ -72,7 +72,7 @@ public class Main { ...@@ -72,7 +72,7 @@ public class Main {
rsa = new RSA(sc.nextBigInteger(),sc.nextBigInteger(),sc.nextBigInteger()); rsa = new RSA(sc.nextBigInteger(),sc.nextBigInteger(),sc.nextBigInteger());
} }
case 2->{ case 2->{
print.println("输入密钥长度"); print.println("输入密钥长度,长度不小于512");
rsa = new RSA(sc.nextInt()); rsa = new RSA(sc.nextInt());
} }
} }
...@@ -167,6 +167,9 @@ class RSA { ...@@ -167,6 +167,9 @@ class RSA {
* @param keySize 密钥大小 * @param keySize 密钥大小
*/ */
public RSA(int keySize){ public RSA(int keySize){
if(keySize < 512){
System.err.println("都说了不要小于512,会报错的,重新启动程序吧");
}
try { try {
KeyPairGenerator keyGenerator = KeyPairGenerator.getInstance("RSA"); KeyPairGenerator keyGenerator = KeyPairGenerator.getInstance("RSA");
keyGenerator.initialize(keySize); keyGenerator.initialize(keySize);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册