private static ProtoKeySerialization serializeKey(
      HmacPrfKey key, @Nullable SecretKeyAccess access) throws GeneralSecurityException {
    return ProtoKeySerialization.create(
        TYPE_URL,
        com.google.crypto.tink.proto.HmacPrfKey.newBuilder()
            .setParams(getProtoParams(key.getParameters()))
            .setKeyValue(
                ByteString.copyFrom(
                    key.getKeyBytes().toByteArray(SecretKeyAccess.requireAccess(access))))
            .build()
            .toByteString(),
        KeyMaterialType.SYMMETRIC,
        OutputPrefixType.RAW,
        key.getIdRequirementOrNull());
  }
Methods to serialize and parse {@link HmacPrfKey} objects and {@link HmacPrfParameters} objects.
java_src/src/main/java/com/google/crypto/tink/prf/internal/HmacPrfProtoSerialization.java