2017-02-21 58 views
1

使用openssl,我試圖用2048模數生成具有Diffie-Hellman的共享參數。openssl參數和密鑰生成的基本使用

我相信我能做到這一點是這樣的:openssl dhparam -C 2048

但是,我想完成整個算法和我在這裏以下的教程: https://sandilands.info/sgordon/diffie-hellman-secret-key-exchange-with-openssl

本教程中,我相信使用線路: openssl genpkey -genparam -algorithm DH -out dhp.pem生成相同的東西,但沒有使用2048模數(我可能在這裏是錯的)。

如何我使用dhparam代替genpkey融入這個教程,這樣我可以選擇2048,模我怎麼在這裏選擇的genpkey模是我從根本上誤解的東西嗎?

+0

是否加入'-pkeyopt:dh_paramgen_prime_len:2048'到'genpkey'變種不是你期待什麼? – garethTheRed

+0

Stack Overflow是編程和開發問題的網站。這個問題似乎與題目無關,因爲它不涉及編程或開發。請參閱幫助中心的[我可以詢問哪些主題](http://stackoverflow.com/help/on-topic)。也許[超級用戶](http://superuser.com/)或[Unix&Linux堆棧交換](http://unix.stackexchange.com/)會是一個更好的地方。另請參閱[我在哪裏發佈有關Dev Ops的問題?](http://meta.stackexchange.com/q/134306) – jww

回答

3

genpkeyopenssl的通用密鑰生成實用程序。

dhparam致力於diffie-hellman。

兩者都可用於相同的目的。在你背景下,你將不得不使用任何

openssl genpkey -genparam -algorithm DH -pkeyopt dh_paramgen_prime_len:2048 

openssl dhparam 2048