From c50a9a6562a14f3a9fbd2071e3b19eed8c9c9b4b Mon Sep 17 00:00:00 2001 From: Hans Nilsson Date: Wed, 21 Oct 2015 17:25:42 +0200 Subject: ssh, public_key: random selection of diffie-hellman moduli Also tool (public_key:gen_moduli_hrl) to convert an openssh moduli file to erlang format. --- lib/public_key/doc/src/public_key.xml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'lib/public_key/doc') diff --git a/lib/public_key/doc/src/public_key.xml b/lib/public_key/doc/src/public_key.xml index b247618efc..7f68138497 100644 --- a/lib/public_key/doc/src/public_key.xml +++ b/lib/public_key/doc/src/public_key.xml @@ -299,6 +299,37 @@ + + dh_gex_group(MinSize, SuggestedSize, MaxSize, Groups) -> {ok, {Size,Group}} | {error,Error} + Selects a group for Diffie-Hellman key exchange + + MinSize = positive_integer() + SuggestedSize = positive_integer() + MaxSize = positive_integer() + Groups = undefined | [{Size,[{G,P}]}] + Size = positive_integer() + Group = {G,P} + G = positive_integer() + P = positive_integer() + + +

Selects a group for Diffie-Hellman key exchange with the key size in the range MinSize...MaxSize + and as close to SuggestedSize as possible. If Groups == undefined a default set will be + used, otherwise the group is selected from Groups.

+

First is a size as close as possible to SuggestedSize selected. Then is one group with that key size + randomly selected from the list. If no size within the limits of MinSize and MaxSize is + available, {error,no_group_found} is returned.

+

The default list is in lib/public_key/priv/ssh_moduli. The format is as produced by the openssh tool + ssh-keygen -G followed by ssh-keygen -T. When that list is changed, make should be run in + lib/public_key to make it available for dh_gex_group/4.

+ +

If you change the default ssh_moduli file, be sure to run ssh-keygen -T as described + in the ssh-keygen manual. Failure to do so correctly will compromise the security of applications + relying on this function.

+
+
+
+ encrypt_private(PlainText, Key) -> binary() Public-key encryption using the private key. -- cgit v1.2.3