C
C
CheshKin2015-08-07 09:30:07
Java
CheshKin, 2015-08-07 09:30:07

How to decrypt RSA?

Hello. I encrypted the password and put it in a txt file, in the third column. But I can't decipher. compiler throws "javax.crypto.IllegalBlockSizeException: Data must not be longer than 128 bytes"

if (cols2[0].equals(sitetx2)) {
                            String s = cols2[2];
                            try {
                                    if (!new File(PRIVATE_KEY_FILE).exists() || !new File(PUBLIC_KEY_FILE).exists()) {
                                        generateKey();
                                    }
                                    byte[] encryptedText = s.getBytes();
                                    String plainText = decrypt(encryptedText, restorePrivate());
                                  
                                    System.out.println("Decrypted Text: " + plainText);

                                } catch (Exception e4) {
                                    e4.printStackTrace();
                                }
                            scanner2.close();
                        } else {
                            scanner2.close();
                        }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Martyanov, 2015-08-07
@vilgeforce

How you have implemented decrypt () and where exactly the error is thrown, everyone should guess, apparently.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question