1 .\" Copyright (c) 2022 Kungliga Tekniska Högskolan
2 .\" (Royal Institute of Technology, Stockholm, Sweden).
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
16 .\" 3. Neither the name of the Institute nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 .Nd PKIX command-line utility
49 is a utility for making certificate sigining requests (CSRs),
50 displaying CSRs, signing certificates, etc.
51 are given, then the value will be parsed and displayed using just
52 the self-describing nature of DER.
54 All sub-commands have their own help message, shown when invoked
62 .Bl -tag -width Ds -offset indent
66 Verify a certificate and its certification path up to a trust
67 anchor, possibly checking CRLs.
69 Prints a human-readable rendering of certificates in a store.
71 .Sx CERTIFICATE STORES.
73 Validate a certificate (but not a full chain).
74 .It certificate-copy, cc
75 Copy ceritificates and possibly private keys from one store to
78 .Sx CERTIFICATE STORES.
80 Fetch an OCSP response.
82 Fetch an OCSP response chain.
84 Prints a human-readable rendering of an OCSP response chain.
86 Prints a human-readable rendering of a CRL or OCSP response
89 Generates a private key.
91 Generates a Certificate Signing Request (CSR).
93 Prints a human-readable rendering of a CSR.
95 Queries a certificate store.
97 Prints information about supported algorithms.
99 Outputs entropy using a random number generator.
101 Tests if a cryptographic algorithm is available.
103 Selects a supported cryptographic algorithm given a peer's
106 Hex-encode/decode utility.
107 .It certificate-sign, cert-sign, issue-certificate, ca
111 .It cms-create-sd, cms-sign
112 Created a CMS SignedData.
114 Verifies a CMS SignedData.
116 Extracts enveloped data from a CMS SignedData.
118 Creates an enveloped CMS SignedData.
120 Other sub-commands reported by the
122 sub-command are not stable or fully supported at this time.
123 .Sh CERTIFICATE STORES
124 Stores of certificates and/or keys have string names that can be
127 commands as well as in various configuration parameters and
128 command-line arguments of Heimdal's Kerberos implementation (for
132 .Ql FILE:/path/to/file ,
133 .Ql PEM-FILE:/path/to/file ,
134 .Ql DER-FILE:/path/to/file ,
136 See below for a full list of store types.
138 A certificate store name starts with a store TYPE followed by a
139 colon followed by a name of form specific to that store type.
141 Private keys can be stored in the same stores as the certificates
142 that certify their public keys.
144 Private keys can also be stored in separate files, but still be
145 referenced in one certificate store name by joining two with a
147 .Ql FILE:/path/to/certificate,/path/to/private/key
150 Heimdal supports a variety of certificate and private key store
152 .Bl -tag -width Ds -offset indent
154 If writing, PEM will be written (private keys may be written in
155 algorithm-specific formats or in PKCS#8).
156 If reading, PEM will be expected (private keys may be in
157 algorithm-specific formats or in PKCS#8).
159 If writing, DER will be written.
160 If reading, DER will be expected.
161 Private keys will be in algorithm-specific formats.
163 If writing, PEM will be written as if
166 If reading, PEM or DER will be detected and read as if
172 If writing, PKCS#12 will be written.
173 If reading, PKCS#12 will be expected.
174 Note that PKCS#12 support is currently very limited.
176 OpenSSL-style hashed directory of trust anchors.
177 .It KEYCHAIN:system-anchors
178 On OS X this refers to the system's trust anchors.
179 .It KEYCHAIN:FILE:/path
180 On OS X this refers to an OS X keychain at the given path.
181 .It PKCS11:/path/to/shared/object[,slot=NUMBER]
182 Loads the given PKCS#11 provider object and uses the token at the
183 given slot number, or else the first token found.
187 An in-memory only, ephemeral store, usually never used in
190 The MEMORY store name exists primarily for internal
197 command to copy certificates from one store to another.
198 This is useful for, e.g., converting DER files to PEM or
199 vice-versa, removing private keys, adding certificate chains,
200 and removing root certificates from chains.
202 You can validate a certificate with the
204 sub-command, or verify a certificate and its certification path
209 You can display a certificate using the
218 .Bl -tag -width Ds -offset indent
222 .It Fl Fl pass=password
228 option is for PKCS#8 (PEM), PKCS#12 and PKCS#11 stores, and if
229 needed and not given, will be prompted for.
230 Note that it's not secure to pass passwords as command-line
231 arguments on multi-tenant systems.
235 option prints the certificate(s) in the given
237 as a JSON dump of their DER using an experimental (i.e.,
242 sub-command will generate a key.
243 .Sh CERTIFICATE SIGNING REQUESTS
246 sub-command will create a CSR, and has support for requesting
247 subject alternative names and extended key usage extensions.
256 sub-command will display a CSR.
257 .Sh CERTIFICATE ISSUANCE / CERTIFICATION AUTHORITY
260 sub-command will issue a certificate.
261 See its usage message.
262 .Sh ONLINE CERTIFICATE STATUS PROTOCOL
265 sub-command will fetch OCSP Responses for the given
270 sub-command will verify OCSP Responses.
274 sub-command will display OCSP Responses.
275 .Sh CERTIFICATE REVOCATION LIST
278 sub-command will add certificates to a certificate revocation
282 .Bd -literal -offset indent
283 hxtool generate-key --type=rsa --key-bits=4096 PEM-FILE:key.pem
286 Create a CSR (with an empty name) for some key:
287 .Bd -literal -offset indent
288 hxtool request-create --subject= --key=FILE:key.pem csr.der
291 Generate a key and create a CSR (with an empty name) for it:
292 .Bd -literal -offset indent
293 hxtool request-create \\
295 --generate-key=rsa \\
297 --key=FILE:key.pem \\
301 Generate a key and create a CSR with an empty name but also
302 requesting a specific dNSName subject alternative name (SAN) for
304 .Bd -literal -offset indent
305 hxtool request-create \\
307 --generate-key=rsa \\
308 --dnsname=foo.test.h5l.se \\
309 --key=FILE:key.pem \\
314 .Bd -literal -offset indent
315 hxtool request-print csr.der
318 .Bd -literal -offset indent
320 PKCS#10 CertificationRequest:
322 san: dNSName: foo.test.h5l.se
325 Issue a end-entity certificate for an HTTPS server given a CSR:
326 .Bd -literal -offset indent
327 hxtool issue-certificate \\
328 --type=https-server \\
330 --hostname=foo.test.h5l.se \\
331 --ca-certificate=FILE:cacert.pem \\
332 --ca-private-key=FILE:cakey.pem \\
333 --req=PKCS10:csr.der \\
334 --certificate=PEM-FILE:ee.pem
337 Add a chain to a PEM file:
338 .Bd -literal -offset indent
339 hxtool copy-certificiate \\
342 FILE:ca.pem FILE:ee.pem
345 Create a self-signed end-entity certificate for an HTTPS server:
346 .Bd -literal -offset indent
347 hxtool issue-certificate \\
349 --type=https-server \\
351 --hostname=foo.test.h5l.se \\
352 --ca-private-key=FILE:key.pem \\
353 --certificate-private-key=FILE:key.pem \\
354 --certificate=PEM-FILE:cert.pem
357 Create a root certification authority certificate:
358 .Bd -literal -offset indent
359 hxtool issue-certificate \\
362 --subject=CN=SomeRootCA \\
363 --ca-private-key=FILE:rootkey.pem \\
364 --certificate=PEM-FILE:rootcert.pem
367 Create an intermediate certification authority certificate from a
369 .Bd -literal -offset indent
370 hxtool issue-certificate \\
371 --type=https-server \\
372 --subject=CN=SomeIntermediateCA \\
373 --ca-certificate=FILE:parent-cert.pem \\
374 --ca-private-key=FILE:parent-key.pem \\
375 --req=PKCS10:csr.der \\
376 --certificate=PEM-FILE:intermediate.pem