File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change 11package core ;
22
33import java .math .BigInteger ;
4- import java .util .Random ;
54
65/*
76 * A program that allows you to encrypt and decrypt messages with RSA.
@@ -14,13 +13,13 @@ public class RSATest {
1413 public static void main (String [] args ) {
1514 RSAKeyPair keys = Cryptography .generateRSAKeys ();
1615
17- BigInteger plainText = BigInteger . probablePrime ( 32 , new Random ()) ;
16+ String plainText = "Hello, world!" ;
1817 System .out .println ("Message: " + plainText );
1918
2019 BigInteger cipherText = Cryptography .encrypt (plainText , keys .getPublicKey ());
2120 System .out .println ("Cipher: " + cipherText );
2221
23- BigInteger decodedCipher = Cryptography .decrypt (cipherText , keys .getPrivateKey ());
24- System .out .println ("Original text: " + decodedCipher );
22+ String decodedText = Cryptography .decrypt (cipherText , keys .getPrivateKey ());
23+ System .out .println ("Original text: " + decodedText );
2524 }
2625}
You can’t perform that action at this time.
0 commit comments