@Test
public void testValidateKeyset_noPrimaryKey_keysetContainsOnlyPublicKeys_shouldWork()
    throws Exception {

  // No primary key, but contains only public key material.
  Keyset validKeyset =
      Keyset.newBuilder()
          .addKey(
              Keyset.Key.newBuilder()
                  .setKeyData(
                      TestUtil.createKeyData(
                          KeyData.newBuilder().build(),
                          "typeUrl",
                          KeyData.KeyMaterialType.ASYMMETRIC_PUBLIC))
                  .setKeyId(1)
                  .setStatus(KeyStatusType.ENABLED)
                  .setOutputPrefixType(OutputPrefixType.TINK)
                  .build())
          .build();
  try {
    Util.validateKeyset(validKeyset);
  } catch (GeneralSecurityException e) {
    fail("Valid keyset, should not fail: " + e);
  }
}