DH
wildcard001
。。。
展开
-
使用 openssl 实现 DH 算法及其中间人攻击
生成 DH 密钥对//! \param prime. DH 的 prime.//! \param gen. DH 的 gen.//! \param dh. 返回数据.//! \return. 成功与否.int generate_dh_key(const char *prime, const char *gen, DH *dh) { BIGNUM *p = BN_new(); BIGNUM *g = BN_new(); BN_hex2bn(&p, prime); BN_hex.原创 2021-06-07 23:33:55 · 1973 阅读 · 0 评论 -
使用 openssl DH_compute_key() 函数计算 DH 密钥长度不对的问题
最近在使用 DH_compute_key() 函数计算 DH 共享密钥时,发现计算得出的密钥长度少了一位,导致后续所有数据都出现了错误,最终导致程序崩溃。查看 openssl 官方文档 发现以下内容:DH_compute_key() computes the DH_compute_key() computes the shared secret from the private DH value in dh and the other party's public value in pub_key an原创 2021-06-14 22:13:34 · 1309 阅读 · 1 评论