| 68 | } |
| 69 | |
| 70 | private String decrypt(String key, String encryptedText) throws Exception { |
| 71 | Cipher cipher = Cipher.getInstance(TRANSFORMATION); |
| 72 | SecretKeySpec secretKey = new SecretKeySpec(key.getBytes(), ALGORITHM); |
| 73 | cipher.init(Cipher.DECRYPT_MODE, secretKey); |
| 74 | byte[] encryptedBytes = Base64.getDecoder().decode(encryptedText); |
| 75 | byte[] decryptedBytes = cipher.doFinal(encryptedBytes); |
| 76 | return new String(decryptedBytes); |
| 77 | } |
| 78 | } |
| 79 | /*<applet code = "AESApplet.class" width = "1000" height = "1000"> |
| 80 | </applet> |