]> git.ipfire.org Git - thirdparty/openssh-portable.git/blame - moduli.5
upstream: Factor out PuTTY setup.
[thirdparty/openssh-portable.git] / moduli.5
CommitLineData
53f4aff6 1.\" $OpenBSD: moduli.5,v 1.19 2022/04/16 04:30:10 dtucker Exp $
60dcc625
DM
2.\"
3.\" Copyright (c) 2008 Damien Miller <djm@mindrot.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
53f4aff6 16.Dd $Mdocdate: April 16 2022 $
60dcc625
DM
17.Dt MODULI 5
18.Os
19.Sh NAME
20.Nm moduli
f279474f 21.Nd Diffie-Hellman moduli
60dcc625
DM
22.Sh DESCRIPTION
23The
24.Pa /etc/moduli
578451dd 25file contains prime numbers and generators for use by
60dcc625
DM
26.Xr sshd 8
27in the Diffie-Hellman Group Exchange key exchange method.
28.Pp
29New moduli may be generated with
30.Xr ssh-keygen 1
31using a two-step process.
32An initial
33.Em candidate generation
578451dd 34pass, using
53f4aff6 35.Ic ssh-keygen -M generate ,
60dcc625
DM
36calculates numbers that are likely to be useful.
37A second
38.Em primality testing
39pass, using
53f4aff6 40.Ic ssh-keygen -M screen ,
60dcc625 41provides a high degree of assurance that the numbers are prime and are
f279474f 42safe for use in Diffie-Hellman operations by
60dcc625
DM
43.Xr sshd 8 .
44This
45.Nm
46format is used as the output from each pass.
47.Pp
48The file consists of newline-separated records, one per modulus,
578451dd 49containing seven space-separated fields.
60dcc625 50These fields are as follows:
60dcc625
DM
51.Bl -tag -width Description -offset indent
52.It timestamp
53The time that the modulus was last processed as YYYYMMDDHHMMSS.
54.It type
55Decimal number specifying the internal structure of the prime modulus.
56Supported types are:
57.Pp
58.Bl -tag -width 0x00 -compact
59.It 0
578451dd 60Unknown, not tested.
60dcc625
DM
61.It 2
62"Safe" prime; (p-1)/2 is also prime.
63.It 4
d5c3d4c0 64Sophie Germain; 2p+1 is also prime.
60dcc625
DM
65.El
66.Pp
67Moduli candidates initially produced by
68.Xr ssh-keygen 1
69are Sophie Germain primes (type 4).
578451dd 70Further primality testing with
60dcc625
DM
71.Xr ssh-keygen 1
72produces safe prime moduli (type 2) that are ready for use in
73.Xr sshd 8 .
74Other types are not used by OpenSSH.
75.It tests
76Decimal number indicating the type of primality tests that the number
77has been subjected to represented as a bitmask of the following values:
78.Pp
79.Bl -tag -width 0x00 -compact
80.It 0x00
578451dd 81Not tested.
60dcc625 82.It 0x01
578451dd 83Composite number \(en not prime.
60dcc625 84.It 0x02
578451dd 85Sieve of Eratosthenes.
60dcc625 86.It 0x04
91e6b577 87Probabilistic Miller-Rabin primality tests.
60dcc625
DM
88.El
89.Pp
90The
91.Xr ssh-keygen 1
92moduli candidate generation uses the Sieve of Eratosthenes (flag 0x02).
93Subsequent
94.Xr ssh-keygen 1
95primality tests are Miller-Rabin tests (flag 0x04).
96.It trials
578451dd
DT
97Decimal number indicating the number of primality trials
98that have been performed on the modulus.
60dcc625
DM
99.It size
100Decimal number indicating the size of the prime in bits.
101.It generator
102The recommended generator for use with this modulus (hexadecimal).
103.It modulus
104The modulus itself in hexadecimal.
105.El
106.Pp
f279474f 107When performing Diffie-Hellman Group Exchange,
60dcc625
DM
108.Xr sshd 8
109first estimates the size of the modulus required to produce enough
f279474f 110Diffie-Hellman output to sufficiently key the selected symmetric cipher.
60dcc625
DM
111.Xr sshd 8
112then randomly selects a modulus from
113.Fa /etc/moduli
114that best meets the size requirement.
60dcc625
DM
115.Sh SEE ALSO
116.Xr ssh-keygen 1 ,
578451dd 117.Xr sshd 8
0120c41d 118.Sh STANDARDS
60dcc625 119.Rs
0120c41d
DM
120.%A M. Friedl
121.%A N. Provos
122.%A W. Simpson
123.%D March 2006
60dcc625 124.%R RFC 4419
0120c41d 125.%T Diffie-Hellman Group Exchange for the Secure Shell (SSH) Transport Layer Protocol
60dcc625 126.Re