@Theory
  public void testComputeBuiltIn_verifyCustom_works(
      @FromDataPoints("allOutputPrefixTypes") OutputPrefixType outputPrefixType) throws Exception {
    Ed25519PublicKey protoPublicKey =
        Ed25519PublicKey.newBuilder()
            .setVersion(0)
            .setKeyValue(ByteString.copyFrom(publicKeyByteArray))
            .build();
    KeyData keyData =
        KeyData.newBuilder()
            .setTypeUrl(PUBLIC_TYPE_URL)
            .setValue(protoPublicKey.toByteString())
            .setKeyMaterialType(KeyMaterialType.ASYMMETRIC_PUBLIC)
            .build();
    Keyset keyset =
        Keyset.newBuilder()
            .addKey(
                Keyset.Key.newBuilder()
                    .setKeyData(keyData)
                    .setStatus(KeyStatusType.ENABLED)
                    .setOutputPrefixType(outputPrefixType)
                    .setKeyId(0x23456789)
                    .build())
            .setPrimaryKeyId(0x23456789)
            .build();

    KeysetHandle handle = TinkProtoKeysetFormat.parseKeysetWithoutSecret(keyset.toByteArray());
    PublicKeyVerify customVerifier = handle.getPrimitive(PublicKeyVerify.class);
    @Nullable Integer idRequirement = outputPrefixType == OutputPrefixType.RAW ? null : 0x23456789;

    PublicKeySign tinkSigner =
        Ed25519Sign.create(
            com.google.crypto.tink.signature.Ed25519PrivateKey.create(
                com.google.crypto.tink.signature.Ed25519PublicKey.create(
                    variantForOutputPrefix(outputPrefixType),
                    Bytes.copyFrom(publicKeyByteArray),
                    idRequirement),
                SecretBytes.copyFrom(privateKeyByteArray, InsecureSecretKeyAccess.get())));

    byte[] message = new byte[] {1, 2, 3};
    byte[] signature = tinkSigner.sign(message);
    customVerifier.verify(signature, message);
  }
This test computes the signature using a Tink subtle Ed25519Sign. It then verifies the
Signature with a PublicKeyVerify from the custom keyset.
java_src/src/test/java/com/google/crypto/tink/signature/KeyManagerIntegrationTest.java