OpenSSL API

来源:互联网 发布:现任淘宝网总裁是谁 编辑:程序博客网 时间:2024/05/20 11:34
EC_GROUP *EC_GROUP_new(const EC_METHOD *meth);EC_GROUP *EC_GROUP_new_from_ecparameters(const ECPARAMETERS *params);EC_GROUP *EC_GROUP_new_from_ecpkparameters(const ECPKPARAMETERS *params);void EC_GROUP_free(EC_GROUP *group);void EC_GROUP_clear_free(EC_GROUP *group);size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems);EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);EC_GROUP *EC_GROUP_new_by_curve_name(int nid);ECPARAMETERS *EC_GROUP_get_ecparameters(const EC_GROUP *group, ECPARAMETERS *params)ECPKPARAMETERS *EC_GROUP_get_ecpkparameters(const EC_GROUP *group, ECPKPARAMETERS *params)int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx);int EC_GROUP_have_precompute_mult(const EC_GROUP *group);
int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);>设置曲线参数p,a,b>成功返回1,失败返回0
int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx);>获得曲线参数>成功返回1,失败返回0
int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);>设置曲线参数p,a,b>成功返回1,失败返回0
int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx);>获得曲线参数>成功返回1,失败返回0
int EC_POINT_add(const EC_POINT *group, EC_POINT *r, EC_POINT *a, EC_POINT *b, BN_CTX *ctx);>计算r=a+b。>成功返回1,失败返回0
int EC_POINT_dbl(const EC_POINT *group, EC_POINT *r, EC_POINT *a, BN_CTX *ctx);>计算r=a+a。>成功返回1,失败返回0
int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx);>计算a=(a的逆)。>成功返回1,失败返回0
int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *p);>测试p是否为无限远点>返回1位无限远点,返回0则不是
int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx);>测试点point是否在椭圆曲线上、>返回1则位于椭圆曲线上,返回0则否,-1失败
int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx);>比较a,b是否相等>相等返回0,不相等返回1,失败返回-1
int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, const EC_POINT *q, const BIGNUM *m, BN_CTX *ctx);>计算r=generator\*n+q*m,n可以为空,即r=q\*m>成功返回1,失败返回0
int EC_POINTS_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, size_t num, const EC_POINT *p[], const BIGNUM *m[], BN_CTX *ctx);>同上>成功返回1,失败返回0
int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx);>point仿射
int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], BN_CTX *ctx);>points放射
int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *p, const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx);>设置素数域上坐标
int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, const EC_POINT *p, BIGNUM *x, BIGNUM *y, BN_CTX *ctx);>获得素数域上坐标
int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group,  EC_POINT *p, const BIGNUM *x, int y_bit, BN_CTX *ctx);>素数域椭圆曲线,给定压缩坐标和y_bit参数,设置point的几何坐标;用于将Octet-String转化为椭圆曲线上的点
int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p, const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx);>设置二进制域上坐标
int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group, const EC_POINT *p, BIGNUM *x, BIGNUM *y, BN_CTX *ctx);>获得二进制域上坐标
int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p, const BIGNUM *x, int y_bit, BN_CTX *ctx);>二进制域椭圆曲线,给定压缩坐标和y_bit参数,设置point的几何坐标;用于将Octet-String转化为椭圆曲线上的点
int EC_GROUP_get_degree(const EC_GROUP *group);>得到域的阶。对于素数域会得到p的bit数,对于二进制域F2^m,会得到m。
int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, const BIGNUM *order, const BIGNUM *cofactor);>设置椭圆曲线参数基G。
const BIGNUM *EC_KEY_get0_private_key(const EC_KEY *key);>获取EC_KEY的私钥
int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *prv);>设置EC_KEY的私钥
const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key);>获取EC_KEY公钥
int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub);>设置EC_KEY公钥
BIGNUM *EC_POINT_point2bn(const EC_GROUP *group, const EC_POINT *p, point_conversion_form_t form, BIGNUM *bn, BN_CTX *ctx);>将椭圆曲线上的点转化为大数,其中from为压缩方式,可以是POINT_CONVERSION_COMPRESSED、POINT_CONVERSION_UNCOMPRESSED或POINT_CONVERSION_HYBRID,可参考x9.62
char *EC_POINT_point2hex(const EC_GROUP *group, const EC_POINT *p, point_conversion_form_t form, BN_CTX *ctx);>将椭圆曲线上的点转化为字符串,其中from为压缩方式,可以是POINT_CONVERSION_COMPRESSED、POINT_CONVERSION_UNCOMPRESSED或POINT_CONVERSION_HYBRID,可参考x9.62
0 0