private static int getEncodingLength(EcdsaParameters.CurveType curveType)
      throws GeneralSecurityException {
    // We currently encode with one extra 0 byte at the beginning, to make sure
    // that parsing is correct even if passing of a two's complement encoding is used.
    // See also b/264525021.
    if (EcdsaParameters.CurveType.NIST_P256.equals(curveType)) {
      return 33;
    }
    if (EcdsaParameters.CurveType.NIST_P384.equals(curveType)) {
      return 49;
    }
    if (EcdsaParameters.CurveType.NIST_P521.equals(curveType)) {
      return 67;
    }
    throw new GeneralSecurityException("Unable to serialize CurveType " + curveType);
  }
Methods to serialize and parse {@link EcdsaPrivateKey} and {@link EcdsaPublicKey} objects and
{@link EcdsaParameters} objects.
java_src/src/main/java/com/google/crypto/tink/signature/internal/EcdsaProtoSerialization.java