761
* gnutls_pubkey_get_pk_ecc_x962:
762
* @key: Holds the public key
763
* @parameters: DER encoding of an ANSI X9.62 parameters
764
* @ecpoint: DER encoding of ANSI X9.62 ECPoint
766
* This function will export the ECC public key's parameters found in
767
* the given certificate. The new parameters will be allocated using
768
* gnutls_malloc() and will be stored in the appropriate datum.
770
* Returns: %GNUTLS_E_SUCCESS on success, otherwise a negative error code.
774
int gnutls_pubkey_get_pk_ecc_x962 (gnutls_pubkey_t key, gnutls_datum_t* parameters,
775
gnutls_datum_t * ecpoint)
779
if (key == NULL || key->pk_algorithm != GNUTLS_PK_ECC)
780
return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST);
782
ret = _gnutls_x509_write_ecc_pubkey(&key->params, ecpoint);
784
return gnutls_assert_val(ret);
786
ret = _gnutls_x509_write_ecc_params(&key->params, parameters);
789
_gnutls_free_datum(ecpoint);
790
return gnutls_assert_val(ret);
756
797
* gnutls_pubkey_import:
757
798
* @key: The structure to store the parsed public key.
758
799
* @data: The DER or PEM encoded certificate.
1104
* gnutls_pubkey_import_ecc_raw:
1105
* @key: The structure to store the parsed key
1106
* @curve: holds the curve
1110
* This function will convert the given elliptic curve parameters to a
1111
* #gnutls_pubkey_t. The output will be stored in @key.
1113
* Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise a
1114
* negative error value.
1119
gnutls_pubkey_import_ecc_raw (gnutls_pubkey_t key,
1120
gnutls_ecc_curve_t curve,
1121
const gnutls_datum_t * x,
1122
const gnutls_datum_t * y)
1129
return GNUTLS_E_INVALID_REQUEST;
1132
key->params.flags = curve;
1134
ret = _gnutls_ecc_curve_fill_params(curve, &key->params);
1136
return gnutls_assert_val(ret);
1138
if (_gnutls_mpi_scan_nz (&key->params.params[5], x->data, x->size))
1141
ret = GNUTLS_E_MPI_SCAN_FAILED;
1144
key->params.params_nr++;
1146
if (_gnutls_mpi_scan_nz (&key->params.params[6], y->data, y->size))
1149
ret = GNUTLS_E_MPI_SCAN_FAILED;
1152
key->params.params_nr++;
1153
key->pk_algorithm = GNUTLS_PK_ECC;
1158
gnutls_pk_params_release(&key->params);
1163
* gnutls_pubkey_import_ecc_x962:
1164
* @key: The structure to store the parsed key
1165
* @parameters: DER encoding of an ANSI X9.62 parameters
1166
* @ecpoint: DER encoding of ANSI X9.62 ECPoint
1168
* This function will convert the given elliptic curve parameters to a
1169
* #gnutls_pubkey_t. The output will be stored in @key.
1171
* Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise a
1172
* negative error value.
1177
gnutls_pubkey_import_ecc_x962 (gnutls_pubkey_t key,
1178
const gnutls_datum_t * parameters,
1179
const gnutls_datum_t * ecpoint)
1186
return GNUTLS_E_INVALID_REQUEST;
1189
key->params.params_nr = 0;
1191
ret = _gnutls_x509_read_ecc_params(parameters->data, parameters->size,
1199
ret = _gnutls_ecc_ansi_x963_import(ecpoint->data, ecpoint->size,
1200
&key->params.params[5], &key->params.params[6]);
1206
key->params.params_nr+=2;
1207
key->pk_algorithm = GNUTLS_PK_ECC;
1212
gnutls_pk_params_release(&key->params);
1063
1217
* gnutls_pubkey_import_dsa_raw:
1064
1218
* @key: The structure to store the parsed key
1065
1219
* @p: holds the p