@Theory
  public void encryptBuiltIn_decryptCustom_works(
      @FromDataPoints("allOutputPrefixTypes") OutputPrefixType outputPrefixType) throws Exception {
    byte[] plaintext = Random.randBytes(20);
    byte[] associatedData = Random.randBytes(20);

    DeterministicAead tinkDaead = AesSiv.create(createKey(outputPrefixType));
    byte[] ciphertext = tinkDaead.encryptDeterministically(plaintext, associatedData);
    byte[] ciphertext2 = tinkDaead.encryptDeterministically(plaintext, associatedData);
    AesSivKey protoKey =
        AesSivKey.newBuilder().setVersion(0).setKeyValue(ByteString.copyFrom(KEY_BYTES)).build();
    KeysetHandle handle = getKeysetHandleFromProtoKey(protoKey, outputPrefixType);
    DeterministicAead customDaead = handle.getPrimitive(DeterministicAead.class);
    byte[] decrypted = customDaead.decryptDeterministically(ciphertext, associatedData);
    byte[] decrypted2 = customDaead.decryptDeterministically(ciphertext2, associatedData);

    assertArrayEquals(ciphertext, ciphertext2);
    assertArrayEquals(plaintext, decrypted);
    assertArrayEquals(plaintext, decrypted2);
  }
This encrypts using the subtle Tink API, then decrypts using the custom key manager with a
keyset with a single key.
java_src/src/test/java/com/google/crypto/tink/daead/KeyManagerIntegrationTest.java