熟悉OPENSSL的请进
时间:2010-07-25
来源:互联网
本帖最后由 huxk 于 2010-07-26 09:25 编辑
现在我要使用 DES_ncbc_encrypt 加密报文,密钥需要动态生成
开始使用 DES_random_key 这个函数 这个函数可用 而且也不会报 weak key
但看到OPENSSL作者的注释【见下面】 我使用
复制代码
函数来产生KEY 但 DES_set_key_checked 函数检查时报weak key
有人这样搞过么?或者大家动态生成DES密钥用什么算法好?不吝赐教。
复制代码
This function takes str and converts it into a DES key.
I would recommend using MD5 instead and use the first 8 bytes of output.When I wrote the first version of these routines back in 1990, MD5 did not exist but I feel these routines are still sound. This
routines is compatible with the one in MIT's libdes.
复制代码
This routine sets a starting point for des_random_key().
复制代码
Make sure to 'seed' the random number generator (with des_random_seed()) before using this function.
I personally now use a MD5 based random number system.
现在我要使用 DES_ncbc_encrypt 加密报文,密钥需要动态生成
开始使用 DES_random_key 这个函数 这个函数可用 而且也不会报 weak key
但看到OPENSSL作者的注释【见下面】 我使用
- void des_key_gen(const char *str,DES_cblock *deskey)
- {
- unsigned char b[16] = {0};
- unsigned char *out = &(*deskey)[0];
- MD5(str,strlen(str),b);
- memcpy(out,b,8);
- }
有人这样搞过么?或者大家动态生成DES密钥用什么算法好?不吝赐教。
- void des_string_to_key( char *str, des_cblock *key);
I would recommend using MD5 instead and use the first 8 bytes of output.When I wrote the first version of these routines back in 1990, MD5 did not exist but I feel these routines are still sound. This
routines is compatible with the one in MIT's libdes.
- void des_random_seed( des_cblock key);
- void des_random_key( des_cblock ret); This function return a random key.
I personally now use a MD5 based random number system.
作者: huxk 发布时间: 2010-07-25
好帖子应该顶一下,进来支持楼主。
作者: suavelee 发布时间: 2010-07-26
有人吗?呼叫 ....................
作者: huxk 发布时间: 2010-07-26
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28