@Theory
  public void testKeyGeneration_givesNewKeys_works(
      @FromDataPoints("allOutputPrefixTypes") OutputPrefixType outputPrefixType) throws Exception {

    KeyTemplate protoKeyTemplate =
        KeyTemplate.newBuilder()
            .setOutputPrefixType(outputPrefixType)
            .setTypeUrl(PRIVATE_TYPE_URL)
            .setValue(Ed25519KeyFormat.getDefaultInstance().toByteString())
            .build();
    Parameters parameters = TinkProtoParametersFormat.parse(protoKeyTemplate.toByteArray());

    Set<String> keys = new TreeSet<>();
    int numKeys = 20;

    for (int i = 0; i < numKeys; i++) {
      KeysetHandle handle =
          KeysetHandle.newBuilder()
              .addEntry(
                  KeysetHandle.generateEntryFromParameters(parameters)
                      .withFixedId(0x88117722)
                      .makePrimary())
              .build();

      Keyset keyset =
          Keyset.parseFrom(
              TinkProtoKeysetFormat.serializeKeyset(handle, InsecureSecretKeyAccess.get()),
              ExtensionRegistryLite.getEmptyRegistry());
      assertThat(keyset.getPrimaryKeyId()).isEqualTo(0x88117722);
      assertThat(keyset.getKeyCount()).isEqualTo(1);
      assertThat(keyset.getKey(0).getKeyId()).isEqualTo(0x88117722);
      assertThat(keyset.getKey(0).getStatus()).isEqualTo(KeyStatusType.ENABLED);
      assertThat(keyset.getKey(0).getOutputPrefixType()).isEqualTo(outputPrefixType);
      assertThat(keyset.getKey(0).getKeyData().getTypeUrl()).isEqualTo(PRIVATE_TYPE_URL);
      assertThat(keyset.getKey(0).getKeyData().getKeyMaterialType())
          .isEqualTo(KeyMaterialType.ASYMMETRIC_PRIVATE);
      Ed25519PrivateKey privateKey =
          Ed25519PrivateKey.parseFrom(
              keyset.getKey(0).getKeyData().getValue(), ExtensionRegistryLite.getEmptyRegistry());
      keys.add(Hex.encode(privateKey.getKeyValue().toByteArray()));
    }
    assertThat(keys).hasSize(numKeys);
  }
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