DeterministicAeadWrapper implements PrimitiveWrapper<DeterministicAead, DeterministicAead> { @Override public DeterministicAead wrap(final PrimitiveSet<DeterministicAead> primitives) { return new WrappedDeterministicAead(primitives); } DeterministicAeadWrapper(); @Override DeterministicAead wrap(final PrimitiveSet<DeterministicAead> primitives); @Override Class<DeterministicAead> getPrimitiveClass(); @Override Class<DeterministicAead> getInputPrimitiveClass(); static void register();  }
@Test public void testEncrytDecrypt() throws Exception { KeysetHandle keysetHandle = KeysetHandle.generateNew(DeterministicAeadKeyTemplates.AES256_SIV); DeterministicAead aead = new DeterministicAeadWrapper().wrap(Registry.getPrimitives(keysetHandle)); byte[] plaintext = Random.randBytes(20); byte[] associatedData = Random.randBytes(20); byte[] ciphertext = aead.encryptDeterministically(plaintext, associatedData); byte[] ciphertext2 = aead.encryptDeterministically(plaintext, associatedData); byte[] decrypted = aead.decryptDeterministically(ciphertext, associatedData); byte[] decrypted2 = aead.decryptDeterministically(ciphertext2, associatedData); assertArrayEquals(ciphertext, ciphertext2); assertArrayEquals(plaintext, decrypted); assertArrayEquals(plaintext, decrypted2); }