@Theory
  public void encryptCustom_decryptBuiltIn_works(
      @FromDataPoints("allOutputPrefixTypes") OutputPrefixType outputPrefixType) throws Exception {
    byte[] plaintext = Random.randBytes(20);
    byte[] associatedData = Random.randBytes(20);
    AesSivKey protoKey =
        AesSivKey.newBuilder().setVersion(0).setKeyValue(ByteString.copyFrom(KEY_BYTES)).build();
    KeysetHandle handle = getKeysetHandleFromProtoKey(protoKey, outputPrefixType);

    DeterministicAead customDaead = handle.getPrimitive(DeterministicAead.class);
    byte[] ciphertext = customDaead.encryptDeterministically(plaintext, associatedData);
    byte[] ciphertext2 = customDaead.encryptDeterministically(plaintext, associatedData);
    DeterministicAead tinkDaead = AesSiv.create(createKey(outputPrefixType));
    byte[] decrypted = tinkDaead.decryptDeterministically(ciphertext, associatedData);
    byte[] decrypted2 = tinkDaead.decryptDeterministically(ciphertext2, associatedData);

    assertArrayEquals(ciphertext, ciphertext2);
    assertArrayEquals(plaintext, decrypted);
    assertArrayEquals(plaintext, decrypted2);
  }
Encrypts using a keyset with one key, with the custom key manager and decrypts the ciphertext
using normal Tink subtle decryptDeterministically.
java_src/src/test/java/com/google/crypto/tink/daead/KeyManagerIntegrationTest.java