1IPSEC_RSASIGKEY(8) Executable programs IPSEC_RSASIGKEY(8)
2
3
4
6 ipsec_rsasigkey - generate RSA signature key
7
9 ipsec rsasigkey [--verbose] [--seeddev device] [--seed numbits]
10 [--nssdir nssdir] [--password nsspassword] [--hostname hostname]
11 [nbits]
12
14 rsasigkey generates an RSA public/private key pair, suitable for
15 digital signatures, of (exactly) nbits bits (that is, two primes each
16 of exactly nbits/2 bits, and related numbers) and emits it on standard
17 output as ASCII (mostly hex) data. nbits must be a multiple of 16.
18
19 The public exponent is forced to the value 3, which has important speed
20 advantages for signature checking. Beware that the resulting keys have
21 known weaknesses as encryption keys and should not be used for that
22 purpose.
23
24 The --verbose option makes rsasigkey give a running commentary on
25 standard error. By default, it works in silence until it is ready to
26 generate output.
27
28 The --seeddev option specifies a source for random bits used to seed
29 the crypto library's RNG. The default is /dev/random (see random(4)).
30 FreeS/WAN and Openswan without NSS support used this option to specify
31 the random source used to directly create keys. Libreswan only uses it
32 to seed the NSS crypto libraries RNG. Under Linux with hardware random
33 support, special devices might show up as /dev/*rng* devices. However,
34 these should never be accessed directly using this option, as hardware
35 failures could lead to extremely non-random values (streams of zeroes
36 have been observed in the wild)
37
38 The --seedbits option specifies how many seed bits are pulled from the
39 random device to seed the NSS PRNG. The default of 480bit comes from
40 FIPS requirements. Seed bits are rounded up to a multiple of 8.
41
42 The use of a different random device or a reduction of seedbits from
43 the default value is prevented when the system is running in FIPS mode.
44
45 The --nssdir option specifies the directory to use for the nss
46 database. This is the directory where the NSS certificate, key and
47 security modules databases reside. The default value is /etc/ipsec.d.
48
49 The --password option specifies the nss cryptographic module
50 authentication password if the NSS module has been configured to
51 require it. A password is required by hardware tokens and also by the
52 internal software token module when configured to run in FIPS mode. If
53 the argument is /etc/ipsec.d/nsspassword, the password comes from that
54 file; otherwise argument is the password.
55
56 The --hostname option specifies what host name to use in the first line
57 of the output (see below); the default is what gethostname(2) returns.
58
59 The output format looks like this (with long numbers trimmed down for
60 clarity):
61
62
63 # RSA 3744 bits road.toad.com Mon Apr 17 22:20:35 2017
64 # for signatures only, UNSAFE FOR ENCRYPTION
65 #ckaid=a953473e6014dd4e08eb051e4679dc39be160fea
66 #pubkey=0sBAEAA...sKbTzwE=
67 Modulus: 0xb84ae7d...b0a6d3cf01
68 PublicExponent: 0x010001
69
70
71
72 The first (comment) line, indicating the nature and date of the key,
73 and giving a host name, is used by ipsec_showhostkey(8) when generating
74 some forms of key output.
75
76 The commented-out pubkey= line contains the public key, the public
77 exponent and the modulus combined in approximately RFC 2537 format (the
78 one deviation is that the combined value is given with a 0s prefix,
79 rather than in unadorned base-64), suitable for use in the ipsec.conf
80 file.
81
82 The Modulus, PublicExponent and PrivateExponent lines give the basic
83 signing and verification data.
84
85 The Prime1 and Prime2 lines give the primes themselves (aka p and q),
86 largest first. The Exponent1 and Exponent2 lines give the private
87 exponent mod p-1 and q-1 respectively. The Coefficient line gives the
88 Chinese Remainder Theorem coefficient, which is the inverse of q, mod
89 p. These additional numbers (which must all be kept as secret as the
90 private exponent) are precomputed aids to rapid signature generation.
91 When NSS is used, these values are not available outside the NSS
92 security database (software token or hardware token) and are instead
93 filled in with the CKA_ID.
94
95 No attempt is made to break long lines.
96
97 The US patent on the RSA algorithm expired 20 Sept 2000.
98
100 ipsec rsasigkey --verbose 4096 >mykey.txt
101 generates a 4096-bit signature key and puts it in the file
102 mykey.txt, with running commentary on standard error. The file
103 contents can be inserted verbatim into a suitable entry in the
104 ipsec.secrets file (see ipsec_secrets(5)), and the public key can
105 then be extracted and edited into the ipsec.conf (see
106 ipsec_showhostkey(8)).
107
109 /dev/random, /dev/urandom
110
112 random(4), rngd(8), ipsec_showhostkey(8), Applied Cryptography, 2nd.
113 ed., by Bruce Schneier, Wiley 1996, RFCs 2537, 2313, GNU MP, the GNU
114 multiple precision arithmetic library, edition 2.0.2, by Torbj Granlund
115
117 Originally written for the Linux FreeS/WAN project
118 <http://www.freeswan.org> by Henry Spencer. Updated for the Libreswan
119 Project by Paul Wouters.
120
121 The --round and --noopt options were obsoleted as these were only used
122 with the old non-library crypto code
123
124 The --random device is only used for seeding the crypto library, not
125 for direct random to generate keys
126
128 There is an internal limit on nbits, currently 20000.
129
130 rsasigkey's run time is difficult to predict, since /dev/random output
131 can be arbitrarily delayed if the system's entropy pool is low on
132 randomness, and the time taken by the search for primes is also
133 somewhat unpredictable. Specifically, embedded systems and most virtual
134 machines are low on entropy. In such a situation, consider generating
135 the RSA key on another machine, and copying ipsec.secrets and the
136 /etc/ipsec.d directory tree to the embedded platform. Note that NSS
137 embeds the full path in the DB files, so the path on proxy machine must
138 be identical to the path on the destination machine.
139
141 Paul Wouters
142 placeholder to suppress warning
143
144
145
146libreswan 05/14/2019 IPSEC_RSASIGKEY(8)