private static void validate(Keyset keyset) throws GeneralSecurityException {
    for (Keyset.Key key : keyset.getKeyList()) {
      if (key.getKeyData().getKeyMaterialType() == KeyData.KeyMaterialType.UNKNOWN_KEYMATERIAL
          || key.getKeyData().getKeyMaterialType() == KeyData.KeyMaterialType.SYMMETRIC
          || key.getKeyData().getKeyMaterialType() == KeyData.KeyMaterialType.ASYMMETRIC_PRIVATE) {
        throw new GeneralSecurityException("keyset contains secret key material");
      }
    }
  }
Validates that {@code keyset} doesn't contain any secret key material.

@throws GeneralSecurityException if {@code keyset} contains secret key material.
java_src/src/main/java/com/google/crypto/tink/NoSecretKeysetHandle.java