public static ProtoKeySerialization create(
      String typeUrl,
      ByteString value,
      KeyMaterialType keyMaterialType,
      OutputPrefixType outputPrefixType,
      @Nullable Integer idRequirement)
      throws GeneralSecurityException {
    if (outputPrefixType == OutputPrefixType.RAW) {
      if (idRequirement != null) {
        throw new GeneralSecurityException(
            "Keys with output prefix type raw should not have an id requirement.");
      }
    } else {
      if (idRequirement == null) {
        throw new GeneralSecurityException(
            "Keys with output prefix type different from raw should have an id requirement.");
      }
    }
    Bytes objectIdentifier = checkedToBytesFromPrintableAscii(typeUrl);
    return new ProtoKeySerialization(
        typeUrl, objectIdentifier, value, keyMaterialType, outputPrefixType, idRequirement);
  }
* Represents a {@code Key} object serialized with binary protobuf Serialization.

<p>{@code ProtoKeySerialization} objects fully describe a {@code Key} object, but tailored for
protocol buffer serialization.
java_src/src/main/java/com/google/crypto/tink/internal/ProtoKeySerialization.java