(byte[] input, Key recipient,
boolean forEncryption)
| 88 | } |
| 89 | |
| 90 | private static byte[] _cryptIES(byte[] input, Key recipient, |
| 91 | boolean forEncryption) throws InvalidKeyException, |
| 92 | IllegalBlockSizeException, BadPaddingException { |
| 93 | IESCipher cipher = new IESCipher(new IESEngine( |
| 94 | new ECDHBasicAgreement(), new KDF2BytesGenerator( |
| 95 | new SHA1Digest()), new HMac(new SHA256Digest()), |
| 96 | new PaddedBufferedBlockCipher(new CBCBlockCipher( |
| 97 | new AESEngine())))); |
| 98 | |
| 99 | cipher.engineInit(forEncryption ? Cipher.ENCRYPT_MODE |
| 100 | : Cipher.DECRYPT_MODE, recipient, new SecureRandom()); |
| 101 | return cipher.engineDoFinal(input, 0, input.length); |
| 102 | } |
| 103 | |
| 104 | public static byte[] generateAESKey() { |
| 105 | byte[] result = new byte[32]; |
no outgoing calls
no test coverage detected