private static com.google.crypto.tink.proto.JwtHmacKeyFormat serializeToJwtHmacKeyFormat(
      JwtHmacParameters parameters) throws GeneralSecurityException {
    if (parameters.getKidStrategy().equals(JwtHmacParameters.KidStrategy.CUSTOM)) {
      throw new GeneralSecurityException(
          "Unable to serialize Parameters object with KidStrategy CUSTOM");
    }
    return com.google.crypto.tink.proto.JwtHmacKeyFormat.newBuilder()
        .setVersion(0)
        .setAlgorithm(toProtoAlgorithm(parameters.getAlgorithm()))
        .setKeySize(parameters.getKeySizeBytes())
        .build();
  }
Methods to serialize and parse {@link JwtHmacKey} objects and {@link JwtHmacParameters} objects.
java_src/src/main/java/com/google/crypto/tink/jwt/JwtHmacProtoSerialization.java