(byte[] K_e,byte[] ciphertext)
| 36 | } |
| 37 | |
| 38 | public static byte[] decrypt(byte[] K_e,byte[] ciphertext) { |
| 39 | IvParameterSpec iv = new IvParameterSpec(InitVector.getBytes(StandardCharsets.UTF_8)); |
| 40 | try { |
| 41 | SecretKeySpec secretKeySpec = new SecretKeySpec(K_e, "AES"); |
| 42 | Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); |
| 43 | cipher.init(Cipher.DECRYPT_MODE, secretKeySpec,iv); |
| 44 | byte[] res = cipher.doFinal(ciphertext); |
| 45 | return res; |
| 46 | } catch (Exception e){ |
| 47 | |
| 48 | } |
| 49 | return null; |
| 50 | } |
| 51 | } |