亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 3601 | 回復: 4
打印 上一主題 下一主題

熟悉OPENSSL的請進 [復制鏈接]

論壇徽章:
0
跳轉到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2010-07-25 15:04 |只看該作者 |倒序瀏覽
本帖最后由 huxk 于 2010-07-26 09:25 編輯

現(xiàn)在我要使用 DES_ncbc_encrypt 加密報文,密鑰需要動態(tài)生成
開始使用 DES_random_key 這個函數(shù) 這個函數(shù)可用 而且也不會報 weak key

但看到OPENSSL作者的注釋【見下面】 我使用
  1. void des_key_gen(const char *str,DES_cblock *deskey)
  2.         {
  3.         unsigned char        b[16] = {0};
  4.         unsigned char *out = &(*deskey)[0];
  5.         MD5(str,strlen(str),b);
  6.         memcpy(out,b,8);
  7.         }
復制代碼
函數(shù)來產生KEY    但 DES_set_key_checked 函數(shù)檢查時報weak key

有人這樣搞過么?或者大家動態(tài)生成DES密鑰用什么算法好?不吝賜教。
  1. void des_string_to_key( char *str, des_cblock *key);
復制代碼
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.
  1. void des_random_seed( des_cblock key);
復制代碼
This routine sets a starting point for des_random_key().
  1. void des_random_key( des_cblock ret); This function return a 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.

論壇徽章:
0
2 [報告]
發(fā)表于 2010-07-26 08:55 |只看該作者
提示: 作者被禁止或刪除 內容自動屏蔽

論壇徽章:
0
3 [報告]
發(fā)表于 2010-07-26 09:26 |只看該作者
有人嗎?呼叫 ....................

論壇徽章:
0
4 [報告]
發(fā)表于 2010-07-26 12:36 |只看該作者
1。自己生成密鑰,然后調用des_set_key_unchecked

2;蛘哂肞BE方式(PKCS#5)根據(jù)一個密碼產生任意長度得密鑰

論壇徽章:
0
5 [報告]
發(fā)表于 2010-11-15 10:04 |只看該作者
幫頂...
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復

  

北京盛拓優(yōu)訊信息技術有限公司. 版權所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關心和支持過ChinaUnix的朋友們 轉載本站內容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP