* on key type. Supported key types:
* - #YACA_KEY_TYPE_RSA_PRIV,
* - #YACA_KEY_TYPE_DSA_PRIV,
- * - #YACA_KEY_TYPE_ECDSA_PRIV.
+ * - #YACA_KEY_TYPE_EC_PRIV.
*
* @return 0 on success, negative on error.
* @see #yaca_key_type_e, #yaca_digest_algo_e, yaca_sign_update(),
* key type. Supported key types:
* - #YACA_KEY_TYPE_RSA_PUB,
* - #YACA_KEY_TYPE_DSA_PUB,
- * - #YACA_KEY_TYPE_ECDSA_PUB.
+ * - #YACA_KEY_TYPE_EC_PUB.
*
* @return 0 on success, negative on error.
* @see #yaca_key_type_e, #yaca_digest_algo_e, yaca_verify_update(),
* deduced based on key type. Supported key types:
* - #YACA_KEY_TYPE_RSA_PRIV,
* - #YACA_KEY_TYPE_DSA_PRIV,
- * - #YACA_KEY_TYPE_ECDSA_PRIV.
+ * - #YACA_KEY_TYPE_EC_PRIV.
* @param[in] data Data to be signed.
* @param[in] data_len Length of the data.
* @param[out] signature Message signature. Will be allocated by the
* deduced based on key type. Supported key types:
* - #YACA_KEY_TYPE_RSA_PUB,
* - #YACA_KEY_TYPE_DSA_PUB,
- * - #YACA_KEY_TYPE_ECDSA_PUB.
+ * - #YACA_KEY_TYPE_EC_PUB.
* @param[in] data Signed data.
* @param[in] data_len Length of the data.
* @param[in] signature Message signature.
YACA_KEY_TYPE_DH_PUB, /**< Diffie-Hellman public key */
YACA_KEY_TYPE_DH_PRIV, /**< Diffie-Hellman private key */
- YACA_KEY_TYPE_ECDSA_PUB, /**< Elliptic Curve Digital Signature Algorithm public key */
- YACA_KEY_TYPE_ECDSA_PRIV, /**< Elliptic Curve Digital Signature Algorithm private key */
+ YACA_KEY_TYPE_EC_PUB, /**< Elliptic Curve public key (for DSA and DH) */
- // TODO: ECDH might not exist as a separate key type, remove?
- YACA_KEY_TYPE_ECDH_PUB, /**< Elliptic Curve Diffie-Hellman public key */
- YACA_KEY_TYPE_ECDH_PRIV, /**< Elliptic Curve Diffie-Hellman private key */
+ YACA_KEY_TYPE_EC_PRIV, /**< Elliptic Curve private key (for DSA and DH) */
} yaca_key_type_e;
/**
long size;
// generate private, public key
- ret = yaca_key_gen(&private_key, YACA_KEY_TYPE_ECDH_PRIV, YACA_KEY_CURVE_P256);
+ ret = yaca_key_gen(&private_key, YACA_KEY_TYPE_EC_PRIV, YACA_KEY_CURVE_P256);
if (ret < 0)
goto clean;
if (1 != fread(buffer, size, 1, fp))
goto clean;
- ret = yaca_key_import(&peer_key, YACA_KEY_TYPE_ECDH_PUB, NULL, buffer, size);
+ ret = yaca_key_import(&peer_key, YACA_KEY_TYPE_EC_PUB, NULL, buffer, size);
if (ret < 0)
goto clean;
break;
case EVP_PKEY_EC:
- type = private ? YACA_KEY_TYPE_ECDSA_PRIV : YACA_KEY_TYPE_ECDSA_PUB;
+ type = private ? YACA_KEY_TYPE_EC_PRIV : YACA_KEY_TYPE_EC_PUB;
break;
default:
case YACA_KEY_TYPE_DH_PRIV:
case YACA_KEY_TYPE_DH_PUB:
- case YACA_KEY_TYPE_ECDSA_PRIV:
- case YACA_KEY_TYPE_ECDSA_PUB:
- case YACA_KEY_TYPE_ECDH_PRIV:
- case YACA_KEY_TYPE_ECDH_PUB:
+ case YACA_KEY_TYPE_EC_PRIV:
+ case YACA_KEY_TYPE_EC_PUB:
ret = YACA_ERROR_NOT_IMPLEMENTED;
goto free_bio;
case YACA_KEY_TYPE_DH_PRIV:
case YACA_KEY_TYPE_DH_PUB:
- case YACA_KEY_TYPE_ECDSA_PRIV:
- case YACA_KEY_TYPE_ECDSA_PUB:
- case YACA_KEY_TYPE_ECDH_PRIV:
- case YACA_KEY_TYPE_ECDH_PUB:
+ case YACA_KEY_TYPE_EC_PRIV:
+ case YACA_KEY_TYPE_EC_PUB:
ret = YACA_ERROR_NOT_IMPLEMENTED;
goto free_bio;
return import_evp(key, key_type, data, data_len);
case YACA_KEY_TYPE_DH_PUB:
case YACA_KEY_TYPE_DH_PRIV:
- case YACA_KEY_TYPE_ECDSA_PUB:
- case YACA_KEY_TYPE_ECDSA_PRIV:
- case YACA_KEY_TYPE_ECDH_PUB:
- case YACA_KEY_TYPE_ECDH_PRIV:
+ case YACA_KEY_TYPE_EC_PUB:
+ case YACA_KEY_TYPE_EC_PRIV:
return YACA_ERROR_NOT_IMPLEMENTED;
default:
return YACA_ERROR_INVALID_ARGUMENT;
return 0;
case YACA_KEY_TYPE_DH_PRIV:
- case YACA_KEY_TYPE_ECDSA_PRIV:
- case YACA_KEY_TYPE_ECDH_PRIV:
+ case YACA_KEY_TYPE_EC_PRIV:
return YACA_ERROR_NOT_IMPLEMENTED;
default:
return YACA_ERROR_INVALID_ARGUMENT;
case YACA_KEY_TYPE_DSA_PRIV:
(*pub_key)->type = YACA_KEY_TYPE_DSA_PUB;
break;
- case YACA_KEY_TYPE_ECDSA_PRIV:
- (*pub_key)->type = YACA_KEY_TYPE_ECDSA_PUB;
+ case YACA_KEY_TYPE_EC_PRIV:
+ (*pub_key)->type = YACA_KEY_TYPE_EC_PUB;
break;
default:
ret = YACA_ERROR_INVALID_ARGUMENT;
case YACA_KEY_TYPE_DSA_PRIV:
nc->op_type = OP_SIGN;
break;
- case YACA_KEY_TYPE_ECDSA_PRIV:
+ case YACA_KEY_TYPE_EC_PRIV:
ret = YACA_ERROR_NOT_IMPLEMENTED;
goto free_ctx;
default:
case YACA_KEY_TYPE_DSA_PUB:
nc->op_type = OP_VERIFY_ASYMMETRIC;
break;
- case YACA_KEY_TYPE_ECDSA_PUB:
+ case YACA_KEY_TYPE_EC_PUB:
ret = YACA_ERROR_NOT_IMPLEMENTED;
goto free_ctx;
default: