AESBinaryManager extends LocalBinaryManager { public AESBinaryManager() { setUnlimitedJCEPolicy(); } AESBinaryManager(); @Override void initialize(BinaryManagerDescriptor binaryManagerDescriptor); @Override Binary getBinary(InputStream in); @Override Binary getBinary(String digest); @Override String storeAndDigest(InputStream in, OutputStream out);  }
@Test public void testAESBinaryManager() throws Exception { AESBinaryManager binaryManager = new AESBinaryManager(); BinaryManagerDescriptor descriptor = new BinaryManagerDescriptor(); String options = String.format("%s=%s", PARAM_PASSWORD, "mypassword"); descriptor.key = options; binaryManager.initialize(descriptor); Binary binary = binaryManager.getBinary(CONTENT_MD5); assertNull(binary); byte[] bytes = CONTENT.getBytes(UTF8); binary = binaryManager.getBinary(new ByteArrayInputStream(bytes)); assertNotNull(binary); assertEquals(CONTENT_MD5, binary.getDigest()); binary = binaryManager.getBinary(CONTENT_MD5); assertNotNull(binary); assertEquals(bytes.length, binary.getLength()); try (InputStream stream = binary.getStream()) { assertEquals(CONTENT, IOUtils.toString(stream, UTF8)); } binaryManager.close(); }