private static ProtoKeySerialization toProtoKeySerialization(Keyset.Key protoKey)
      throws GeneralSecurityException {
    int id = protoKey.getKeyId();
    @Nullable
    Integer idRequirement = protoKey.getOutputPrefixType() == OutputPrefixType.RAW ? null : id;
    return ProtoKeySerialization.create(
        protoKey.getKeyData().getTypeUrl(),
        protoKey.getKeyData().getValue(),
        protoKey.getKeyData().getKeyMaterialType(),
        protoKey.getOutputPrefixType(),
        idRequirement);
  }
Returns true if this keyset is equal to {@code other}, ignoring monitoring annotations.

<p>Note: this may return false even if the keysets represent the same set of functions. For
example, this can happen if the keys store zero-byte padding of a {@link java.math.BigInteger},
which are irrelevant to the function computed. Currently, keysets can also be invalid in which
case this will return false.
java_src/src/main/java/com/google/crypto/tink/KeysetHandle.java