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 The first (comment) line, indicating the nature and date of the key,
72 and giving a host name, is used by ipsec_showhostkey(8) when generating
73 some forms of key output.
74
75 The commented-out pubkey= line contains the public key, the public
76 exponent and the modulus combined in approximately RFC 2537 format (the
77 one deviation is that the combined value is given with a 0s prefix,
78 rather than in unadorned base-64), suitable for use in the ipsec.conf
79 file.
80
81 The Modulus, PublicExponent and PrivateExponent lines give the basic
82 signing and verification data.
83
84 The Prime1 and Prime2 lines give the primes themselves (aka p and q),
85 largest first. The Exponent1 and Exponent2 lines give the private
86 exponent mod p-1 and q-1 respectively. The Coefficient line gives the
87 Chinese Remainder Theorem coefficient, which is the inverse of q, mod
88 p. These additional numbers (which must all be kept as secret as the
89 private exponent) are precomputed aids to rapid signature generation.
90 When NSS is used, these values are not available outside the NSS
91 security database (software token or hardware token) and are instead
92 filled in with the CKA_ID.
93
94 No attempt is made to break long lines.
95
96 The US patent on the RSA algorithm expired 20 Sept 2000.
97
99 ipsec rsasigkey --verbose 4096 >mykey.txt
100 generates a 4096-bit signature key and puts it in the file
101 mykey.txt, with running commentary on standard error. The file
102 contents can be inserted verbatim into a suitable entry in the
103 ipsec.secrets file (see ipsec_secrets(5)), and the public key can
104 then be extracted and edited into the ipsec.conf (see
105 ipsec_showhostkey(8)).
106
108 /dev/random, /dev/urandom
109
111 random(4), rngd(8), ipsec_showhostkey(8), Applied Cryptography, 2nd.
112 ed., by Bruce Schneier, Wiley 1996, RFCs 2537, 2313, GNU MP, the GNU
113 multiple precision arithmetic library, edition 2.0.2, by Torbj Granlund
114
116 Originally written for the Linux FreeS/WAN project
117 <http://www.freeswan.org> by Henry Spencer. Updated for the Libreswan
118 Project by Paul Wouters.
119
120 The --round and --noopt options were obsoleted as these were only used
121 with the old non-library crypto code
122
123 The --random device is only used for seeding the crypto library, not
124 for direct random to generate keys
125
127 There is an internal limit on nbits, currently 20000.
128
129 rsasigkey's run time is difficult to predict, since /dev/random output
130 can be arbitrarily delayed if the system's entropy pool is low on
131 randomness, and the time taken by the search for primes is also
132 somewhat unpredictable. Specifically, embedded systems and most virtual
133 machines are low on entropy. In such a situation, consider generating
134 the RSA key on another machine, and copying ipsec.secrets and the
135 /etc/ipsec.d directory tree to the embedded platform. Note that NSS
136 embeds the full path in the DB files, so the path on proxy machine must
137 be identical to the path on the destination machine.
138
140 Paul Wouters
141 placeholder to suppress warning
142
143
144
145libreswan 02/01/2019 IPSEC_RSASIGKEY(8)