2 Support for EC keypair operation missing form public libcrypto API
8 Creates EC keypair from the just secret key and curve name
10 @param curve - name of elliptic curve
11 @param num - long number representing key
13 p=libcrypto.EVP_PKEY_new()
14 ec=libcrypto.EC_KEY_new_by_curvename(curve.nid)
15 group=libcrypto.EC_KEY_get0_group(ec)
16 EC_KEY_set_private_key(ec,bn)
17 priv_key=libcrypt.BN_new()
20 libcrypto.BN_hex2bn(byref(priv_key),h)
21 libcrypto.EC_KEY_set_private_key(ec,priv_key)
22 pub_key=libcrypto.EC_POINT_new(group)
23 libcrypto.EC_POINT_mul(group,pub_key,priv_key,None,None,ctx)
25 libcrypto.EVP_PKEY_set1_EC_KEY(p,ec)
26 libcrypto.EC_KEY_free(ec)
27 return PKey(ptr=p,cansign=True)
30 libcrypto.EVP_PKEY_new.restype=c_void_p
31 libcrypto.BN_new.restype=c_void_p
32 libcrypto.BN_hex2bn.argtypes(POINTER(c_void_p),c_char_p)
33 libcrypto.EC_KEY_set_private_key