I am trying to use GnuTLS library to generate EC key with following code:

  int ec;
  gnutls_privkey_t priv;
  const char *curve = "secp521r1";
  gnutls_pk_algorithm_t pk_algo;
  gnutls_ecc_curve_t pk_curve;
  int bits;
  pk_curve = gnutls_ecc_curve_get_id(curve);
  bits = GNUTLS_CURVE_TO_BITS(curve);
  pk_algo = GNUTLS_PK_EC;
  if ((ec = gnutls_privkey_init(&priv)) != GNUTLS_E_SUCCESS)
    return print_error(ec);
  ec = gnutls_privkey_generate(priv, pk_algo, bits, 0);
  if (ec != GNUTLS_E_SUCCESS) {
    gnutls_privkey_deinit(priv);
    return print_error(ec);
  }

This gives me

ERROR: The curve is unsupported

on gnutls_privkey_generate. I am completely at loss why this happens?

libgnutls-dev: 3.4.10-4ubuntu1

Regards,
Aki

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Gnutls-help mailing list
[email protected]
http://lists.gnupg.org/mailman/listinfo/gnutls-help

Reply via email to