private static JwtEcdsaAlgorithm toProtoAlgorithm(JwtEcdsaParameters.Algorithm algorithm)
      throws GeneralSecurityException {
    if (JwtEcdsaParameters.Algorithm.ES256.equals(algorithm)) {
      return JwtEcdsaAlgorithm.ES256;
    }
    if (JwtEcdsaParameters.Algorithm.ES384.equals(algorithm)) {
      return JwtEcdsaAlgorithm.ES384;
    }
    if (JwtEcdsaParameters.Algorithm.ES512.equals(algorithm)) {
      return JwtEcdsaAlgorithm.ES512;
    }
    throw new GeneralSecurityException("Unable to serialize algorithm: " + algorithm);
  }
Methods to serialize and parse {@link JwtEcdsaPrivateKey}, {@link JwtEcdsaPublicKey}, and {@link
JwtEcdsaParameters} objects.
java_src/src/main/java/com/google/crypto/tink/jwt/JwtEcdsaProtoSerialization.java