(byte[] input, byte[] key,
boolean forEncryption)
| 119 | |
| 120 | // h/t Steve Weis, Michael Rogers, and liberationtech |
| 121 | private static byte[] _cryptBytesAES(byte[] input, byte[] key, |
| 122 | boolean forEncryption) throws InvalidCipherTextException { |
| 123 | assert key.length == 32; // 32 bytes == 256 bits |
| 124 | return process(input, new PaddedBufferedBlockCipher(new CBCBlockCipher( |
| 125 | new AESEngine())), new KeyParameter(key), forEncryption); |
| 126 | // note: using zero IV because we generate a new key for every message |
| 127 | } |
| 128 | |
| 129 | // h/t Adam Paynter http://stackoverflow.com/users/41619/ |
| 130 | private static byte[] process(byte[] input, |
no test coverage detected