diff options
Diffstat (limited to 'src/usr.sbin/openssl')
| -rw-r--r-- | src/usr.sbin/openssl/Makefile | 39 | ||||
| -rw-r--r-- | src/usr.sbin/openssl/openssl.1 | 8404 |
2 files changed, 8443 insertions, 0 deletions
diff --git a/src/usr.sbin/openssl/Makefile b/src/usr.sbin/openssl/Makefile new file mode 100644 index 0000000000..9ebadfaa10 --- /dev/null +++ b/src/usr.sbin/openssl/Makefile | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.18 2008/09/06 12:21:52 djm Exp $ | ||
| 2 | |||
| 3 | PROG= openssl | ||
| 4 | LDADD= -lssl -lcrypto | ||
| 5 | MAN1= openssl.1 | ||
| 6 | |||
| 7 | SSLEAYDIST= lib/libssl/src | ||
| 8 | |||
| 9 | SSLEAY_SRC= ${.CURDIR}/../../${SSLEAYDIST}/apps | ||
| 10 | SSLEAY_SRC_TOP= ${.CURDIR}/../../${SSLEAYDIST} | ||
| 11 | |||
| 12 | .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "vax" || \ | ||
| 13 | ${MACHINE_ARCH} == "amd64" | ||
| 14 | |||
| 15 | CFLAGS+= -DL_ENDIAN | ||
| 16 | .else | ||
| 17 | .if ${MACHINE_ARCH} == "alpha" | ||
| 18 | # no ENDIAN stuff defined for alpha | ||
| 19 | .else | ||
| 20 | CFLAGS+= -DB_ENDIAN | ||
| 21 | .endif | ||
| 22 | .endif | ||
| 23 | |||
| 24 | CFLAGS+= -DMONOLITH -DOPENSSL_NO_IDEA -DTERMIOS -DANSI_SOURCE -DOPENSSL_NO_RC5 | ||
| 25 | CFLAGS+= -DOPENSSL_NO_MDC2 | ||
| 26 | CFLAGS+= -I${SSLEAY_SRC_TOP} | ||
| 27 | |||
| 28 | SRCS= verify.c asn1pars.c req.c dgst.c dh.c enc.c passwd.c gendh.c errstr.c\ | ||
| 29 | pkcs7.c crl2p7.c crl.c ca.c \ | ||
| 30 | rsa.c dsa.c dsaparam.c \ | ||
| 31 | x509.c genrsa.c gendsa.c s_server.c s_client.c speed.c \ | ||
| 32 | s_time.c apps.c s_cb.c s_socket.c version.c sess_id.c \ | ||
| 33 | app_rand.c ciphers.c nseq.c pkcs12.c pkcs8.c spkac.c smime.c \ | ||
| 34 | dhparam.c openssl.c rand.c rsautl.c engine.c ocsp.c prime.c \ | ||
| 35 | cms.c ec.c ecparam.c | ||
| 36 | |||
| 37 | .PATH: ${SSLEAY_SRC} | ||
| 38 | |||
| 39 | .include <bsd.prog.mk> | ||
diff --git a/src/usr.sbin/openssl/openssl.1 b/src/usr.sbin/openssl/openssl.1 new file mode 100644 index 0000000000..a6929eacbd --- /dev/null +++ b/src/usr.sbin/openssl/openssl.1 | |||
| @@ -0,0 +1,8404 @@ | |||
| 1 | .\" $OpenBSD: openssl.1,v 1.62 2008/11/03 14:49:23 jmc Exp $ | ||
| 2 | .\" ==================================================================== | ||
| 3 | .\" Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. | ||
| 4 | .\" | ||
| 5 | .\" Redistribution and use in source and binary forms, with or without | ||
| 6 | .\" modification, are permitted provided that the following conditions | ||
| 7 | .\" are met: | ||
| 8 | .\" | ||
| 9 | .\" 1. Redistributions of source code must retain the above copyright | ||
| 10 | .\" notice, this list of conditions and the following disclaimer. | ||
| 11 | .\" | ||
| 12 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
| 13 | .\" notice, this list of conditions and the following disclaimer in | ||
| 14 | .\" the documentation and/or other materials provided with the | ||
| 15 | .\" distribution. | ||
| 16 | .\" | ||
| 17 | .\" 3. All advertising materials mentioning features or use of this | ||
| 18 | .\" software must display the following acknowledgment: | ||
| 19 | .\" "This product includes software developed by the OpenSSL Project | ||
| 20 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 21 | .\" | ||
| 22 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 23 | .\" endorse or promote products derived from this software without | ||
| 24 | .\" prior written permission. For written permission, please contact | ||
| 25 | .\" openssl-core@openssl.org. | ||
| 26 | .\" | ||
| 27 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
| 28 | .\" nor may "OpenSSL" appear in their names without prior written | ||
| 29 | .\" permission of the OpenSSL Project. | ||
| 30 | .\" | ||
| 31 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
| 32 | .\" acknowledgment: | ||
| 33 | .\" "This product includes software developed by the OpenSSL Project | ||
| 34 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 35 | .\" | ||
| 36 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 37 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 38 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 39 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 40 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 41 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 42 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 43 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 44 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 45 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 46 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 47 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 48 | .\" ==================================================================== | ||
| 49 | .\" | ||
| 50 | .\" This product includes cryptographic software written by Eric Young | ||
| 51 | .\" (eay@cryptsoft.com). This product includes software written by Tim | ||
| 52 | .\" Hudson (tjh@cryptsoft.com). | ||
| 53 | .\" | ||
| 54 | .\" | ||
| 55 | .\" Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 56 | .\" All rights reserved. | ||
| 57 | .\" | ||
| 58 | .\" This package is an SSL implementation written | ||
| 59 | .\" by Eric Young (eay@cryptsoft.com). | ||
| 60 | .\" The implementation was written so as to conform with Netscapes SSL. | ||
| 61 | .\" | ||
| 62 | .\" This library is free for commercial and non-commercial use as long as | ||
| 63 | .\" the following conditions are aheared to. The following conditions | ||
| 64 | .\" apply to all code found in this distribution, be it the RC4, RSA, | ||
| 65 | .\" lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 66 | .\" included with this distribution is covered by the same copyright terms | ||
| 67 | .\" except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 68 | .\" | ||
| 69 | .\" Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 70 | .\" the code are not to be removed. | ||
| 71 | .\" If this package is used in a product, Eric Young should be given attribution | ||
| 72 | .\" as the author of the parts of the library used. | ||
| 73 | .\" This can be in the form of a textual message at program startup or | ||
| 74 | .\" in documentation (online or textual) provided with the package. | ||
| 75 | .\" | ||
| 76 | .\" Redistribution and use in source and binary forms, with or without | ||
| 77 | .\" modification, are permitted provided that the following conditions | ||
| 78 | .\" are met: | ||
| 79 | .\" 1. Redistributions of source code must retain the copyright | ||
| 80 | .\" notice, this list of conditions and the following disclaimer. | ||
| 81 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
| 82 | .\" notice, this list of conditions and the following disclaimer in the | ||
| 83 | .\" documentation and/or other materials provided with the distribution. | ||
| 84 | .\" 3. All advertising materials mentioning features or use of this software | ||
| 85 | .\" must display the following acknowledgement: | ||
| 86 | .\" "This product includes cryptographic software written by | ||
| 87 | .\" Eric Young (eay@cryptsoft.com)" | ||
| 88 | .\" The word 'cryptographic' can be left out if the rouines from the library | ||
| 89 | .\" being used are not cryptographic related :-). | ||
| 90 | .\" 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 91 | .\" the apps directory (application code) you must include an | ||
| 92 | .\" acknowledgement: | ||
| 93 | .\" "This product includes software written by Tim Hudson | ||
| 94 | .\" (tjh@cryptsoft.com)" | ||
| 95 | .\" | ||
| 96 | .\" THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 97 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 98 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 99 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 100 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 101 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 102 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 103 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 104 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 105 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 106 | .\" SUCH DAMAGE. | ||
| 107 | .\" | ||
| 108 | .\" The licence and distribution terms for any publically available version or | ||
| 109 | .\" derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 110 | .\" copied and put under another distribution licence | ||
| 111 | .\" [including the GNU Public Licence.] | ||
| 112 | .\" | ||
| 113 | .\" OPENSSL | ||
| 114 | .\" | ||
| 115 | .Dd $Mdocdate: November 3 2008 $ | ||
| 116 | .Dt OPENSSL 1 | ||
| 117 | .Os | ||
| 118 | .Sh NAME | ||
| 119 | .Nm openssl | ||
| 120 | .Nd OpenSSL command line tool | ||
| 121 | .Sh SYNOPSIS | ||
| 122 | .Nm | ||
| 123 | .Cm command | ||
| 124 | .Op Ar command_opts | ||
| 125 | .Op Ar command_args | ||
| 126 | .Pp | ||
| 127 | .Nm | ||
| 128 | .Oo Cm list-standard-commands No |\ \& | ||
| 129 | .Cm list-message-digest-commands | | ||
| 130 | .Cm list-cipher-commands | ||
| 131 | .Oc | ||
| 132 | .Pp | ||
| 133 | .Nm | ||
| 134 | .Cm no- Ns Ar XXX | ||
| 135 | .Op Ar arbitrary options | ||
| 136 | .Sh DESCRIPTION | ||
| 137 | .Nm OpenSSL | ||
| 138 | is a cryptography toolkit implementing the Secure Sockets Layer | ||
| 139 | .Pq SSL v2/v3 | ||
| 140 | and Transport Layer Security | ||
| 141 | .Pq TLS v1 | ||
| 142 | network protocols and related cryptography standards required by them. | ||
| 143 | .Pp | ||
| 144 | The | ||
| 145 | .Nm | ||
| 146 | program is a command line tool for using the various | ||
| 147 | cryptography functions of | ||
| 148 | .Nm OpenSSL Ns Li 's | ||
| 149 | .Em crypto | ||
| 150 | library from the shell. | ||
| 151 | It can be used for | ||
| 152 | .Pp | ||
| 153 | .Bl -bullet -offset indent -compact | ||
| 154 | .It | ||
| 155 | Creation of RSA, DH and DSA key parameters | ||
| 156 | .It | ||
| 157 | Creation of X.509 certificates, CSRs and CRLs | ||
| 158 | .It | ||
| 159 | Calculation of Message Digests | ||
| 160 | .It | ||
| 161 | Encryption and Decryption with Ciphers | ||
| 162 | .It | ||
| 163 | SSL/TLS Client and Server Tests | ||
| 164 | .It | ||
| 165 | Handling of S/MIME signed or encrypted mail | ||
| 166 | .El | ||
| 167 | .Sh COMMAND SUMMARY | ||
| 168 | The | ||
| 169 | .Nm | ||
| 170 | program provides a rich variety of commands | ||
| 171 | .Pf ( Cm command | ||
| 172 | in the | ||
| 173 | .Sx SYNOPSIS | ||
| 174 | above), | ||
| 175 | each of which often has a wealth of options and arguments | ||
| 176 | .Pf ( Ar command_opts | ||
| 177 | and | ||
| 178 | .Ar command_args | ||
| 179 | in the | ||
| 180 | .Sx SYNOPSIS ) . | ||
| 181 | .Pp | ||
| 182 | The pseudo-commands | ||
| 183 | .Cm list-standard-commands , list-message-digest-commands , | ||
| 184 | and | ||
| 185 | .Cm list-cipher-commands | ||
| 186 | output a list | ||
| 187 | .Pq one entry per line | ||
| 188 | of the names of all standard commands, message digest commands, | ||
| 189 | or cipher commands, respectively, that are available in the present | ||
| 190 | .Nm | ||
| 191 | utility. | ||
| 192 | .Pp | ||
| 193 | The pseudo-command | ||
| 194 | .Cm no- Ns Ar XXX | ||
| 195 | tests whether a command of the | ||
| 196 | specified name is available. | ||
| 197 | If no command named | ||
| 198 | .Ar XXX | ||
| 199 | exists, | ||
| 200 | it returns 0 | ||
| 201 | .Pq success | ||
| 202 | and prints | ||
| 203 | .Cm no- Ns Ar XXX ; | ||
| 204 | otherwise it returns 1 and prints | ||
| 205 | .Ar XXX . | ||
| 206 | In both cases, the output goes to | ||
| 207 | .Em stdout | ||
| 208 | and nothing is printed to | ||
| 209 | .Em stderr . | ||
| 210 | Additional command line arguments are always ignored. | ||
| 211 | Since for each cipher there is a command of the same name, | ||
| 212 | this provides an easy way for shell scripts to test for the | ||
| 213 | availability of ciphers in the | ||
| 214 | .Nm | ||
| 215 | program. | ||
| 216 | .Pp | ||
| 217 | .Sy Note : | ||
| 218 | .Cm no- Ns Ar XXX | ||
| 219 | is not able to detect pseudo-commands such as | ||
| 220 | .Cm quit , | ||
| 221 | .Cm list- Ns Ar ... Ns Cm -commands , | ||
| 222 | or | ||
| 223 | .Cm no- Ns Ar XXX | ||
| 224 | itself. | ||
| 225 | .Sh STANDARD COMMANDS | ||
| 226 | .Bl -tag -width "asn1parse" | ||
| 227 | .It Cm asn1parse | ||
| 228 | Parse an ASN.1 sequence. | ||
| 229 | .It Cm ca | ||
| 230 | Certificate Authority | ||
| 231 | .Pq CA | ||
| 232 | Management. | ||
| 233 | .It Cm ciphers | ||
| 234 | Cipher Suite Description Determination. | ||
| 235 | .It Cm crl | ||
| 236 | Certificate Revocation List | ||
| 237 | .Pq CRL | ||
| 238 | Management. | ||
| 239 | .It Cm crl2pkcs7 | ||
| 240 | CRL to PKCS#7 Conversion. | ||
| 241 | .It Cm dgst | ||
| 242 | Message Digest Calculation. | ||
| 243 | .It Cm dh | ||
| 244 | Diffie-Hellman Parameter Management. | ||
| 245 | Obsoleted by | ||
| 246 | .Cm dhparam . | ||
| 247 | .It Cm dhparam | ||
| 248 | Generation and Management of Diffie-Hellman Parameters. | ||
| 249 | .It Cm dsa | ||
| 250 | DSA Data Management. | ||
| 251 | .It Cm dsaparam | ||
| 252 | DSA Parameter Generation. | ||
| 253 | .It Cm enc | ||
| 254 | Encoding with Ciphers. | ||
| 255 | .It Cm errstr | ||
| 256 | Error Number to Error String Conversion. | ||
| 257 | .It Cm gendh | ||
| 258 | Generation of Diffie-Hellman Parameters. | ||
| 259 | Obsoleted by | ||
| 260 | .Cm dhparam . | ||
| 261 | .It Cm gendsa | ||
| 262 | Generation of DSA Parameters. | ||
| 263 | .It Cm genrsa | ||
| 264 | Generation of RSA Parameters. | ||
| 265 | .It Cm nseq | ||
| 266 | Create or examine a Netscape certificate sequence. | ||
| 267 | .It Cm ocsp | ||
| 268 | Online Certificate Status Protocol utility. | ||
| 269 | .It Cm passwd | ||
| 270 | Generation of hashed passwords. | ||
| 271 | .It Cm pkcs7 | ||
| 272 | PKCS#7 Data Management. | ||
| 273 | .It Cm pkcs8 | ||
| 274 | PKCS#8 Data Management. | ||
| 275 | .It Cm pkcs12 | ||
| 276 | PKCS#12 Data Management. | ||
| 277 | .It Cm rand | ||
| 278 | Generate pseudo-random bytes. | ||
| 279 | .It Cm req | ||
| 280 | X.509 Certificate Signing Request | ||
| 281 | .Pq CSR | ||
| 282 | Management. | ||
| 283 | .It Cm rsa | ||
| 284 | RSA Data Management. | ||
| 285 | .It Cm rsautl | ||
| 286 | RSA utility for signing, verification, encryption, and decryption. | ||
| 287 | .It Cm s_client | ||
| 288 | This implements a generic SSL/TLS client which can establish a transparent | ||
| 289 | connection to a remote server speaking SSL/TLS. | ||
| 290 | It's intended for testing purposes only and provides only rudimentary | ||
| 291 | interface functionality but internally uses mostly all functionality of the | ||
| 292 | .Nm OpenSSL | ||
| 293 | .Em ssl | ||
| 294 | library. | ||
| 295 | .It Cm s_server | ||
| 296 | This implements a generic SSL/TLS server which accepts connections from remote | ||
| 297 | clients speaking SSL/TLS. | ||
| 298 | It's intended for testing purposes only and provides only rudimentary | ||
| 299 | interface functionality but internally uses mostly all functionality of the | ||
| 300 | .Nm OpenSSL | ||
| 301 | .Em ssl | ||
| 302 | library. | ||
| 303 | It provides both an own command line oriented protocol for testing | ||
| 304 | SSL functions and a simple HTTP response | ||
| 305 | facility to emulate an SSL/TLS-aware webserver. | ||
| 306 | .It Cm s_time | ||
| 307 | SSL Connection Timer. | ||
| 308 | .It Cm sess_id | ||
| 309 | SSL Session Data Management. | ||
| 310 | .It Cm smime | ||
| 311 | S/MIME mail processing. | ||
| 312 | .It Cm speed | ||
| 313 | Algorithm Speed Measurement. | ||
| 314 | .It Cm spkac | ||
| 315 | SPKAC printing and generating utility. | ||
| 316 | .It Cm verify | ||
| 317 | X.509 Certificate Verification. | ||
| 318 | .It Cm version | ||
| 319 | .Nm OpenSSL | ||
| 320 | Version Information. | ||
| 321 | .It Cm x509 | ||
| 322 | X.509 Certificate Data Management. | ||
| 323 | .El | ||
| 324 | .Sh MESSAGE DIGEST COMMANDS | ||
| 325 | .Bl -tag -width "asn1parse" | ||
| 326 | .It Cm md2 | ||
| 327 | MD2 Digest. | ||
| 328 | .It Cm md4 | ||
| 329 | MD4 Digest. | ||
| 330 | .It Cm md5 | ||
| 331 | MD5 Digest. | ||
| 332 | .It Cm ripemd160 | ||
| 333 | RIPEMD-160 Digest. | ||
| 334 | .It Cm sha | ||
| 335 | SHA Digest. | ||
| 336 | .It Cm sha1 | ||
| 337 | SHA-1 Digest. | ||
| 338 | .El | ||
| 339 | .Sh ENCODING AND CIPHER COMMANDS | ||
| 340 | .Bl -tag -width Ds -compact | ||
| 341 | .It Cm aes-128-cbc | aes-128-ecb | aes-192-cbc | aes-192-ecb | ||
| 342 | .It Cm aes-256-cbc | aes-256-ecb | ||
| 343 | AES Cipher. | ||
| 344 | .Pp | ||
| 345 | .It Cm base64 | ||
| 346 | Base64 Encoding. | ||
| 347 | .Pp | ||
| 348 | .It Xo | ||
| 349 | .Cm bf | bf-cbc | bf-cfb | | ||
| 350 | .Cm bf-ecb | bf-ofb | ||
| 351 | .Xc | ||
| 352 | Blowfish Cipher. | ||
| 353 | .Pp | ||
| 354 | .It Cm cast | cast-cbc | ||
| 355 | CAST Cipher. | ||
| 356 | .Pp | ||
| 357 | .It Cm cast5-cbc | cast5-cfb | cast5-ecb | cast5-ofb | ||
| 358 | CAST5 Cipher. | ||
| 359 | .Pp | ||
| 360 | .It Xo | ||
| 361 | .Cm des | des-cbc | des-cfb | des-ecb | | ||
| 362 | .Cm des-ede | des-ede-cbc | ||
| 363 | .Xc | ||
| 364 | .It Cm des-ede-cfb | des-ede-ofb | des-ofb | ||
| 365 | DES Cipher. | ||
| 366 | .Pp | ||
| 367 | .It Xo | ||
| 368 | .Cm des3 | desx | des-ede3 | | ||
| 369 | .Cm des-ede3-cbc | des-ede3-cfb | des-ede3-ofb | ||
| 370 | .Xc | ||
| 371 | Triple DES Cipher. | ||
| 372 | .Pp | ||
| 373 | .It Xo | ||
| 374 | .Cm rc2 | rc2-40-cbc | rc2-64-cbc | rc2-cbc | | ||
| 375 | .Cm rc2-cfb | rc2-ecb | rc2-ofb | ||
| 376 | .Xc | ||
| 377 | RC2 Cipher. | ||
| 378 | .Pp | ||
| 379 | .It Cm rc4 | rc4-40 | ||
| 380 | RC4 Cipher. | ||
| 381 | .El | ||
| 382 | .Sh PASS PHRASE ARGUMENTS | ||
| 383 | Several commands accept password arguments, typically using | ||
| 384 | .Fl passin | ||
| 385 | and | ||
| 386 | .Fl passout | ||
| 387 | for input and output passwords, respectively. | ||
| 388 | These allow the password to be obtained from a variety of sources. | ||
| 389 | Both of these options take a single argument whose format is described below. | ||
| 390 | If no password argument is given and a password is required, | ||
| 391 | then the user is prompted to enter one: | ||
| 392 | this will typically be read from the current terminal with echoing turned off. | ||
| 393 | .Bl -tag -width "fd:number" | ||
| 394 | .It Ar pass : Ns Ar password | ||
| 395 | The actual password is | ||
| 396 | .Ar password . | ||
| 397 | Since the password is visible to utilities | ||
| 398 | (like | ||
| 399 | .Xr ps 1 | ||
| 400 | under | ||
| 401 | .Ux ) | ||
| 402 | this form should only be used where security is not important. | ||
| 403 | .It Ar env : Ns Ar var | ||
| 404 | Obtain the password from the environment variable | ||
| 405 | .Ar var . | ||
| 406 | Since the environment of other processes is visible on certain platforms | ||
| 407 | (e.g.\& | ||
| 408 | .Xr ps 1 | ||
| 409 | under certain | ||
| 410 | .Ux | ||
| 411 | OSes) this option should be used with caution. | ||
| 412 | .It Ar file : Ns Ar path | ||
| 413 | The first line of | ||
| 414 | .Ar path | ||
| 415 | is the password. | ||
| 416 | If the same | ||
| 417 | .Ar path | ||
| 418 | argument is supplied to | ||
| 419 | .Fl passin | ||
| 420 | and | ||
| 421 | .Fl passout , | ||
| 422 | then the first line will be used for the input password and the next line | ||
| 423 | for the output password. | ||
| 424 | .Ar path | ||
| 425 | need not refer to a regular file: | ||
| 426 | it could, for example, refer to a device or named pipe. | ||
| 427 | .It Ar fd : Ns Ar number | ||
| 428 | Read the password from the file descriptor | ||
| 429 | .Ar number . | ||
| 430 | This can be used to send the data via a pipe for example. | ||
| 431 | .It Ar stdin | ||
| 432 | Read the password from standard input. | ||
| 433 | .El | ||
| 434 | .\" | ||
| 435 | .\" ASN1PARSE | ||
| 436 | .\" | ||
| 437 | .Sh ASN1PARSE | ||
| 438 | .Nm openssl asn1parse | ||
| 439 | .Bk -words | ||
| 440 | .Op Fl dump | ||
| 441 | .Op Fl i | ||
| 442 | .Op Fl noout | ||
| 443 | .Op Fl dlimit Ar number | ||
| 444 | .Op Fl in Ar file | ||
| 445 | .Op Fl inform Ar DER | PEM | TXT | ||
| 446 | .Op Fl length Ar number | ||
| 447 | .Op Fl offset Ar number | ||
| 448 | .Op Fl oid Ar file | ||
| 449 | .Op Fl out Ar file | ||
| 450 | .Op Fl strparse Ar offset | ||
| 451 | .Ek | ||
| 452 | .Pp | ||
| 453 | The | ||
| 454 | .Nm asn1parse | ||
| 455 | command is a diagnostic utility that can parse ASN.1 structures. | ||
| 456 | It can also be used to extract data from ASN.1 formatted data. | ||
| 457 | .Pp | ||
| 458 | The options are as follows: | ||
| 459 | .Bl -tag -width "-noout" | ||
| 460 | .It Fl dlimit Ar number | ||
| 461 | Dump the first | ||
| 462 | .Ar number | ||
| 463 | bytes of unknown data in hex form. | ||
| 464 | .It Fl dump | ||
| 465 | Dump unknown data in hex form. | ||
| 466 | .It Fl i | ||
| 467 | Indents the output according to the | ||
| 468 | .Qq depth | ||
| 469 | of the structures. | ||
| 470 | .It Fl in Ar file | ||
| 471 | The input file; default is standard input. | ||
| 472 | .It Fl inform Ar DER | PEM | TXT | ||
| 473 | The input format. | ||
| 474 | .Ar DER | ||
| 475 | .Pq Distinguished Encoding Rules | ||
| 476 | is binary format and | ||
| 477 | .Ar PEM | ||
| 478 | .Pq Privacy Enhanced Mail , | ||
| 479 | the default, is base64-encoded. | ||
| 480 | .Ar TXT | ||
| 481 | is plain text. | ||
| 482 | .It Fl length Ar number | ||
| 483 | Number of bytes to parse; default is until end of file. | ||
| 484 | .It Fl noout | ||
| 485 | Don't output the parsed version of the input file. | ||
| 486 | .It Fl offset Ar number | ||
| 487 | Starting offset to begin parsing; default is start of file. | ||
| 488 | .It Fl oid Ar file | ||
| 489 | A file containing additional object identifiers | ||
| 490 | .Pq OIDs . | ||
| 491 | The format of this file is described in the | ||
| 492 | .Sx ASN1PARSE NOTES | ||
| 493 | section below. | ||
| 494 | .It Fl out Ar file | ||
| 495 | Output file to place the DER-encoded data into. | ||
| 496 | If this option is not present, no encoded data will be output. | ||
| 497 | This is most useful when combined with the | ||
| 498 | .Fl strparse | ||
| 499 | option. | ||
| 500 | .It Fl strparse Ar offset | ||
| 501 | Parse the content octets of the ASN.1 object starting at | ||
| 502 | .Ar offset . | ||
| 503 | This option can be used multiple times to | ||
| 504 | .Qq drill down | ||
| 505 | into a nested structure. | ||
| 506 | .El | ||
| 507 | .Sh ASN1PARSE OUTPUT | ||
| 508 | The output will typically contain lines like this: | ||
| 509 | .Bd -literal -offset 2n | ||
| 510 | 0:d=0 hl=4 l= 681 cons: SEQUENCE | ||
| 511 | |||
| 512 | \&..... | ||
| 513 | |||
| 514 | 229:d=3 hl=3 l= 141 prim: BIT STRING | ||
| 515 | 373:d=2 hl=3 l= 162 cons: cont [ 3 ] | ||
| 516 | 376:d=3 hl=3 l= 159 cons: SEQUENCE | ||
| 517 | 379:d=4 hl=2 l= 29 cons: SEQUENCE | ||
| 518 | 381:d=5 hl=2 l= 3 prim: OBJECT :X509v3 Subject Key Identifier | ||
| 519 | 386:d=5 hl=2 l= 22 prim: OCTET STRING | ||
| 520 | 410:d=4 hl=2 l= 112 cons: SEQUENCE | ||
| 521 | 412:d=5 hl=2 l= 3 prim: OBJECT :X509v3 Authority Key Identifier | ||
| 522 | 417:d=5 hl=2 l= 105 prim: OCTET STRING | ||
| 523 | 524:d=4 hl=2 l= 12 cons: SEQUENCE | ||
| 524 | |||
| 525 | \&..... | ||
| 526 | .Ed | ||
| 527 | .Pp | ||
| 528 | This example is part of a self-signed certificate. | ||
| 529 | Each line starts with the offset in decimal. | ||
| 530 | .Cm d=XX | ||
| 531 | specifies the current depth. | ||
| 532 | The depth is increased within the scope of any SET or SEQUENCE. | ||
| 533 | .Cm hl=XX | ||
| 534 | gives the header length | ||
| 535 | .Pq tag and length octets | ||
| 536 | of the current type. | ||
| 537 | .Cm l=XX | ||
| 538 | gives the length of the content octets. | ||
| 539 | .Pp | ||
| 540 | The | ||
| 541 | .Fl i | ||
| 542 | option can be used to make the output more readable. | ||
| 543 | .Pp | ||
| 544 | Some knowledge of the ASN.1 structure is needed to interpret the output. | ||
| 545 | .Pp | ||
| 546 | In this example, the BIT STRING at offset 229 is the certificate public key. | ||
| 547 | The content octets of this will contain the public key information. | ||
| 548 | This can be examined using the option | ||
| 549 | .Fl strparse Cm 229 | ||
| 550 | to yield: | ||
| 551 | .Bd -literal | ||
| 552 | 0:d=0 hl=3 l= 137 cons: SEQUENCE | ||
| 553 | 3:d=1 hl=3 l= 129 prim: INTEGER :E5D21E1F5C8D208EA7A2166C7FA | ||
| 554 | F9F6BDF2059669C60876DDB70840F1A5AAFA59699FE471F379F1DD6A487E7D5409AB6A88D4A | ||
| 555 | 9746E24B91D8CF55DB3521015460C8EDE44EE8A4189F7A7BE77D6CD3A9AF2696F486855CF58 | ||
| 556 | BF0EDF2B4068058C7A947F52548DDF7E15E96B385F86422BEA9064A3EE9 | ||
| 557 | 135:d=1 hl=2 l= 3 prim: INTEGER :010001 | ||
| 558 | .Ed | ||
| 559 | .Sh ASN1PARSE NOTES | ||
| 560 | If an OID | ||
| 561 | .Pq object identifier | ||
| 562 | is not part of | ||
| 563 | .Nm OpenSSL Ns Li 's | ||
| 564 | internal table it will be represented in | ||
| 565 | numerical form | ||
| 566 | .Pq for example 1.2.3.4 . | ||
| 567 | The file passed to the | ||
| 568 | .Fl oid | ||
| 569 | option allows additional OIDs to be included. | ||
| 570 | Each line consists of three columns: | ||
| 571 | the first column is the OID in numerical format and should be followed by | ||
| 572 | whitespace. | ||
| 573 | The second column is the | ||
| 574 | .Qq short name | ||
| 575 | which is a single word followed by whitespace. | ||
| 576 | The final column is the rest of the line and is the | ||
| 577 | .Qq long name . | ||
| 578 | .Nm asn1parse | ||
| 579 | displays the long name. | ||
| 580 | Example: | ||
| 581 | .Pp | ||
| 582 | .Dl \&"1.2.3.4 shortname A long name\&" | ||
| 583 | .Sh ASN1 EXAMPLES | ||
| 584 | Parse a file: | ||
| 585 | .Pp | ||
| 586 | .Dl $ openssl asn1parse -in file.pem | ||
| 587 | .Pp | ||
| 588 | Parse a DER file: | ||
| 589 | .Pp | ||
| 590 | .Dl $ openssl asn1parse -inform DER -in file.der | ||
| 591 | .Sh ASN1PARSE BUGS | ||
| 592 | There should be options to change the format of output lines. | ||
| 593 | The output of some ASN.1 types is not well handled | ||
| 594 | .Pq if at all . | ||
| 595 | .\" | ||
| 596 | .\" CA | ||
| 597 | .\" | ||
| 598 | .Sh CA | ||
| 599 | .Nm openssl ca | ||
| 600 | .Bk -words | ||
| 601 | .Op Fl batch | ||
| 602 | .Op Fl gencrl | ||
| 603 | .Op Fl infiles | ||
| 604 | .Op Fl msie_hack | ||
| 605 | .Op Fl noemailDN | ||
| 606 | .Op Fl notext | ||
| 607 | .Op Fl preserveDN | ||
| 608 | .Op Fl updatedb | ||
| 609 | .Op Fl verbose | ||
| 610 | .Op Fl cert Ar file | ||
| 611 | .Op Fl config Ar file | ||
| 612 | .Op Fl crl_CA_compromise Ar time | ||
| 613 | .Op Fl crl_compromise Ar time | ||
| 614 | .Op Fl crl_hold Ar instruction | ||
| 615 | .Op Fl crl_reason Ar reason | ||
| 616 | .Op Fl crldays Ar days | ||
| 617 | .Op Fl crlexts Ar section | ||
| 618 | .Op Fl crlhours Ar hours | ||
| 619 | .Op Fl days Ar arg | ||
| 620 | .Op Fl enddate Ar date | ||
| 621 | .Op Fl engine Ar id | ||
| 622 | .Op Fl extensions Ar section | ||
| 623 | .Op Fl extfile Ar section | ||
| 624 | .Op Fl in Ar file | ||
| 625 | .Op Fl key Ar keyfile | ||
| 626 | .Op Fl keyfile Ar arg | ||
| 627 | .Op Fl keyform Ar ENGINE | PEM | ||
| 628 | .Op Fl md Ar arg | ||
| 629 | .Op Fl name Ar section | ||
| 630 | .Op Fl out Ar file | ||
| 631 | .Op Fl outdir Ar dir | ||
| 632 | .Op Fl passin Ar arg | ||
| 633 | .Op Fl policy Ar arg | ||
| 634 | .Op Fl revoke Ar file | ||
| 635 | .Op Fl spkac Ar file | ||
| 636 | .Op Fl ss_cert Ar file | ||
| 637 | .Op Fl startdate Ar date | ||
| 638 | .Op Fl status Ar serial | ||
| 639 | .Op Fl subj Ar arg | ||
| 640 | .Ek | ||
| 641 | .Pp | ||
| 642 | The | ||
| 643 | .Nm ca | ||
| 644 | command is a minimal CA application. | ||
| 645 | It can be used to sign certificate requests in a variety of forms | ||
| 646 | and generate CRLs. | ||
| 647 | It also maintains a text database of issued certificates and their status. | ||
| 648 | .Pp | ||
| 649 | The options descriptions will be divided into each purpose. | ||
| 650 | .Sh CA OPTIONS | ||
| 651 | .Bl -tag -width "XXXX" | ||
| 652 | .It Fl batch | ||
| 653 | This sets the batch mode. | ||
| 654 | In this mode no questions will be asked | ||
| 655 | and all certificates will be certified automatically. | ||
| 656 | .It Fl cert Ar file | ||
| 657 | The CA certificate file. | ||
| 658 | .It Fl config Ar file | ||
| 659 | Specifies the configuration file to use. | ||
| 660 | .It Fl days Ar arg | ||
| 661 | The number of days to certify the certificate for. | ||
| 662 | .It Fl enddate Ar date | ||
| 663 | This allows the expiry date to be explicitly set. | ||
| 664 | The format of the date is YYMMDDHHMMSSZ | ||
| 665 | .Pq the same as an ASN1 UTCTime structure . | ||
| 666 | .It Fl engine Ar id | ||
| 667 | Specifying an engine (by it's unique | ||
| 668 | .Ar id | ||
| 669 | string) will cause | ||
| 670 | .Nm ca | ||
| 671 | to attempt to obtain a functional reference to the specified engine, | ||
| 672 | thus initialising it if needed. | ||
| 673 | The engine will then be set as the default for all available algorithms. | ||
| 674 | .It Fl extensions Ar section | ||
| 675 | The section of the configuration file containing certificate extensions | ||
| 676 | to be added when a certificate is issued (defaults to | ||
| 677 | .Em x509_extensions | ||
| 678 | unless the | ||
| 679 | .Fl extfile | ||
| 680 | option is used). | ||
| 681 | If no extension section is present, a V1 certificate is created. | ||
| 682 | If the extension section is present | ||
| 683 | .Pq even if it is empty , | ||
| 684 | then a V3 certificate is created. | ||
| 685 | .It Fl extfile Ar file | ||
| 686 | An additional configuration | ||
| 687 | .Ar file | ||
| 688 | to read certificate extensions from | ||
| 689 | (using the default section unless the | ||
| 690 | .Fl extensions | ||
| 691 | option is also used). | ||
| 692 | .It Fl in Ar file | ||
| 693 | An input | ||
| 694 | .Ar file | ||
| 695 | containing a single certificate request to be signed by the CA. | ||
| 696 | .It Fl infiles | ||
| 697 | If present, this should be the last option; all subsequent arguments | ||
| 698 | are assumed to be the names of files containing certificate requests. | ||
| 699 | .It Fl key Ar keyfile | ||
| 700 | The password used to encrypt the private key. | ||
| 701 | Since on some systems the command line arguments are visible | ||
| 702 | (e.g.\& | ||
| 703 | .Ux | ||
| 704 | with the | ||
| 705 | .Xr ps 1 | ||
| 706 | utility) this option should be used with caution. | ||
| 707 | .It Fl keyfile Ar file | ||
| 708 | The private key to sign requests with. | ||
| 709 | .It Fl keyform Ar ENGINE | PEM | ||
| 710 | Private key file format. | ||
| 711 | .It Fl md Ar alg | ||
| 712 | The message digest to use. | ||
| 713 | Possible values include | ||
| 714 | .Ar md5 | ||
| 715 | and | ||
| 716 | .Ar sha1 . | ||
| 717 | This option also applies to CRLs. | ||
| 718 | .It Fl msie_hack | ||
| 719 | This is a legacy option to make | ||
| 720 | .Nm ca | ||
| 721 | work with very old versions of the IE certificate enrollment control | ||
| 722 | .Qq certenr3 . | ||
| 723 | It used UniversalStrings for almost everything. | ||
| 724 | Since the old control has various security bugs, | ||
| 725 | its use is strongly discouraged. | ||
| 726 | The newer control | ||
| 727 | .Qq Xenroll | ||
| 728 | does not need this option. | ||
| 729 | .It Fl name Ar section | ||
| 730 | Specifies the configuration file | ||
| 731 | .Ar section | ||
| 732 | to use (overrides | ||
| 733 | .Cm default_ca | ||
| 734 | in the | ||
| 735 | .Cm ca | ||
| 736 | section). | ||
| 737 | .It Fl noemailDN | ||
| 738 | The DN of a certificate can contain the EMAIL field if present in the | ||
| 739 | request DN, however it is good policy just having the e-mail set into | ||
| 740 | the | ||
| 741 | .Em altName | ||
| 742 | extension of the certificate. | ||
| 743 | When this option is set, the EMAIL field is removed from the certificate's | ||
| 744 | subject and set only in the, eventually present, extensions. | ||
| 745 | The | ||
| 746 | .Ar email_in_dn | ||
| 747 | keyword can be used in the configuration file to enable this behaviour. | ||
| 748 | .It Fl notext | ||
| 749 | Don't output the text form of a certificate to the output file. | ||
| 750 | .It Fl out Ar file | ||
| 751 | The output file to output certificates to. | ||
| 752 | The default is standard output. | ||
| 753 | The certificate details will also be printed out to this file. | ||
| 754 | .It Fl outdir Ar directory | ||
| 755 | The | ||
| 756 | .Ar directory | ||
| 757 | to output certificates to. | ||
| 758 | The certificate will be written to a file consisting of the | ||
| 759 | serial number in hex with | ||
| 760 | .Qq .pem | ||
| 761 | appended. | ||
| 762 | .It Fl passin Ar arg | ||
| 763 | The key password source. | ||
| 764 | For more information about the format of | ||
| 765 | .Ar arg , | ||
| 766 | see the | ||
| 767 | .Sx PASS PHRASE ARGUMENTS | ||
| 768 | section above. | ||
| 769 | .It Fl policy Ar arg | ||
| 770 | This option defines the CA | ||
| 771 | .Qq policy | ||
| 772 | to use. | ||
| 773 | This is a section in the configuration file which decides which fields | ||
| 774 | should be mandatory or match the CA certificate. | ||
| 775 | Check out the | ||
| 776 | .Sx CA POLICY FORMAT | ||
| 777 | section for more information. | ||
| 778 | .It Fl preserveDN | ||
| 779 | Normally, the DN order of a certificate is the same as the order of the | ||
| 780 | fields in the relevant policy section. | ||
| 781 | When this option is set, the order is the same as the request. | ||
| 782 | This is largely for compatibility with the older IE enrollment control | ||
| 783 | which would only accept certificates if their DNs matched the order of the | ||
| 784 | request. | ||
| 785 | This is not needed for Xenroll. | ||
| 786 | .It Fl spkac Ar file | ||
| 787 | A file containing a single Netscape signed public key and challenge, | ||
| 788 | and additional field values to be signed by the CA. | ||
| 789 | See the | ||
| 790 | .Sx SPKAC FORMAT | ||
| 791 | section for information on the required format. | ||
| 792 | .It Fl ss_cert Ar file | ||
| 793 | A single self-signed certificate to be signed by the CA. | ||
| 794 | .It Fl startdate Ar date | ||
| 795 | This allows the start date to be explicitly set. | ||
| 796 | The format of the date is YYMMDDHHMMSSZ | ||
| 797 | .Pq the same as an ASN1 UTCTime structure . | ||
| 798 | .It Fl status Ar serial | ||
| 799 | Show status of certificate with serial number | ||
| 800 | .Ar serial . | ||
| 801 | .It Fl updatedb | ||
| 802 | Update database for expired certificates. | ||
| 803 | .It Fl verbose | ||
| 804 | This prints extra details about the operations being performed. | ||
| 805 | .El | ||
| 806 | .Sh CRL OPTIONS | ||
| 807 | .Bl -tag -width "XXXX" | ||
| 808 | .It Fl crl_CA_compromise Ar time | ||
| 809 | This is the same as | ||
| 810 | .Fl crl_compromise , | ||
| 811 | except the revocation reason is set to CACompromise. | ||
| 812 | .It Fl crl_compromise Ar time | ||
| 813 | This sets the revocation reason to keyCompromise and the compromise time to | ||
| 814 | .Ar time . | ||
| 815 | .Ar time | ||
| 816 | should be in GeneralizedTime format, i.e. YYYYMMDDHHMMSSZ. | ||
| 817 | .It Fl crl_hold Ar instruction | ||
| 818 | This sets the CRL revocation reason code to certificateHold and the hold | ||
| 819 | instruction to | ||
| 820 | .Ar instruction | ||
| 821 | which must be an OID. | ||
| 822 | Although any OID can be used, only holdInstructionNone | ||
| 823 | (the use of which is discouraged by RFC 2459), holdInstructionCallIssuer or | ||
| 824 | holdInstructionReject will normally be used. | ||
| 825 | .It Fl crl_reason Ar reason | ||
| 826 | Revocation reason, where | ||
| 827 | .Ar reason | ||
| 828 | is one of: | ||
| 829 | unspecified, keyCompromise, CACompromise, affiliationChanged, superseded, | ||
| 830 | cessationOfOperation, certificateHold or removeFromCRL. | ||
| 831 | The matching of | ||
| 832 | .Ar reason | ||
| 833 | is case insensitive. | ||
| 834 | Setting any revocation reason will make the CRL v2. | ||
| 835 | In practice, removeFromCRL is not particularly useful because it is only used | ||
| 836 | in delta CRLs which are not currently implemented. | ||
| 837 | .It Fl crldays Ar num | ||
| 838 | The number of days before the next CRL is due. | ||
| 839 | This is the days from now to place in the CRL | ||
| 840 | .Em nextUpdate | ||
| 841 | field. | ||
| 842 | .It Fl crlexts Ar section | ||
| 843 | The | ||
| 844 | .Ar section | ||
| 845 | of the configuration file containing CRL extensions to include. | ||
| 846 | If no CRL extension section is present then a V1 CRL is created; | ||
| 847 | if the CRL extension section is present | ||
| 848 | .Pq even if it is empty | ||
| 849 | then a V2 CRL is created. | ||
| 850 | The CRL extensions specified are CRL extensions and | ||
| 851 | .Em not | ||
| 852 | CRL entry extensions. | ||
| 853 | It should be noted that some software | ||
| 854 | .Pq for example Netscape | ||
| 855 | can't handle V2 CRLs. | ||
| 856 | .It Fl crlhours Ar num | ||
| 857 | The number of hours before the next CRL is due. | ||
| 858 | .It Fl gencrl | ||
| 859 | This option generates a CRL based on information in the index file. | ||
| 860 | .It Fl revoke Ar file | ||
| 861 | A | ||
| 862 | .Ar file | ||
| 863 | containing a certificate to revoke. | ||
| 864 | .It Fl subj Ar arg | ||
| 865 | Supersedes the subject name given in the request. | ||
| 866 | The | ||
| 867 | .Ar arg | ||
| 868 | must be formatted as | ||
| 869 | .Ar /type0=value0/type1=value1/type2=... ; | ||
| 870 | characters may be escaped by | ||
| 871 | .Sq \e | ||
| 872 | .Pq backslash , | ||
| 873 | no spaces are skipped. | ||
| 874 | .El | ||
| 875 | .Sh CA CONFIGURATION FILE OPTIONS | ||
| 876 | The section of the configuration file containing options for | ||
| 877 | .Nm ca | ||
| 878 | is found as follows: | ||
| 879 | If the | ||
| 880 | .Fl name | ||
| 881 | command line option is used, then it names the section to be used. | ||
| 882 | Otherwise the section to be used must be named in the | ||
| 883 | .Em default_ca | ||
| 884 | option of the | ||
| 885 | .Em ca | ||
| 886 | section of the configuration file (or in the default section of the | ||
| 887 | configuration file). | ||
| 888 | Besides | ||
| 889 | .Em default_ca , | ||
| 890 | the following options are read directly from the | ||
| 891 | .Em ca | ||
| 892 | section: | ||
| 893 | .Pp | ||
| 894 | .Bl -tag -width Ds -offset indent -compact | ||
| 895 | .It RANDFILE | ||
| 896 | .It preserve | ||
| 897 | .It msie_hack | ||
| 898 | .El | ||
| 899 | .Pp | ||
| 900 | With the exception of RANDFILE, this is probably a bug and may | ||
| 901 | change in future releases. | ||
| 902 | .Pp | ||
| 903 | Many of the configuration file options are identical to command line | ||
| 904 | options. | ||
| 905 | Where the option is present in the configuration file and the command line, | ||
| 906 | the command line value is used. | ||
| 907 | Where an option is described as mandatory, then it must be present in | ||
| 908 | the configuration file or the command line equivalent | ||
| 909 | .Pq if any | ||
| 910 | used. | ||
| 911 | .Bl -tag -width "XXXX" | ||
| 912 | .It Ar certificate | ||
| 913 | The same as | ||
| 914 | .Fl cert . | ||
| 915 | It gives the file containing the CA certificate. | ||
| 916 | Mandatory. | ||
| 917 | .It Ar copy_extensions | ||
| 918 | Determines how extensions in certificate requests should be handled. | ||
| 919 | If set to | ||
| 920 | .Ar none | ||
| 921 | or this option is not present, then extensions are | ||
| 922 | ignored and not copied to the certificate. | ||
| 923 | If set to | ||
| 924 | .Ar copy , | ||
| 925 | then any extensions present in the request that are not already present | ||
| 926 | are copied to the certificate. | ||
| 927 | If set to | ||
| 928 | .Ar copyall , | ||
| 929 | then all extensions in the request are copied to the certificate: | ||
| 930 | if the extension is already present in the certificate it is deleted first. | ||
| 931 | See the | ||
| 932 | .Sx CA WARNINGS | ||
| 933 | section before using this option. | ||
| 934 | .Pp | ||
| 935 | The main use of this option is to allow a certificate request to supply | ||
| 936 | values for certain extensions such as | ||
| 937 | .Em subjectAltName . | ||
| 938 | .It Ar crl_extensions | ||
| 939 | The same as | ||
| 940 | .Fl crlexts . | ||
| 941 | .It Ar crlnumber | ||
| 942 | A text file containing the next CRL number to use in hex. | ||
| 943 | The CRL number will be inserted in the CRLs only if this file exists. | ||
| 944 | If this file is present, it must contain a valid CRL number. | ||
| 945 | .It Ar database | ||
| 946 | The text database file to use. | ||
| 947 | Mandatory. | ||
| 948 | This file must be present, though initially it will be empty. | ||
| 949 | .It Ar default_crl_hours , default_crl_days | ||
| 950 | The same as the | ||
| 951 | .Fl crlhours | ||
| 952 | and | ||
| 953 | .Fl crldays | ||
| 954 | options. | ||
| 955 | These will only be used if neither command line option is present. | ||
| 956 | At least one of these must be present to generate a CRL. | ||
| 957 | .It Ar default_days | ||
| 958 | The same as the | ||
| 959 | .Fl days | ||
| 960 | option. | ||
| 961 | The number of days to certify a certificate for. | ||
| 962 | .It Ar default_enddate | ||
| 963 | The same as the | ||
| 964 | .Fl enddate | ||
| 965 | option. | ||
| 966 | Either this option or | ||
| 967 | .Ar default_days | ||
| 968 | .Pq or the command line equivalents | ||
| 969 | must be present. | ||
| 970 | .It Ar default_md | ||
| 971 | The same as the | ||
| 972 | .Fl md | ||
| 973 | option. | ||
| 974 | The message digest to use. | ||
| 975 | Mandatory. | ||
| 976 | .It Ar default_startdate | ||
| 977 | The same as the | ||
| 978 | .Fl startdate | ||
| 979 | option. | ||
| 980 | The start date to certify a certificate for. | ||
| 981 | If not set, the current time is used. | ||
| 982 | .It Ar email_in_dn | ||
| 983 | The same as | ||
| 984 | .Fl noemailDN . | ||
| 985 | If the EMAIL field is to be removed from the DN of the certificate, | ||
| 986 | simply set this to | ||
| 987 | .Qq no . | ||
| 988 | If not present, the default is to allow for the EMAIL field in the | ||
| 989 | certificate's DN. | ||
| 990 | .It Ar msie_hack | ||
| 991 | The same as | ||
| 992 | .Fl msie_hack . | ||
| 993 | .It Ar name_opt , cert_opt | ||
| 994 | These options allow the format used to display the certificate details | ||
| 995 | when asking the user to confirm signing. | ||
| 996 | All the options supported by the | ||
| 997 | .Nm x509 | ||
| 998 | utilities' | ||
| 999 | .Fl nameopt | ||
| 1000 | and | ||
| 1001 | .Fl certopt | ||
| 1002 | switches can be used here, except that | ||
| 1003 | .Ar no_signame | ||
| 1004 | and | ||
| 1005 | .Ar no_sigdump | ||
| 1006 | are permanently set and cannot be disabled | ||
| 1007 | (this is because the certificate signature cannot be displayed because | ||
| 1008 | the certificate has not been signed at this point). | ||
| 1009 | .Pp | ||
| 1010 | For convenience, the value | ||
| 1011 | .Em ca_default | ||
| 1012 | is accepted by both to produce a reasonable output. | ||
| 1013 | .Pp | ||
| 1014 | If neither option is present, the format used in earlier versions of | ||
| 1015 | .Nm OpenSSL | ||
| 1016 | is used. | ||
| 1017 | Use of the old format is | ||
| 1018 | .Em strongly | ||
| 1019 | discouraged because it only displays fields mentioned in the | ||
| 1020 | .Ar policy | ||
| 1021 | section, | ||
| 1022 | mishandles multicharacter string types and does not display extensions. | ||
| 1023 | .It Ar new_certs_dir | ||
| 1024 | The same as the | ||
| 1025 | .Fl outdir | ||
| 1026 | command line option. | ||
| 1027 | It specifies the directory where new certificates will be placed. | ||
| 1028 | Mandatory. | ||
| 1029 | .It Ar oid_file | ||
| 1030 | This specifies a file containing additional object identifiers. | ||
| 1031 | Each line of the file should consist of the numerical form of the | ||
| 1032 | object identifier followed by whitespace, then the short name followed | ||
| 1033 | by whitespace and finally the long name. | ||
| 1034 | .It Ar oid_section | ||
| 1035 | This specifies a section in the configuration file containing extra | ||
| 1036 | object identifiers. | ||
| 1037 | Each line should consist of the short name of the object identifier | ||
| 1038 | followed by | ||
| 1039 | .Sq = | ||
| 1040 | and the numerical form. | ||
| 1041 | The short and long names are the same when this option is used. | ||
| 1042 | .It Ar policy | ||
| 1043 | The same as | ||
| 1044 | .Fl policy . | ||
| 1045 | Mandatory. | ||
| 1046 | See the | ||
| 1047 | .Sx CA POLICY FORMAT | ||
| 1048 | section for more information. | ||
| 1049 | .It Ar preserve | ||
| 1050 | The same as | ||
| 1051 | .Fl preserveDN . | ||
| 1052 | .It Ar private_key | ||
| 1053 | Same as the | ||
| 1054 | .Fl keyfile | ||
| 1055 | option. | ||
| 1056 | The file containing the CA private key. | ||
| 1057 | Mandatory. | ||
| 1058 | .It Ar RANDFILE | ||
| 1059 | A file used to read and write random number seed information, | ||
| 1060 | or an EGD socket (see | ||
| 1061 | .Xr RAND_egd 3 ) . | ||
| 1062 | .It Ar serial | ||
| 1063 | A text file containing the next serial number to use in hex. | ||
| 1064 | Mandatory. | ||
| 1065 | This file must be present and contain a valid serial number. | ||
| 1066 | .It Ar unique_subject | ||
| 1067 | If the value | ||
| 1068 | .Ar yes | ||
| 1069 | is given, the valid certificate entries in the | ||
| 1070 | database must have unique subjects. | ||
| 1071 | If the value | ||
| 1072 | .Ar no | ||
| 1073 | is given, | ||
| 1074 | several valid certificate entries may have the exact same subject. | ||
| 1075 | The default value is | ||
| 1076 | .Ar yes . | ||
| 1077 | .It Ar x509_extensions | ||
| 1078 | The same as | ||
| 1079 | .Fl extensions . | ||
| 1080 | .El | ||
| 1081 | .Sh CA POLICY FORMAT | ||
| 1082 | The policy section consists of a set of variables corresponding to | ||
| 1083 | certificate DN fields. | ||
| 1084 | If the value is | ||
| 1085 | .Qq match , | ||
| 1086 | then the field value must match the same field in the CA certificate. | ||
| 1087 | If the value is | ||
| 1088 | .Qq supplied , | ||
| 1089 | then it must be present. | ||
| 1090 | If the value is | ||
| 1091 | .Qq optional , | ||
| 1092 | then it may be present. | ||
| 1093 | Any fields not mentioned in the policy section | ||
| 1094 | are silently deleted, unless the | ||
| 1095 | .Fl preserveDN | ||
| 1096 | option is set, | ||
| 1097 | but this can be regarded more of a quirk than intended behaviour. | ||
| 1098 | .Sh SPKAC FORMAT | ||
| 1099 | The input to the | ||
| 1100 | .Fl spkac | ||
| 1101 | command line option is a Netscape signed public key and challenge. | ||
| 1102 | This will usually come from the | ||
| 1103 | .Em KEYGEN | ||
| 1104 | tag in an HTML form to create a new private key. | ||
| 1105 | It is, however, possible to create SPKACs using the | ||
| 1106 | .Nm spkac | ||
| 1107 | utility. | ||
| 1108 | .Pp | ||
| 1109 | The file should contain the variable SPKAC set to the value of | ||
| 1110 | the SPKAC and also the required DN components as name value pairs. | ||
| 1111 | If it's necessary to include the same component twice, | ||
| 1112 | then it can be preceded by a number and a | ||
| 1113 | .Sq \&. . | ||
| 1114 | .Sh CA EXAMPLES | ||
| 1115 | .Sy Note : | ||
| 1116 | these examples assume that the | ||
| 1117 | .Nm ca | ||
| 1118 | directory structure is already set up and the relevant files already exist. | ||
| 1119 | This usually involves creating a CA certificate and private key with | ||
| 1120 | .Cm req , | ||
| 1121 | a serial number file and an empty index file and placing them in | ||
| 1122 | the relevant directories. | ||
| 1123 | .Pp | ||
| 1124 | To use the sample configuration file below, the directories | ||
| 1125 | .Pa demoCA , | ||
| 1126 | .Pa demoCA/private | ||
| 1127 | and | ||
| 1128 | .Pa demoCA/newcerts | ||
| 1129 | would be created. | ||
| 1130 | The CA certificate would be copied to | ||
| 1131 | .Pa demoCA/cacert.pem | ||
| 1132 | and its private key to | ||
| 1133 | .Pa demoCA/private/cakey.pem . | ||
| 1134 | A file | ||
| 1135 | .Pa demoCA/serial | ||
| 1136 | would be created containing, for example, | ||
| 1137 | .Qq 01 | ||
| 1138 | and the empty index file | ||
| 1139 | .Pa demoCA/index.txt . | ||
| 1140 | .Pp | ||
| 1141 | Sign a certificate request: | ||
| 1142 | .Pp | ||
| 1143 | .Dl $ openssl ca -in req.pem -out newcert.pem | ||
| 1144 | .Pp | ||
| 1145 | Sign a certificate request, using CA extensions: | ||
| 1146 | .Pp | ||
| 1147 | .Dl $ openssl ca -in req.pem -extensions v3_ca -out newcert.pem | ||
| 1148 | .Pp | ||
| 1149 | Generate a CRL: | ||
| 1150 | .Pp | ||
| 1151 | .Dl $ openssl ca -gencrl -out crl.pem | ||
| 1152 | .Pp | ||
| 1153 | Sign several requests: | ||
| 1154 | .Pp | ||
| 1155 | .Dl $ openssl ca -infiles req1.pem req2.pem req3.pem | ||
| 1156 | .Pp | ||
| 1157 | Certify a Netscape SPKAC: | ||
| 1158 | .Pp | ||
| 1159 | .Dl $ openssl ca -spkac spkac.txt | ||
| 1160 | .Pp | ||
| 1161 | A sample SPKAC file | ||
| 1162 | .Pq the SPKAC line has been truncated for clarity : | ||
| 1163 | .Bd -literal -offset indent | ||
| 1164 | SPKAC=MIG0MGAwXDANBgkqhkiG9w0BAQEFAANLADBIAkEAn7PDhCeV/xIxUg8V70YRxK | ||
| 1165 | CN=Steve Test | ||
| 1166 | emailAddress=steve@openssl.org | ||
| 1167 | 0.OU=OpenSSL Group | ||
| 1168 | 1.OU=Another Group | ||
| 1169 | .Ed | ||
| 1170 | .Pp | ||
| 1171 | A sample configuration file with the relevant sections for | ||
| 1172 | .Nm ca : | ||
| 1173 | .Bd -literal | ||
| 1174 | \& [ ca ] | ||
| 1175 | \& default_ca = CA_default # The default ca section | ||
| 1176 | |||
| 1177 | \& [ CA_default ] | ||
| 1178 | |||
| 1179 | \& dir = ./demoCA # top dir | ||
| 1180 | \& database = $dir/index.txt # index file | ||
| 1181 | \& new_certs_dir = $dir/newcerts # new certs dir | ||
| 1182 | |||
| 1183 | \& certificate = $dir/cacert.pem # The CA cert | ||
| 1184 | \& serial = $dir/serial # serial no file | ||
| 1185 | \& private_key = $dir/private/cakey.pem# CA private key | ||
| 1186 | \& RANDFILE = $dir/private/.rand # random number file | ||
| 1187 | |||
| 1188 | \& default_days = 365 # how long to certify for | ||
| 1189 | \& default_crl_days= 30 # how long before next CRL | ||
| 1190 | \& default_md = md5 # md to use | ||
| 1191 | |||
| 1192 | \& policy = policy_any # default policy | ||
| 1193 | \& email_in_dn = no # Don't add the email into cert DN | ||
| 1194 | |||
| 1195 | \& name_opt = ca_default # Subject name display option | ||
| 1196 | \& cert_opt = ca_default # Certificate display option | ||
| 1197 | \& copy_extensions = none #Don't copy extensions from request | ||
| 1198 | |||
| 1199 | \& [ policy_any ] | ||
| 1200 | \& countryName = supplied | ||
| 1201 | \& stateOrProvinceName = optional | ||
| 1202 | \& organizationName = optional | ||
| 1203 | \& organizationalUnitName = optional | ||
| 1204 | \& commonName = supplied | ||
| 1205 | \& emailAddress = optional | ||
| 1206 | .Ed | ||
| 1207 | .Sh CA FILES | ||
| 1208 | .Sy Note : | ||
| 1209 | the location of all files can change either by compile time options, | ||
| 1210 | configuration file entries, environment variables, or command line options. | ||
| 1211 | The values below reflect the default values. | ||
| 1212 | .Bd -literal -offset indent | ||
| 1213 | /etc/ssl/openssl.cnf - master configuration file | ||
| 1214 | \&./demoCA - main CA directory | ||
| 1215 | \&./demoCA/cacert.pem - CA certificate | ||
| 1216 | \&./demoCA/private/cakey.pem - CA private key | ||
| 1217 | \&./demoCA/serial - CA serial number file | ||
| 1218 | \&./demoCA/serial.old - CA serial number backup file | ||
| 1219 | \&./demoCA/index.txt - CA text database file | ||
| 1220 | \&./demoCA/index.txt.old - CA text database backup file | ||
| 1221 | \&./demoCA/certs - certificate output file | ||
| 1222 | \&./demoCA/.rnd - CA random seed information | ||
| 1223 | .Ed | ||
| 1224 | .Sh CA ENVIRONMENT VARIABLES | ||
| 1225 | .Ev OPENSSL_CONF | ||
| 1226 | reflects the location of the master configuration file; | ||
| 1227 | it can be overridden by the | ||
| 1228 | .Fl config | ||
| 1229 | command line option. | ||
| 1230 | .Sh CA RESTRICTIONS | ||
| 1231 | The text database index file is a critical part of the process, | ||
| 1232 | and if corrupted it can be difficult to fix. | ||
| 1233 | It is theoretically possible to rebuild the index file from all the | ||
| 1234 | issued certificates and a current CRL; however there is no option to do this. | ||
| 1235 | .Pp | ||
| 1236 | V2 CRL features like delta CRLs are not currently supported. | ||
| 1237 | .Pp | ||
| 1238 | Although several requests can be input and handled at once, it is only | ||
| 1239 | possible to include one SPKAC or self-signed certificate. | ||
| 1240 | .Sh CA BUGS | ||
| 1241 | The use of an in-memory text database can cause problems when large | ||
| 1242 | numbers of certificates are present because, as the name implies, | ||
| 1243 | the database has to be kept in memory. | ||
| 1244 | .Pp | ||
| 1245 | It is not possible to certify two certificates with the same DN; this | ||
| 1246 | is a side effect of how the text database is indexed and it cannot easily | ||
| 1247 | be fixed without introducing other problems. | ||
| 1248 | Some S/MIME clients can use two certificates with the same DN for separate | ||
| 1249 | signing and encryption keys. | ||
| 1250 | .Pp | ||
| 1251 | The | ||
| 1252 | .Nm ca | ||
| 1253 | command really needs rewriting or the required functionality | ||
| 1254 | exposed at either a command or interface level so a more friendly utility | ||
| 1255 | .Pq perl script or GUI | ||
| 1256 | can handle things properly. | ||
| 1257 | The scripts | ||
| 1258 | .Nm CA.sh | ||
| 1259 | and | ||
| 1260 | .Nm CA.pl | ||
| 1261 | help a little but not very much. | ||
| 1262 | .Pp | ||
| 1263 | Any fields in a request that are not present in a policy are silently | ||
| 1264 | deleted. | ||
| 1265 | This does not happen if the | ||
| 1266 | .Fl preserveDN | ||
| 1267 | option is used. | ||
| 1268 | To enforce the absence of the EMAIL field within the DN, as suggested | ||
| 1269 | by RFCs, regardless of the contents of the request's subject the | ||
| 1270 | .Fl noemailDN | ||
| 1271 | option can be used. | ||
| 1272 | The behaviour should be more friendly and configurable. | ||
| 1273 | .Pp | ||
| 1274 | Cancelling some commands by refusing to certify a certificate can | ||
| 1275 | create an empty file. | ||
| 1276 | .Sh CA WARNINGS | ||
| 1277 | The | ||
| 1278 | .Nm ca | ||
| 1279 | command is quirky and at times downright unfriendly. | ||
| 1280 | .Pp | ||
| 1281 | The | ||
| 1282 | .Nm ca | ||
| 1283 | utility was originally meant as an example of how to do things in a CA. | ||
| 1284 | It was not supposed to be used as a full blown CA itself: | ||
| 1285 | nevertheless some people are using it for this purpose. | ||
| 1286 | .Pp | ||
| 1287 | The | ||
| 1288 | .Nm ca | ||
| 1289 | command is effectively a single user command: no locking is done on the | ||
| 1290 | various files, and attempts to run more than one | ||
| 1291 | .Nm ca | ||
| 1292 | command on the same database can have unpredictable results. | ||
| 1293 | .Pp | ||
| 1294 | The | ||
| 1295 | .Ar copy_extensions | ||
| 1296 | option should be used with caution. | ||
| 1297 | If care is not taken, it can be a security risk. | ||
| 1298 | For example, if a certificate request contains a | ||
| 1299 | .Em basicConstraints | ||
| 1300 | extension with CA:TRUE and the | ||
| 1301 | .Ar copy_extensions | ||
| 1302 | value is set to | ||
| 1303 | .Ar copyall | ||
| 1304 | and the user does not spot | ||
| 1305 | this when the certificate is displayed, then this will hand the requestor | ||
| 1306 | a valid CA certificate. | ||
| 1307 | .Pp | ||
| 1308 | This situation can be avoided by setting | ||
| 1309 | .Ar copy_extensions | ||
| 1310 | to | ||
| 1311 | .Ar copy | ||
| 1312 | and including | ||
| 1313 | .Em basicConstraints | ||
| 1314 | with CA:FALSE in the configuration file. | ||
| 1315 | Then if the request contains a | ||
| 1316 | .Em basicConstraints | ||
| 1317 | extension, it will be ignored. | ||
| 1318 | .Pp | ||
| 1319 | It is advisable to also include values for other extensions such | ||
| 1320 | as | ||
| 1321 | .Ar keyUsage | ||
| 1322 | to prevent a request supplying its own values. | ||
| 1323 | .Pp | ||
| 1324 | Additional restrictions can be placed on the CA certificate itself. | ||
| 1325 | For example if the CA certificate has: | ||
| 1326 | .Pp | ||
| 1327 | .D1 basicConstraints = CA:TRUE, pathlen:0 | ||
| 1328 | .Pp | ||
| 1329 | then even if a certificate is issued with CA:TRUE it will not be valid. | ||
| 1330 | .\" | ||
| 1331 | .\" CIPHERS | ||
| 1332 | .\" | ||
| 1333 | .Sh CIPHERS | ||
| 1334 | .Nm openssl ciphers | ||
| 1335 | .Op Fl h | ||
| 1336 | .Op Fl ssl2 | ssl3 | tls1 | ||
| 1337 | .Op Fl v | ||
| 1338 | .Op Ar cipherlist | ||
| 1339 | .Pp | ||
| 1340 | The | ||
| 1341 | .Nm ciphers | ||
| 1342 | command converts | ||
| 1343 | .Nm OpenSSL | ||
| 1344 | cipher lists into ordered SSL cipher preference lists. | ||
| 1345 | It can be used as a test tool to determine the appropriate cipherlist. | ||
| 1346 | .Pp | ||
| 1347 | The options are as follows: | ||
| 1348 | .Bl -tag -width "XXXXXX" | ||
| 1349 | .It Fl h , \&? | ||
| 1350 | Print a brief usage message. | ||
| 1351 | .It Fl ssl2 | ||
| 1352 | Only include SSL v2 ciphers. | ||
| 1353 | .It Fl ssl3 | ||
| 1354 | Only include SSL v3 ciphers. | ||
| 1355 | .It Fl tls1 | ||
| 1356 | Only include TLS v1 ciphers. | ||
| 1357 | .It Fl v | ||
| 1358 | Verbose option. | ||
| 1359 | List ciphers with a complete description of protocol version | ||
| 1360 | .Pq SSLv2 or SSLv3; the latter includes TLS , | ||
| 1361 | key exchange, authentication, encryption and mac algorithms used along with | ||
| 1362 | any key size restrictions and whether the algorithm is classed as an | ||
| 1363 | .Em export | ||
| 1364 | cipher. | ||
| 1365 | Note that without the | ||
| 1366 | .Fl v | ||
| 1367 | option, ciphers may seem to appear twice in a cipher list; | ||
| 1368 | this is when similar ciphers are available for | ||
| 1369 | SSL v2 and for SSL v3/TLS v1. | ||
| 1370 | .It Ar cipherlist | ||
| 1371 | A cipher list to convert to a cipher preference list. | ||
| 1372 | If it is not included, the default cipher list will be used. | ||
| 1373 | The format is described below. | ||
| 1374 | .El | ||
| 1375 | .Sh CIPHERS LIST FORMAT | ||
| 1376 | The cipher list consists of one or more | ||
| 1377 | .Em cipher strings | ||
| 1378 | separated by colons. | ||
| 1379 | Commas or spaces are also acceptable separators, but colons are normally used. | ||
| 1380 | .Pp | ||
| 1381 | The actual | ||
| 1382 | .Em cipher string | ||
| 1383 | can take several different forms: | ||
| 1384 | .Pp | ||
| 1385 | It can consist of a single cipher suite such as | ||
| 1386 | .Em RC4-SHA . | ||
| 1387 | .Pp | ||
| 1388 | It can represent a list of cipher suites containing a certain algorithm, | ||
| 1389 | or cipher suites of a certain type. | ||
| 1390 | For example | ||
| 1391 | .Em SHA1 | ||
| 1392 | represents all cipher suites using the digest algorithm SHA1, and | ||
| 1393 | .Em SSLv3 | ||
| 1394 | represents all SSL v3 algorithms. | ||
| 1395 | .Pp | ||
| 1396 | Lists of cipher suites can be combined in a single | ||
| 1397 | .Em cipher string | ||
| 1398 | using the | ||
| 1399 | .Sq + | ||
| 1400 | character. | ||
| 1401 | This is used as a logical | ||
| 1402 | .Em and | ||
| 1403 | operation. | ||
| 1404 | For example, | ||
| 1405 | .Em SHA1+DES | ||
| 1406 | represents all cipher suites containing the SHA1 and the DES algorithms. | ||
| 1407 | .Pp | ||
| 1408 | Each cipher string can be optionally preceded by the characters | ||
| 1409 | .Sq \&! , | ||
| 1410 | .Sq - , | ||
| 1411 | or | ||
| 1412 | .Sq + . | ||
| 1413 | .Pp | ||
| 1414 | If | ||
| 1415 | .Sq !\& | ||
| 1416 | is used, then the ciphers are permanently deleted from the list. | ||
| 1417 | The ciphers deleted can never reappear in the list even if they are | ||
| 1418 | explicitly stated. | ||
| 1419 | .Pp | ||
| 1420 | If | ||
| 1421 | .Sq - | ||
| 1422 | is used, then the ciphers are deleted from the list, but some or | ||
| 1423 | all of the ciphers can be added again by later options. | ||
| 1424 | .Pp | ||
| 1425 | If | ||
| 1426 | .Sq + | ||
| 1427 | is used, then the ciphers are moved to the end of the list. | ||
| 1428 | This option doesn't add any new ciphers, it just moves matching existing ones. | ||
| 1429 | .Pp | ||
| 1430 | If none of these characters is present, the string is just interpreted | ||
| 1431 | as a list of ciphers to be appended to the current preference list. | ||
| 1432 | If the list includes any ciphers already present, they will be ignored; | ||
| 1433 | that is, they will not be moved to the end of the list. | ||
| 1434 | .Pp | ||
| 1435 | Additionally, the cipher string | ||
| 1436 | .Em @STRENGTH | ||
| 1437 | can be used at any point to sort the current cipher list in order of | ||
| 1438 | encryption algorithm key length. | ||
| 1439 | .Sh CIPHERS STRINGS | ||
| 1440 | The following is a list of all permitted cipher strings and their meanings. | ||
| 1441 | .Bl -tag -width "XXXX" | ||
| 1442 | .It Ar DEFAULT | ||
| 1443 | The default cipher list. | ||
| 1444 | This is determined at compile time and is normally | ||
| 1445 | .Ar ALL:!ADH:+RC4:@STRENGTH . | ||
| 1446 | This must be the first | ||
| 1447 | .Ar cipher string | ||
| 1448 | specified. | ||
| 1449 | .It Ar COMPLEMENTOFDEFAULT | ||
| 1450 | The ciphers included in | ||
| 1451 | .Ar ALL , | ||
| 1452 | but not enabled by default. | ||
| 1453 | Currently this is | ||
| 1454 | .Ar ADH . | ||
| 1455 | Note that this rule does not cover | ||
| 1456 | .Ar eNULL , | ||
| 1457 | which is not included by | ||
| 1458 | .Ar ALL | ||
| 1459 | (use | ||
| 1460 | .Ar COMPLEMENTOFALL | ||
| 1461 | if necessary). | ||
| 1462 | .It Ar ALL | ||
| 1463 | All cipher suites except the | ||
| 1464 | .Ar eNULL | ||
| 1465 | ciphers which must be explicitly enabled. | ||
| 1466 | .It Ar COMPLEMENTOFALL | ||
| 1467 | The cipher suites not enabled by | ||
| 1468 | .Ar ALL , | ||
| 1469 | currently being | ||
| 1470 | .Ar eNULL . | ||
| 1471 | .It Ar HIGH | ||
| 1472 | .Qq High | ||
| 1473 | encryption cipher suites. | ||
| 1474 | This currently means those with key lengths larger than 128 bits. | ||
| 1475 | .It Ar MEDIUM | ||
| 1476 | .Qq Medium | ||
| 1477 | encryption cipher suites, currently those using 128-bit encryption. | ||
| 1478 | .It Ar LOW | ||
| 1479 | .Qq Low | ||
| 1480 | encryption cipher suites, currently those using 64- or 56-bit encryption | ||
| 1481 | algorithms, but excluding export cipher suites. | ||
| 1482 | .It Ar EXP , EXPORT | ||
| 1483 | Export encryption algorithms. | ||
| 1484 | Including 40- and 56-bit algorithms. | ||
| 1485 | .It Ar EXPORT40 | ||
| 1486 | 40-bit export encryption algorithms. | ||
| 1487 | .It Ar EXPORT56 | ||
| 1488 | 56-bit export encryption algorithms. | ||
| 1489 | .It Ar eNULL , NULL | ||
| 1490 | The | ||
| 1491 | .Qq NULL | ||
| 1492 | ciphers; that is, those offering no encryption. | ||
| 1493 | Because these offer no encryption at all and are a security risk, | ||
| 1494 | they are disabled unless explicitly included. | ||
| 1495 | .It Ar aNULL | ||
| 1496 | The cipher suites offering no authentication. | ||
| 1497 | This is currently the anonymous DH algorithms. | ||
| 1498 | These cipher suites are vulnerable to a | ||
| 1499 | .Qq man in the middle | ||
| 1500 | attack, so their use is normally discouraged. | ||
| 1501 | .It Ar kRSA , RSA | ||
| 1502 | Cipher suites using RSA key exchange. | ||
| 1503 | .It Ar kEDH | ||
| 1504 | Cipher suites using ephemeral DH key agreement. | ||
| 1505 | .It Ar kDHr , kDHd | ||
| 1506 | Cipher suites using DH key agreement and DH certificates signed by | ||
| 1507 | CAs with RSA and DSS keys respectively. | ||
| 1508 | Not implemented. | ||
| 1509 | .It Ar aRSA | ||
| 1510 | Cipher suites using RSA authentication, i.e. the certificates carry RSA keys. | ||
| 1511 | .It Ar aDSS , DSS | ||
| 1512 | Cipher suites using DSS authentication, i.e. the certificates carry DSS keys. | ||
| 1513 | .It Ar aDH | ||
| 1514 | Cipher suites effectively using DH authentication, i.e. the certificates carry | ||
| 1515 | DH keys. | ||
| 1516 | Not implemented. | ||
| 1517 | .It Ar kFZA , aFZA , eFZA , FZA | ||
| 1518 | Cipher suites using FORTEZZA key exchange, authentication, encryption | ||
| 1519 | or all FORTEZZA algorithms. | ||
| 1520 | Not implemented. | ||
| 1521 | .It Ar TLSv1 , SSLv3 , SSLv2 | ||
| 1522 | TLS v1.0, SSL v3.0 or SSL v2.0 cipher suites, respectively. | ||
| 1523 | .It Ar DH | ||
| 1524 | Cipher suites using DH, including anonymous DH. | ||
| 1525 | .It Ar ADH | ||
| 1526 | Anonymous DH cipher suites. | ||
| 1527 | .It Ar AES | ||
| 1528 | Cipher suites using AES. | ||
| 1529 | .It Ar 3DES | ||
| 1530 | Cipher suites using triple DES. | ||
| 1531 | .It Ar DES | ||
| 1532 | Cipher suites using DES | ||
| 1533 | .Pq not triple DES . | ||
| 1534 | .It Ar RC4 | ||
| 1535 | Cipher suites using RC4. | ||
| 1536 | .It Ar RC2 | ||
| 1537 | Cipher suites using RC2. | ||
| 1538 | .It Ar MD5 | ||
| 1539 | Cipher suites using MD5. | ||
| 1540 | .It Ar SHA1 , SHA | ||
| 1541 | Cipher suites using SHA1. | ||
| 1542 | .El | ||
| 1543 | .Sh CIPHERS SUITE NAMES | ||
| 1544 | The following lists give the SSL or TLS cipher suites names from the | ||
| 1545 | relevant specification and their | ||
| 1546 | .Nm OpenSSL | ||
| 1547 | equivalents. | ||
| 1548 | It should be noted that several cipher suite names do not include the | ||
| 1549 | authentication used, e.g. DES-CBC3-SHA. | ||
| 1550 | In these cases, RSA authentication is used. | ||
| 1551 | .Ss SSL v3.0 cipher suites | ||
| 1552 | .Bd -unfilled -offset indent | ||
| 1553 | SSL_RSA_WITH_NULL_MD5 NULL-MD5 | ||
| 1554 | SSL_RSA_WITH_NULL_SHA NULL-SHA | ||
| 1555 | SSL_RSA_EXPORT_WITH_RC4_40_MD5 EXP-RC4-MD5 | ||
| 1556 | SSL_RSA_WITH_RC4_128_MD5 RC4-MD5 | ||
| 1557 | SSL_RSA_WITH_RC4_128_SHA RC4-SHA | ||
| 1558 | SSL_RSA_EXPORT_WITH_RC2_CBC_40_MD5 EXP-RC2-CBC-MD5 | ||
| 1559 | SSL_RSA_WITH_IDEA_CBC_SHA IDEA-CBC-SHA | ||
| 1560 | SSL_RSA_EXPORT_WITH_DES40_CBC_SHA EXP-DES-CBC-SHA | ||
| 1561 | SSL_RSA_WITH_DES_CBC_SHA DES-CBC-SHA | ||
| 1562 | SSL_RSA_WITH_3DES_EDE_CBC_SHA DES-CBC3-SHA | ||
| 1563 | |||
| 1564 | SSL_DH_DSS_EXPORT_WITH_DES40_CBC_SHA Not implemented. | ||
| 1565 | SSL_DH_DSS_WITH_DES_CBC_SHA Not implemented. | ||
| 1566 | SSL_DH_DSS_WITH_3DES_EDE_CBC_SHA Not implemented. | ||
| 1567 | SSL_DH_RSA_EXPORT_WITH_DES40_CBC_SHA Not implemented. | ||
| 1568 | SSL_DH_RSA_WITH_DES_CBC_SHA Not implemented. | ||
| 1569 | SSL_DH_RSA_WITH_3DES_EDE_CBC_SHA Not implemented. | ||
| 1570 | SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA EXP-EDH-DSS-DES-CBC-SHA | ||
| 1571 | SSL_DHE_DSS_WITH_DES_CBC_SHA EDH-DSS-CBC-SHA | ||
| 1572 | SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA EDH-DSS-DES-CBC3-SHA | ||
| 1573 | SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA EXP-EDH-RSA-DES-CBC-SHA | ||
| 1574 | SSL_DHE_RSA_WITH_DES_CBC_SHA EDH-RSA-DES-CBC-SHA | ||
| 1575 | SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA EDH-RSA-DES-CBC3-SHA | ||
| 1576 | |||
| 1577 | SSL_DH_anon_EXPORT_WITH_RC4_40_MD5 EXP-ADH-RC4-MD5 | ||
| 1578 | SSL_DH_anon_WITH_RC4_128_MD5 ADH-RC4-MD5 | ||
| 1579 | SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA EXP-ADH-DES-CBC-SHA | ||
| 1580 | SSL_DH_anon_WITH_DES_CBC_SHA ADH-DES-CBC-SHA | ||
| 1581 | SSL_DH_anon_WITH_3DES_EDE_CBC_SHA ADH-DES-CBC3-SHA | ||
| 1582 | |||
| 1583 | SSL_FORTEZZA_KEA_WITH_NULL_SHA Not implemented. | ||
| 1584 | SSL_FORTEZZA_KEA_WITH_FORTEZZA_CBC_SHA Not implemented. | ||
| 1585 | SSL_FORTEZZA_KEA_WITH_RC4_128_SHA Not implemented. | ||
| 1586 | .Ed | ||
| 1587 | .Ss TLS v1.0 cipher suites | ||
| 1588 | .Bd -unfilled -offset indent | ||
| 1589 | TLS_RSA_WITH_NULL_MD5 NULL-MD5 | ||
| 1590 | TLS_RSA_WITH_NULL_SHA NULL-SHA | ||
| 1591 | TLS_RSA_EXPORT_WITH_RC4_40_MD5 EXP-RC4-MD5 | ||
| 1592 | TLS_RSA_WITH_RC4_128_MD5 RC4-MD5 | ||
| 1593 | TLS_RSA_WITH_RC4_128_SHA RC4-SHA | ||
| 1594 | TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5 EXP-RC2-CBC-MD5 | ||
| 1595 | TLS_RSA_WITH_IDEA_CBC_SHA IDEA-CBC-SHA | ||
| 1596 | TLS_RSA_EXPORT_WITH_DES40_CBC_SHA EXP-DES-CBC-SHA | ||
| 1597 | TLS_RSA_WITH_DES_CBC_SHA DES-CBC-SHA | ||
| 1598 | TLS_RSA_WITH_3DES_EDE_CBC_SHA DES-CBC3-SHA | ||
| 1599 | |||
| 1600 | TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA Not implemented. | ||
| 1601 | TLS_DH_DSS_WITH_DES_CBC_SHA Not implemented. | ||
| 1602 | TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA Not implemented. | ||
| 1603 | TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA Not implemented. | ||
| 1604 | TLS_DH_RSA_WITH_DES_CBC_SHA Not implemented. | ||
| 1605 | TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA Not implemented. | ||
| 1606 | TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA EXP-EDH-DSS-DES-CBC-SHA | ||
| 1607 | TLS_DHE_DSS_WITH_DES_CBC_SHA EDH-DSS-CBC-SHA | ||
| 1608 | TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA EDH-DSS-DES-CBC3-SHA | ||
| 1609 | TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA EXP-EDH-RSA-DES-CBC-SHA | ||
| 1610 | TLS_DHE_RSA_WITH_DES_CBC_SHA EDH-RSA-DES-CBC-SHA | ||
| 1611 | TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA EDH-RSA-DES-CBC3-SHA | ||
| 1612 | |||
| 1613 | TLS_DH_anon_EXPORT_WITH_RC4_40_MD5 EXP-ADH-RC4-MD5 | ||
| 1614 | TLS_DH_anon_WITH_RC4_128_MD5 ADH-RC4-MD5 | ||
| 1615 | TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA EXP-ADH-DES-CBC-SHA | ||
| 1616 | TLS_DH_anon_WITH_DES_CBC_SHA ADH-DES-CBC-SHA | ||
| 1617 | TLS_DH_anon_WITH_3DES_EDE_CBC_SHA ADH-DES-CBC3-SHA | ||
| 1618 | .Ed | ||
| 1619 | .Ss AES ciphersuites from RFC 3268, extending TLS v1.0 | ||
| 1620 | .Bd -unfilled -offset indent | ||
| 1621 | TLS_RSA_WITH_AES_128_CBC_SHA AES128-SHA | ||
| 1622 | TLS_RSA_WITH_AES_256_CBC_SHA AES256-SHA | ||
| 1623 | |||
| 1624 | TLS_DH_DSS_WITH_AES_128_CBC_SHA Not implemented. | ||
| 1625 | TLS_DH_DSS_WITH_AES_256_CBC_SHA Not implemented. | ||
| 1626 | TLS_DH_RSA_WITH_AES_128_CBC_SHA Not implemented. | ||
| 1627 | TLS_DH_RSA_WITH_AES_256_CBC_SHA Not implemented. | ||
| 1628 | |||
| 1629 | TLS_DHE_DSS_WITH_AES_128_CBC_SHA DHE-DSS-AES128-SHA | ||
| 1630 | TLS_DHE_DSS_WITH_AES_256_CBC_SHA DHE-DSS-AES256-SHA | ||
| 1631 | TLS_DHE_RSA_WITH_AES_128_CBC_SHA DHE-RSA-AES128-SHA | ||
| 1632 | TLS_DHE_RSA_WITH_AES_256_CBC_SHA DHE-RSA-AES256-SHA | ||
| 1633 | |||
| 1634 | TLS_DH_anon_WITH_AES_128_CBC_SHA ADH-AES128-SHA | ||
| 1635 | TLS_DH_anon_WITH_AES_256_CBC_SHA ADH-AES256-SHA | ||
| 1636 | .Ed | ||
| 1637 | .Ss Additional Export 1024 and other cipher suites | ||
| 1638 | .Sy Note : | ||
| 1639 | These ciphers can also be used in SSL v3. | ||
| 1640 | .Bd -unfilled -offset indent | ||
| 1641 | TLS_RSA_EXPORT1024_WITH_DES_CBC_SHA EXP1024-DES-CBC-SHA | ||
| 1642 | TLS_RSA_EXPORT1024_WITH_RC4_56_SHA EXP1024-RC4-SHA | ||
| 1643 | TLS_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA EXP1024-DHE-DSS-DES-CBC-SHA | ||
| 1644 | TLS_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA EXP1024-DHE-DSS-RC4-SHA | ||
| 1645 | TLS_DHE_DSS_WITH_RC4_128_SHA DHE-DSS-RC4-SHA | ||
| 1646 | .Ed | ||
| 1647 | .Ss SSL v2.0 cipher suites | ||
| 1648 | .Bd -unfilled -offset indent | ||
| 1649 | SSL_CK_RC4_128_WITH_MD5 RC4-MD5 | ||
| 1650 | SSL_CK_RC4_128_EXPORT40_WITH_MD5 EXP-RC4-MD5 | ||
| 1651 | SSL_CK_RC2_128_CBC_WITH_MD5 RC2-MD5 | ||
| 1652 | SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5 EXP-RC2-MD5 | ||
| 1653 | SSL_CK_IDEA_128_CBC_WITH_MD5 IDEA-CBC-MD5 | ||
| 1654 | SSL_CK_DES_64_CBC_WITH_MD5 DES-CBC-MD5 | ||
| 1655 | SSL_CK_DES_192_EDE3_CBC_WITH_MD5 DES-CBC3-MD5 | ||
| 1656 | .Ed | ||
| 1657 | .Sh CIPHERS NOTES | ||
| 1658 | The non-ephemeral DH modes are currently unimplemented in | ||
| 1659 | .Nm OpenSSL | ||
| 1660 | because there is no support for DH certificates. | ||
| 1661 | .Pp | ||
| 1662 | Some compiled versions of | ||
| 1663 | .Nm OpenSSL | ||
| 1664 | may not include all the ciphers | ||
| 1665 | listed here because some ciphers were excluded at compile time. | ||
| 1666 | .Sh CIPHERS EXAMPLES | ||
| 1667 | Verbose listing of all | ||
| 1668 | .Nm OpenSSL | ||
| 1669 | ciphers including NULL ciphers: | ||
| 1670 | .Pp | ||
| 1671 | .Dl $ openssl ciphers -v 'ALL:eNULL' | ||
| 1672 | .Pp | ||
| 1673 | Include all ciphers except NULL and anonymous DH then sort by | ||
| 1674 | strength: | ||
| 1675 | .Pp | ||
| 1676 | .Dl $ openssl ciphers -v 'ALL:!ADH:@STRENGTH' | ||
| 1677 | .Pp | ||
| 1678 | Include only 3DES ciphers and then place RSA ciphers last: | ||
| 1679 | .Pp | ||
| 1680 | .Dl $ openssl ciphers -v '3DES:+RSA' | ||
| 1681 | .Pp | ||
| 1682 | Include all RC4 ciphers but leave out those without authentication: | ||
| 1683 | .Pp | ||
| 1684 | .Dl $ openssl ciphers -v 'RC4:!COMPLEMENTOFDEFAULT' | ||
| 1685 | .Pp | ||
| 1686 | Include all ciphers with RSA authentication but leave out ciphers without | ||
| 1687 | encryption: | ||
| 1688 | .Pp | ||
| 1689 | .Dl $ openssl ciphers -v 'RSA:!COMPLEMENTOFALL' | ||
| 1690 | .Sh CIPHERS HISTORY | ||
| 1691 | The | ||
| 1692 | .Ar COMPLEMENTOFALL | ||
| 1693 | and | ||
| 1694 | .Ar COMPLEMENTOFDEFAULT | ||
| 1695 | selection options were added in version 0.9.7. | ||
| 1696 | .\" | ||
| 1697 | .\" CRL | ||
| 1698 | .\" | ||
| 1699 | .Sh CRL | ||
| 1700 | .Nm openssl crl | ||
| 1701 | .Bk -words | ||
| 1702 | .Op Fl fingerprint | ||
| 1703 | .Op Fl hash | ||
| 1704 | .Op Fl issuer | ||
| 1705 | .Op Fl lastupdate | ||
| 1706 | .Op Fl nextupdate | ||
| 1707 | .Op Fl noout | ||
| 1708 | .Op Fl text | ||
| 1709 | .Op Fl CAfile Ar file | ||
| 1710 | .Op Fl CApath Ar dir | ||
| 1711 | .Op Fl in Ar file | ||
| 1712 | .Op Fl inform Ar DER | PEM | ||
| 1713 | .Op Fl out Ar file | ||
| 1714 | .Op Fl outform Ar DER | PEM | ||
| 1715 | .Ek | ||
| 1716 | .Pp | ||
| 1717 | The | ||
| 1718 | .Nm crl | ||
| 1719 | command processes CRL files in DER or PEM format. | ||
| 1720 | .Pp | ||
| 1721 | The options are as follows: | ||
| 1722 | .Bl -tag -width "XXXX" | ||
| 1723 | .It Fl CAfile Ar file | ||
| 1724 | Verify the signature on a CRL by looking up the issuing certificate in | ||
| 1725 | .Ar file . | ||
| 1726 | .It Fl CApath Ar directory | ||
| 1727 | Verify the signature on a CRL by looking up the issuing certificate in | ||
| 1728 | .Ar dir . | ||
| 1729 | This directory must be a standard certificate directory, | ||
| 1730 | i.e. a hash of each subject name (using | ||
| 1731 | .Cm x509 Fl hash ) | ||
| 1732 | should be linked to each certificate. | ||
| 1733 | .It Fl fingerprint | ||
| 1734 | Print the CRL fingerprint. | ||
| 1735 | .It Fl hash | ||
| 1736 | Output a hash of the issuer name. | ||
| 1737 | This can be used to look up CRLs in a directory by issuer name. | ||
| 1738 | .It Fl in Ar file | ||
| 1739 | This specifies the input file to read from, or standard input if this | ||
| 1740 | option is not specified. | ||
| 1741 | .It Fl inform Ar DER | PEM | ||
| 1742 | This specifies the input format. | ||
| 1743 | .Ar DER | ||
| 1744 | format is a DER-encoded CRL structure. | ||
| 1745 | .Ar PEM | ||
| 1746 | .Pq the default | ||
| 1747 | is a base64-encoded version of the DER form with header and footer lines. | ||
| 1748 | .It Fl issuer | ||
| 1749 | Output the issuer name. | ||
| 1750 | .It Fl lastupdate | ||
| 1751 | Output the | ||
| 1752 | .Ar lastUpdate | ||
| 1753 | field. | ||
| 1754 | .It Fl nextupdate | ||
| 1755 | Output the | ||
| 1756 | .Ar nextUpdate | ||
| 1757 | field. | ||
| 1758 | .It Fl noout | ||
| 1759 | Don't output the encoded version of the CRL. | ||
| 1760 | .It Fl out Ar file | ||
| 1761 | Specifies the output file to write to, or standard output by | ||
| 1762 | default. | ||
| 1763 | .It Fl outform Ar DER | PEM | ||
| 1764 | This specifies the output format; the options have the same meaning as the | ||
| 1765 | .Fl inform | ||
| 1766 | option. | ||
| 1767 | .It Fl text | ||
| 1768 | Print out the CRL in text form. | ||
| 1769 | .El | ||
| 1770 | .Sh CRL NOTES | ||
| 1771 | The PEM CRL format uses the header and footer lines: | ||
| 1772 | .Bd -unfilled -offset indent | ||
| 1773 | -----BEGIN X509 CRL----- | ||
| 1774 | -----END X509 CRL----- | ||
| 1775 | .Ed | ||
| 1776 | .Sh CRL EXAMPLES | ||
| 1777 | Convert a CRL file from PEM to DER: | ||
| 1778 | .Pp | ||
| 1779 | .Dl $ openssl crl -in crl.pem -outform DER -out crl.der | ||
| 1780 | .Pp | ||
| 1781 | Output the text form of a DER-encoded certificate: | ||
| 1782 | .Pp | ||
| 1783 | .Dl $ openssl crl -in crl.der -inform DER -text -noout | ||
| 1784 | .Sh CRL BUGS | ||
| 1785 | Ideally, it should be possible to create a CRL using appropriate options | ||
| 1786 | and files too. | ||
| 1787 | .\" | ||
| 1788 | .\" CRL2PKCS7 | ||
| 1789 | .\" | ||
| 1790 | .Sh CRL2PKCS7 | ||
| 1791 | .Nm openssl crl2pkcs7 | ||
| 1792 | .Bk -words | ||
| 1793 | .Op Fl nocrl | ||
| 1794 | .Op Fl certfile Ar file | ||
| 1795 | .Op Fl in Ar file | ||
| 1796 | .Op Fl inform Ar DER | PEM | ||
| 1797 | .Op Fl out Ar file | ||
| 1798 | .Op Fl outform Ar DER | PEM | ||
| 1799 | .Ek | ||
| 1800 | .Pp | ||
| 1801 | The | ||
| 1802 | .Nm crl2pkcs7 | ||
| 1803 | command takes an optional CRL and one or more | ||
| 1804 | certificates and converts them into a PKCS#7 degenerate | ||
| 1805 | .Qq certificates only | ||
| 1806 | structure. | ||
| 1807 | .Pp | ||
| 1808 | The options are as follows: | ||
| 1809 | .Bl -tag -width "XXXX" | ||
| 1810 | .It Fl certfile Ar file | ||
| 1811 | Specifies a | ||
| 1812 | .Ar file | ||
| 1813 | containing one or more certificates in PEM format. | ||
| 1814 | All certificates in the file will be added to the PKCS#7 structure. | ||
| 1815 | This option can be used more than once to read certificates from multiple | ||
| 1816 | files. | ||
| 1817 | .It Fl in Ar file | ||
| 1818 | This specifies the input | ||
| 1819 | .Ar file | ||
| 1820 | to read a CRL from, or standard input if this option is not specified. | ||
| 1821 | .It Fl inform Ar DER | PEM | ||
| 1822 | This specifies the CRL input format. | ||
| 1823 | .Ar DER | ||
| 1824 | format is a DER-encoded CRL structure. | ||
| 1825 | .Ar PEM | ||
| 1826 | .Pq the default | ||
| 1827 | is a base64-encoded version of the DER form with header and footer lines. | ||
| 1828 | .It Fl nocrl | ||
| 1829 | Normally, a CRL is included in the output file. | ||
| 1830 | With this option, no CRL is | ||
| 1831 | included in the output file and a CRL is not read from the input file. | ||
| 1832 | .It Fl out Ar file | ||
| 1833 | Specifies the output | ||
| 1834 | .Ar file | ||
| 1835 | to write the PKCS#7 structure to, or standard output by default. | ||
| 1836 | .It Fl outform Ar DER | PEM | ||
| 1837 | This specifies the PKCS#7 structure output format. | ||
| 1838 | .Ar DER | ||
| 1839 | format is a DER-encoded PKCS#7 structure. | ||
| 1840 | .Ar PEM | ||
| 1841 | .Pq the default | ||
| 1842 | is a base64-encoded version of the DER form with header and footer lines. | ||
| 1843 | .El | ||
| 1844 | .Sh CRL2PKCS7 EXAMPLES | ||
| 1845 | Create a PKCS#7 structure from a certificate and CRL: | ||
| 1846 | .Pp | ||
| 1847 | .Dl $ openssl crl2pkcs7 -in crl.pem -certfile cert.pem -out p7.pem | ||
| 1848 | .Pp | ||
| 1849 | Create a PKCS#7 structure in DER format with no CRL from several | ||
| 1850 | different certificates: | ||
| 1851 | .Bd -literal -offset indent | ||
| 1852 | $ openssl crl2pkcs7 -nocrl -certfile newcert.pem \e | ||
| 1853 | -certfile demoCA/cacert.pem -outform DER -out p7.der | ||
| 1854 | .Ed | ||
| 1855 | .Sh CRL2PKCS7 NOTES | ||
| 1856 | The output file is a PKCS#7 signed data structure containing no signers and | ||
| 1857 | just certificates and an optional CRL. | ||
| 1858 | .Pp | ||
| 1859 | This utility can be used to send certificates and CAs to Netscape as part of | ||
| 1860 | the certificate enrollment process. | ||
| 1861 | This involves sending the DER-encoded output | ||
| 1862 | as MIME type | ||
| 1863 | .Em application/x-x509-user-cert . | ||
| 1864 | .Pp | ||
| 1865 | The PEM-encoded form with the header and footer lines removed can be used to | ||
| 1866 | install user certificates and CAs in MSIE using the Xenroll control. | ||
| 1867 | .\" | ||
| 1868 | .\" DGST | ||
| 1869 | .\" | ||
| 1870 | .Sh DGST | ||
| 1871 | .Nm openssl dgst | ||
| 1872 | .Bk -words | ||
| 1873 | .Oo | ||
| 1874 | .Fl dss1 | md2 | md4 | md5 | | ||
| 1875 | .Fl ripemd160 | sha | sha1 | ||
| 1876 | .Oc | ||
| 1877 | .Op Fl binary | ||
| 1878 | .Op Fl c | ||
| 1879 | .Op Fl d | ||
| 1880 | .Op Fl hex | ||
| 1881 | .Op Fl hmac Ar key | ||
| 1882 | .Op Fl engine Ar id | ||
| 1883 | .Op Fl keyform Ar ENGINE | PEM | ||
| 1884 | .Op Fl out Ar file | ||
| 1885 | .Op Fl passin Ar arg | ||
| 1886 | .Op Fl prverify Ar file | ||
| 1887 | .Op Fl rand Ar file ... | ||
| 1888 | .Op Fl sign Ar file | ||
| 1889 | .Op Fl signature Ar file | ||
| 1890 | .Op Fl verify Ar file | ||
| 1891 | .Op Ar file ... | ||
| 1892 | .Ek | ||
| 1893 | .Pp | ||
| 1894 | .Nm openssl | ||
| 1895 | .Xo | ||
| 1896 | .Cm md2 | md4 | md5 | | ||
| 1897 | .Cm ripemd160 | sha | sha1 | ||
| 1898 | .Xc | ||
| 1899 | .Op Fl c | ||
| 1900 | .Op Fl d | ||
| 1901 | .Op Ar file ... | ||
| 1902 | .Pp | ||
| 1903 | The digest functions output the message digest of a supplied | ||
| 1904 | .Ar file | ||
| 1905 | or | ||
| 1906 | .Ar files | ||
| 1907 | in hexadecimal form. | ||
| 1908 | They can also be used for digital signing and verification. | ||
| 1909 | .Pp | ||
| 1910 | The options are as follows: | ||
| 1911 | .Bl -tag -width "-binary" | ||
| 1912 | .It Fl binary | ||
| 1913 | Output the digest or signature in binary form. | ||
| 1914 | .It Fl c | ||
| 1915 | Print out the digest in two-digit groups separated by colons; only relevant if | ||
| 1916 | .Em hex | ||
| 1917 | format output is used. | ||
| 1918 | .It Fl d | ||
| 1919 | Print out BIO debugging information. | ||
| 1920 | .It Fl engine Ar id | ||
| 1921 | Specifying an engine (by it's unique | ||
| 1922 | .Ar id | ||
| 1923 | string) will cause | ||
| 1924 | .Nm dgst | ||
| 1925 | to attempt to obtain a functional reference to the specified engine, | ||
| 1926 | thus initialising it if needed. | ||
| 1927 | The engine will then be set as the default for all available algorithms. | ||
| 1928 | .It Fl hex | ||
| 1929 | Digest is to be output as a hex dump. | ||
| 1930 | This is the default case for a | ||
| 1931 | .Qq normal | ||
| 1932 | digest as opposed to a digital signature. | ||
| 1933 | .It Fl hmac Ar key | ||
| 1934 | Create a hashed MAC using | ||
| 1935 | .Ar key . | ||
| 1936 | .It Fl keyform Ar ENGINE | PEM | ||
| 1937 | Key file format. | ||
| 1938 | .It Fl out Ar file | ||
| 1939 | The file to output to, or standard output by default. | ||
| 1940 | .It Fl passin Ar arg | ||
| 1941 | The key password source. | ||
| 1942 | For more information about the format of | ||
| 1943 | .Ar arg , | ||
| 1944 | see the | ||
| 1945 | .Sx PASS PHRASE ARGUMENTS | ||
| 1946 | section above. | ||
| 1947 | .It Fl prverify Ar file | ||
| 1948 | Verify the signature using the private key in | ||
| 1949 | .Ar file . | ||
| 1950 | The output is either | ||
| 1951 | .Qq Verification OK | ||
| 1952 | or | ||
| 1953 | .Qq Verification Failure . | ||
| 1954 | .It Fl rand Ar file ... | ||
| 1955 | A file or files containing random data used to seed the random number | ||
| 1956 | generator, or an EGD socket (see | ||
| 1957 | .Xr RAND_egd 3 ) . | ||
| 1958 | Multiple files can be specified separated by a | ||
| 1959 | .Sq \&: . | ||
| 1960 | .It Fl sign Ar file | ||
| 1961 | Digitally sign the digest using the private key in | ||
| 1962 | .Ar file . | ||
| 1963 | .It Fl signature Ar file | ||
| 1964 | The actual signature to verify. | ||
| 1965 | .It Fl verify Ar file | ||
| 1966 | Verify the signature using the public key in | ||
| 1967 | .Ar file . | ||
| 1968 | The output is either | ||
| 1969 | .Qq Verification OK | ||
| 1970 | or | ||
| 1971 | .Qq Verification Failure . | ||
| 1972 | .It Ar file ... | ||
| 1973 | File or files to digest. | ||
| 1974 | If no files are specified then standard input is used. | ||
| 1975 | .El | ||
| 1976 | .Sh DGST NOTES | ||
| 1977 | The digest of choice for all new applications is SHA1. | ||
| 1978 | Other digests are, however, still widely used. | ||
| 1979 | .Pp | ||
| 1980 | If you wish to sign or verify data using the DSA algorithm, the dss1 | ||
| 1981 | digest must be used. | ||
| 1982 | .Pp | ||
| 1983 | A source of random numbers is required for certain signing algorithms, in | ||
| 1984 | particular DSA. | ||
| 1985 | .Pp | ||
| 1986 | The signing and verify options should only be used if a single file is | ||
| 1987 | being signed or verified. | ||
| 1988 | .\" | ||
| 1989 | .\" DH | ||
| 1990 | .\" | ||
| 1991 | .Sh DH | ||
| 1992 | Diffie-Hellman Parameter Management. | ||
| 1993 | The | ||
| 1994 | .Nm dh | ||
| 1995 | command has been replaced by | ||
| 1996 | .Nm dhparam . | ||
| 1997 | See | ||
| 1998 | .Sx DHPARAM | ||
| 1999 | below. | ||
| 2000 | .\" | ||
| 2001 | .\" DHPARAM | ||
| 2002 | .\" | ||
| 2003 | .Sh DHPARAM | ||
| 2004 | .Nm openssl dhparam | ||
| 2005 | .Bk -words | ||
| 2006 | .Op Fl 2 | 5 | ||
| 2007 | .Op Fl C | ||
| 2008 | .Op Fl check | ||
| 2009 | .Op Fl dsaparam | ||
| 2010 | .Op Fl noout | ||
| 2011 | .Op Fl text | ||
| 2012 | .Op Fl engine Ar id | ||
| 2013 | .Op Fl in Ar file | ||
| 2014 | .Op Fl inform Ar DER | PEM | ||
| 2015 | .Op Fl out Ar file | ||
| 2016 | .Op Fl outform Ar DER | PEM | ||
| 2017 | .Op Fl rand Ar file ... | ||
| 2018 | .Op Ar numbits | ||
| 2019 | .Ek | ||
| 2020 | .Pp | ||
| 2021 | The | ||
| 2022 | .Nm dhparam | ||
| 2023 | command is used to manipulate DH parameter files. | ||
| 2024 | .Pp | ||
| 2025 | The options are as follows: | ||
| 2026 | .Bl -tag -width "XXXX" | ||
| 2027 | .It Fl 2 , 5 | ||
| 2028 | The generator to use, either 2 or 5. | ||
| 2029 | 2 is the default. | ||
| 2030 | If present, the input file is ignored and parameters are generated instead. | ||
| 2031 | .It Fl C | ||
| 2032 | This option converts the parameters into C code. | ||
| 2033 | The parameters can then be loaded by calling the | ||
| 2034 | .Cm get_dh Ns Ar numbits Ns Li () | ||
| 2035 | function. | ||
| 2036 | .It Fl check | ||
| 2037 | Check the DH parameters. | ||
| 2038 | .It Fl dsaparam | ||
| 2039 | If this option is used, DSA rather than DH parameters are read or created; | ||
| 2040 | they are converted to DH format. | ||
| 2041 | Otherwise, | ||
| 2042 | .Qq strong | ||
| 2043 | primes | ||
| 2044 | .Pq such that (p-1)/2 is also prime | ||
| 2045 | will be used for DH parameter generation. | ||
| 2046 | .Pp | ||
| 2047 | DH parameter generation with the | ||
| 2048 | .Fl dsaparam | ||
| 2049 | option is much faster, | ||
| 2050 | and the recommended exponent length is shorter, | ||
| 2051 | which makes DH key exchange more efficient. | ||
| 2052 | Beware that with such DSA-style DH parameters, | ||
| 2053 | a fresh DH key should be created for each use to | ||
| 2054 | avoid small-subgroup attacks that may be possible otherwise. | ||
| 2055 | .It Fl engine Ar id | ||
| 2056 | Specifying an engine (by it's unique | ||
| 2057 | .Ar id | ||
| 2058 | string) will cause | ||
| 2059 | .Nm dhparam | ||
| 2060 | to attempt to obtain a functional reference to the specified engine, | ||
| 2061 | thus initialising it if needed. | ||
| 2062 | The engine will then be set as the default for all available algorithms. | ||
| 2063 | .It Fl in Ar file | ||
| 2064 | This specifies the input | ||
| 2065 | .Ar file | ||
| 2066 | to read parameters from, or standard input if this option is not specified. | ||
| 2067 | .It Fl inform Ar DER | PEM | ||
| 2068 | This specifies the input format. | ||
| 2069 | The argument | ||
| 2070 | .Ar DER | ||
| 2071 | uses an ASN1 DER-encoded form compatible with the PKCS#3 DHparameter | ||
| 2072 | structure. | ||
| 2073 | The | ||
| 2074 | .Ar PEM | ||
| 2075 | form is the default format: | ||
| 2076 | it consists of the DER format base64-encoded with | ||
| 2077 | additional header and footer lines. | ||
| 2078 | .It Fl noout | ||
| 2079 | This option inhibits the output of the encoded version of the parameters. | ||
| 2080 | .It Ar numbits | ||
| 2081 | This argument specifies that a parameter set should be generated of size | ||
| 2082 | .Ar numbits . | ||
| 2083 | It must be the last option. | ||
| 2084 | If not present, a value of 512 is used. | ||
| 2085 | If this value is present, the input file is ignored and | ||
| 2086 | parameters are generated instead. | ||
| 2087 | .It Fl out Ar file | ||
| 2088 | This specifies the output | ||
| 2089 | .Ar file | ||
| 2090 | to write parameters to. | ||
| 2091 | Standard output is used if this option is not present. | ||
| 2092 | The output filename should | ||
| 2093 | .Em not | ||
| 2094 | be the same as the input filename. | ||
| 2095 | .It Fl outform Ar DER | PEM | ||
| 2096 | This specifies the output format; the options have the same meaning as the | ||
| 2097 | .Fl inform | ||
| 2098 | option. | ||
| 2099 | .It Fl rand Ar file ... | ||
| 2100 | A file or files containing random data used to seed the random number generator, | ||
| 2101 | or an EGD socket (see | ||
| 2102 | .Xr RAND_egd 3 ) . | ||
| 2103 | Multiple files can be specified, separated by a | ||
| 2104 | .Sq \&: . | ||
| 2105 | .It Fl text | ||
| 2106 | This option prints out the DH parameters in human readable form. | ||
| 2107 | .El | ||
| 2108 | .Sh DHPARAM WARNINGS | ||
| 2109 | The program | ||
| 2110 | .Nm dhparam | ||
| 2111 | combines the functionality of the programs | ||
| 2112 | .Nm dh | ||
| 2113 | and | ||
| 2114 | .Nm gendh | ||
| 2115 | in previous versions of | ||
| 2116 | .Nm OpenSSL | ||
| 2117 | and | ||
| 2118 | .Nm SSLeay . | ||
| 2119 | The | ||
| 2120 | .Nm dh | ||
| 2121 | and | ||
| 2122 | .Nm gendh | ||
| 2123 | programs are retained for now, but may have different purposes in future | ||
| 2124 | versions of | ||
| 2125 | .Nm OpenSSL . | ||
| 2126 | .Sh DHPARAM NOTES | ||
| 2127 | PEM format DH parameters use the header and footer lines: | ||
| 2128 | .Bd -unfilled -offset indent | ||
| 2129 | -----BEGIN DH PARAMETERS----- | ||
| 2130 | -----END DH PARAMETERS----- | ||
| 2131 | .Ed | ||
| 2132 | .Pp | ||
| 2133 | .Nm OpenSSL | ||
| 2134 | currently only supports the older PKCS#3 DH, | ||
| 2135 | not the newer X9.42 DH. | ||
| 2136 | .Pp | ||
| 2137 | This program manipulates DH parameters not keys. | ||
| 2138 | .Sh DHPARAM BUGS | ||
| 2139 | There should be a way to generate and manipulate DH keys. | ||
| 2140 | .Sh DHPARAM HISTORY | ||
| 2141 | The | ||
| 2142 | .Nm dhparam | ||
| 2143 | command was added in | ||
| 2144 | .Nm OpenSSL | ||
| 2145 | 0.9.5. | ||
| 2146 | The | ||
| 2147 | .Fl dsaparam | ||
| 2148 | option was added in | ||
| 2149 | .Nm OpenSSL | ||
| 2150 | 0.9.6. | ||
| 2151 | .\" | ||
| 2152 | .\" DSA | ||
| 2153 | .\" | ||
| 2154 | .Sh DSA | ||
| 2155 | .Nm openssl dsa | ||
| 2156 | .Bk -words | ||
| 2157 | .Oo | ||
| 2158 | .Fl aes128 | aes192 | aes256 | | ||
| 2159 | .Fl des | des3 | ||
| 2160 | .Oc | ||
| 2161 | .Op Fl modulus | ||
| 2162 | .Op Fl noout | ||
| 2163 | .Op Fl pubin | ||
| 2164 | .Op Fl pubout | ||
| 2165 | .Op Fl text | ||
| 2166 | .Op Fl engine Ar id | ||
| 2167 | .Op Fl in Ar file | ||
| 2168 | .Op Fl inform Ar DER | PEM | ||
| 2169 | .Op Fl out Ar file | ||
| 2170 | .Op Fl outform Ar DER | PEM | ||
| 2171 | .Op Fl passin Ar arg | ||
| 2172 | .Op Fl passout Ar arg | ||
| 2173 | .Ek | ||
| 2174 | .Pp | ||
| 2175 | The | ||
| 2176 | .Nm dsa | ||
| 2177 | command processes DSA keys. | ||
| 2178 | They can be converted between various forms and their components printed out. | ||
| 2179 | .Pp | ||
| 2180 | .Sy Note : | ||
| 2181 | This command uses the traditional | ||
| 2182 | .Nm SSLeay | ||
| 2183 | compatible format for private key encryption: | ||
| 2184 | newer applications should use the more secure PKCS#8 format using the | ||
| 2185 | .Nm pkcs8 | ||
| 2186 | command. | ||
| 2187 | .Pp | ||
| 2188 | The options are as follows: | ||
| 2189 | .Bl -tag -width "XXXX" | ||
| 2190 | .It Xo | ||
| 2191 | .Fl aes128 | aes192 | aes256 | | ||
| 2192 | .Fl des | des3 | ||
| 2193 | .Xc | ||
| 2194 | These options encrypt the private key with the AES, DES, or the triple DES | ||
| 2195 | ciphers, respectively, before outputting it. | ||
| 2196 | A pass phrase is prompted for. | ||
| 2197 | If none of these options is specified, the key is written in plain text. | ||
| 2198 | This means that using the | ||
| 2199 | .Nm dsa | ||
| 2200 | utility to read in an encrypted key with no encryption option can be used to | ||
| 2201 | remove the pass phrase from a key, | ||
| 2202 | or by setting the encryption options it can be use to add or change | ||
| 2203 | the pass phrase. | ||
| 2204 | These options can only be used with PEM format output files. | ||
| 2205 | .It Fl engine Ar id | ||
| 2206 | Specifying an engine (by it's unique | ||
| 2207 | .Ar id | ||
| 2208 | string) will cause | ||
| 2209 | .Nm dsa | ||
| 2210 | to attempt to obtain a functional reference to the specified engine, | ||
| 2211 | thus initialising it if needed. | ||
| 2212 | The engine will then be set as the default for all available algorithms. | ||
| 2213 | .It Fl in Ar file | ||
| 2214 | This specifies the input | ||
| 2215 | .Ar file | ||
| 2216 | to read a key from, or standard input if this option is not specified. | ||
| 2217 | If the key is encrypted, a pass phrase will be prompted for. | ||
| 2218 | .It Fl inform Ar DER | PEM | ||
| 2219 | This specifies the input format. | ||
| 2220 | The | ||
| 2221 | .Ar DER | ||
| 2222 | argument with a private key uses an ASN1 DER-encoded form of an ASN.1 | ||
| 2223 | SEQUENCE consisting of the values of version | ||
| 2224 | .Pq currently zero , | ||
| 2225 | P, Q, G, | ||
| 2226 | and the public and private key components, respectively, as ASN.1 INTEGERs. | ||
| 2227 | When used with a public key it uses a | ||
| 2228 | .Em SubjectPublicKeyInfo | ||
| 2229 | structure: it is an error if the key is not DSA. | ||
| 2230 | .Pp | ||
| 2231 | The | ||
| 2232 | .Ar PEM | ||
| 2233 | form is the default format: | ||
| 2234 | it consists of the DER format base64-encoded with additional header and footer | ||
| 2235 | lines. | ||
| 2236 | In the case of a private key, PKCS#8 format is also accepted. | ||
| 2237 | .It Fl modulus | ||
| 2238 | This option prints out the value of the public key component of the key. | ||
| 2239 | .It Fl noout | ||
| 2240 | This option prevents output of the encoded version of the key. | ||
| 2241 | .It Fl out Ar file | ||
| 2242 | This specifies the output | ||
| 2243 | .Ar file | ||
| 2244 | to write a key to, or standard output if not specified. | ||
| 2245 | If any encryption options are set then a pass phrase will be | ||
| 2246 | prompted for. | ||
| 2247 | The output filename should | ||
| 2248 | .Em not | ||
| 2249 | be the same as the input filename. | ||
| 2250 | .It Fl outform Ar DER | PEM | ||
| 2251 | This specifies the output format; the options have the same meaning as the | ||
| 2252 | .Fl inform | ||
| 2253 | option. | ||
| 2254 | .It Fl passin Ar arg | ||
| 2255 | The input file password source. | ||
| 2256 | For more information about the format of | ||
| 2257 | .Ar arg , | ||
| 2258 | see the | ||
| 2259 | .Sx PASS PHRASE ARGUMENTS | ||
| 2260 | section above. | ||
| 2261 | .It Fl passout Ar arg | ||
| 2262 | The output file password source. | ||
| 2263 | For more information about the format of | ||
| 2264 | .Ar arg , | ||
| 2265 | see the | ||
| 2266 | .Sx PASS PHRASE ARGUMENTS | ||
| 2267 | section above. | ||
| 2268 | .It Fl pubin | ||
| 2269 | By default, a private key is read from the input file. | ||
| 2270 | With this option a public key is read instead. | ||
| 2271 | .It Fl pubout | ||
| 2272 | By default, a private key is output. | ||
| 2273 | With this option a public key will be output instead. | ||
| 2274 | This option is automatically set if the input is a public key. | ||
| 2275 | .It Fl text | ||
| 2276 | Prints out the public/private key components and parameters. | ||
| 2277 | .El | ||
| 2278 | .Sh DSA NOTES | ||
| 2279 | The PEM private key format uses the header and footer lines: | ||
| 2280 | .Bd -unfilled -offset indent | ||
| 2281 | -----BEGIN DSA PRIVATE KEY----- | ||
| 2282 | -----END DSA PRIVATE KEY----- | ||
| 2283 | .Ed | ||
| 2284 | .Pp | ||
| 2285 | The PEM public key format uses the header and footer lines: | ||
| 2286 | .Bd -unfilled -offset indent | ||
| 2287 | -----BEGIN PUBLIC KEY----- | ||
| 2288 | -----END PUBLIC KEY----- | ||
| 2289 | .Ed | ||
| 2290 | .Sh DSA EXAMPLES | ||
| 2291 | To remove the pass phrase on a DSA private key: | ||
| 2292 | .Pp | ||
| 2293 | .Dl $ openssl dsa -in key.pem -out keyout.pem | ||
| 2294 | .Pp | ||
| 2295 | To encrypt a private key using triple DES: | ||
| 2296 | .Pp | ||
| 2297 | .Dl $ openssl dsa -in key.pem -des3 -out keyout.pem | ||
| 2298 | .Pp | ||
| 2299 | To convert a private key from PEM to DER format: | ||
| 2300 | .Pp | ||
| 2301 | .Dl $ openssl dsa -in key.pem -outform DER -out keyout.der | ||
| 2302 | .Pp | ||
| 2303 | To print out the components of a private key to standard output: | ||
| 2304 | .Pp | ||
| 2305 | .Dl $ openssl dsa -in key.pem -text -noout | ||
| 2306 | .Pp | ||
| 2307 | To just output the public part of a private key: | ||
| 2308 | .Pp | ||
| 2309 | .Dl $ openssl dsa -in key.pem -pubout -out pubkey.pem | ||
| 2310 | .\" | ||
| 2311 | .\" DSAPARAM | ||
| 2312 | .\" | ||
| 2313 | .Sh DSAPARAM | ||
| 2314 | .Nm openssl dsaparam | ||
| 2315 | .Bk -words | ||
| 2316 | .Op Fl C | ||
| 2317 | .Op Fl genkey | ||
| 2318 | .Op Fl noout | ||
| 2319 | .Op Fl text | ||
| 2320 | .Op Fl engine Ar id | ||
| 2321 | .Op Fl in Ar file | ||
| 2322 | .Op Fl inform Ar DER | PEM | ||
| 2323 | .Op Fl out Ar file | ||
| 2324 | .Op Fl outform Ar DER | PEM | ||
| 2325 | .Op Fl rand Ar file ... | ||
| 2326 | .Op Ar numbits | ||
| 2327 | .Ek | ||
| 2328 | .Pp | ||
| 2329 | The | ||
| 2330 | .Nm dsaparam | ||
| 2331 | command is used to manipulate or generate DSA parameter files. | ||
| 2332 | .Pp | ||
| 2333 | The options are as follows: | ||
| 2334 | .Bl -tag -width "XXXX" | ||
| 2335 | .It Fl C | ||
| 2336 | This option converts the parameters into C code. | ||
| 2337 | The parameters can then be loaded by calling the | ||
| 2338 | .Cm get_dsa Ns Ar XXX Ns Li () | ||
| 2339 | function. | ||
| 2340 | .It Fl engine Ar id | ||
| 2341 | Specifying an engine (by it's unique | ||
| 2342 | .Ar id | ||
| 2343 | string) will cause | ||
| 2344 | .Nm dsaparam | ||
| 2345 | to attempt to obtain a functional reference to the specified engine, | ||
| 2346 | thus initialising it if needed. | ||
| 2347 | The engine will then be set as the default for all available algorithms. | ||
| 2348 | .It Fl genkey | ||
| 2349 | This option will generate a DSA either using the specified or generated | ||
| 2350 | parameters. | ||
| 2351 | .It Fl in Ar file | ||
| 2352 | This specifies the input | ||
| 2353 | .Ar file | ||
| 2354 | to read parameters from, or standard input if this option is not specified. | ||
| 2355 | If the | ||
| 2356 | .Ar numbits | ||
| 2357 | parameter is included, then this option will be ignored. | ||
| 2358 | .It Fl inform Ar DER | PEM | ||
| 2359 | This specifies the input format. | ||
| 2360 | The | ||
| 2361 | .Ar DER | ||
| 2362 | argument uses an ASN1 DER-encoded form compatible with RFC 2459 | ||
| 2363 | .Pq PKIX | ||
| 2364 | DSS-Parms that is a SEQUENCE consisting of p, q and g, respectively. | ||
| 2365 | The | ||
| 2366 | .Ar PEM | ||
| 2367 | form is the default format: | ||
| 2368 | it consists of the DER format base64-encoded with additional header | ||
| 2369 | and footer lines. | ||
| 2370 | .It Fl noout | ||
| 2371 | This option inhibits the output of the encoded version of the parameters. | ||
| 2372 | .It Ar numbits | ||
| 2373 | This option specifies that a parameter set should be generated of size | ||
| 2374 | .Ar numbits . | ||
| 2375 | If this option is included, the input file | ||
| 2376 | .Pq if any | ||
| 2377 | is ignored. | ||
| 2378 | .It Fl out Ar file | ||
| 2379 | This specifies the output | ||
| 2380 | .Ar file | ||
| 2381 | to write parameters to. | ||
| 2382 | Standard output is used if this option is not present. | ||
| 2383 | The output filename should | ||
| 2384 | .Em not | ||
| 2385 | be the same as the input filename. | ||
| 2386 | .It Fl outform Ar DER | PEM | ||
| 2387 | This specifies the output format; the options have the same meaning as the | ||
| 2388 | .Fl inform | ||
| 2389 | option. | ||
| 2390 | .It Fl rand Ar file ... | ||
| 2391 | A file or files containing random data used to seed the random number | ||
| 2392 | generator, or an EGD socket (see | ||
| 2393 | .Xr RAND_egd 3 ) . | ||
| 2394 | Multiple files can be specified, separated by a | ||
| 2395 | .Sq \&: . | ||
| 2396 | .It Fl text | ||
| 2397 | This option prints out the DSA parameters in human readable form. | ||
| 2398 | .El | ||
| 2399 | .Sh DSAPARAM NOTES | ||
| 2400 | PEM format DSA parameters use the header and footer lines: | ||
| 2401 | .Bd -unfilled -offset indent | ||
| 2402 | -----BEGIN DSA PARAMETERS----- | ||
| 2403 | -----END DSA PARAMETERS----- | ||
| 2404 | .Ed | ||
| 2405 | .Pp | ||
| 2406 | DSA parameter generation is a slow process and as a result the same set of | ||
| 2407 | DSA parameters is often used to generate several distinct keys. | ||
| 2408 | .\" | ||
| 2409 | .\" ENC | ||
| 2410 | .\" | ||
| 2411 | .Sh ENC | ||
| 2412 | .Nm openssl enc | ||
| 2413 | .Bk -words | ||
| 2414 | .Fl ciphername | ||
| 2415 | .Op Fl AadePp | ||
| 2416 | .Op Fl debug | ||
| 2417 | .Op Fl engine Ar id | ||
| 2418 | .Op Fl nopad | ||
| 2419 | .Op Fl nosalt | ||
| 2420 | .Op Fl salt | ||
| 2421 | .Op Fl bufsize Ar number | ||
| 2422 | .Op Fl in Ar file | ||
| 2423 | .Op Fl iv Ar IV | ||
| 2424 | .Op Fl K Ar key | ||
| 2425 | .Op Fl k Ar password | ||
| 2426 | .Op Fl kfile Ar file | ||
| 2427 | .Op Fl out Ar file | ||
| 2428 | .Op Fl pass Ar arg | ||
| 2429 | .Op Fl S Ar salt | ||
| 2430 | .Ek | ||
| 2431 | .Pp | ||
| 2432 | The symmetric cipher commands allow data to be encrypted or decrypted | ||
| 2433 | using various block and stream ciphers using keys based on passwords | ||
| 2434 | or explicitly provided. | ||
| 2435 | Base64 encoding or decoding can also be performed either by itself | ||
| 2436 | or in addition to the encryption or decryption. | ||
| 2437 | .Pp | ||
| 2438 | The options are as follows: | ||
| 2439 | .Bl -tag -width "XXXX" | ||
| 2440 | .It Fl A | ||
| 2441 | If the | ||
| 2442 | .Fl a | ||
| 2443 | option is set, then base64 process the data on one line. | ||
| 2444 | .It Fl a | ||
| 2445 | Base64 process the data. | ||
| 2446 | This means that if encryption is taking place, the data is base64-encoded | ||
| 2447 | after encryption. | ||
| 2448 | If decryption is set, the input data is base64 decoded before | ||
| 2449 | being decrypted. | ||
| 2450 | .It Fl bufsize Ar number | ||
| 2451 | Set the buffer size for I/O. | ||
| 2452 | .It Fl d | ||
| 2453 | Decrypt the input data. | ||
| 2454 | .It Fl debug | ||
| 2455 | Debug the BIOs used for I/O. | ||
| 2456 | .It Fl e | ||
| 2457 | Encrypt the input data: this is the default. | ||
| 2458 | .It Fl engine Ar id | ||
| 2459 | Specifying an engine (by it's unique | ||
| 2460 | .Ar id | ||
| 2461 | string) will cause | ||
| 2462 | .Nm enc | ||
| 2463 | to attempt to obtain a functional reference to the specified engine, | ||
| 2464 | thus initialising it if needed. | ||
| 2465 | The engine will then be set as the default for all available algorithms. | ||
| 2466 | .It Fl in Ar file | ||
| 2467 | The input | ||
| 2468 | .Ar file ; | ||
| 2469 | standard input by default. | ||
| 2470 | .It Fl iv Ar IV | ||
| 2471 | The actual | ||
| 2472 | .Ar IV | ||
| 2473 | .Pq initialisation vector | ||
| 2474 | to use: | ||
| 2475 | this must be represented as a string comprised only of hex digits. | ||
| 2476 | When only the | ||
| 2477 | .Ar key | ||
| 2478 | is specified using the | ||
| 2479 | .Fl K | ||
| 2480 | option, the | ||
| 2481 | .Ar IV | ||
| 2482 | must explicitly be defined. | ||
| 2483 | When a password is being specified using one of the other options, | ||
| 2484 | the | ||
| 2485 | .Ar IV | ||
| 2486 | is generated from this password. | ||
| 2487 | .It Fl K Ar key | ||
| 2488 | The actual | ||
| 2489 | .Ar key | ||
| 2490 | to use: | ||
| 2491 | this must be represented as a string comprised only of hex digits. | ||
| 2492 | If only the key is specified, the | ||
| 2493 | .Ar IV | ||
| 2494 | must be additionally specified using the | ||
| 2495 | .Fl iv | ||
| 2496 | option. | ||
| 2497 | When both a | ||
| 2498 | .Ar key | ||
| 2499 | and a | ||
| 2500 | .Ar password | ||
| 2501 | are specified, the | ||
| 2502 | .Ar key | ||
| 2503 | given with the | ||
| 2504 | .Fl K | ||
| 2505 | option will be used and the | ||
| 2506 | .Ar IV | ||
| 2507 | generated from the password will be taken. | ||
| 2508 | It probably does not make much sense to specify both | ||
| 2509 | .Ar key | ||
| 2510 | and | ||
| 2511 | .Ar password . | ||
| 2512 | .It Fl k Ar password | ||
| 2513 | The | ||
| 2514 | .Ar password | ||
| 2515 | to derive the key from. | ||
| 2516 | This is for compatibility with previous versions of | ||
| 2517 | .Nm OpenSSL . | ||
| 2518 | Superseded by the | ||
| 2519 | .Fl pass | ||
| 2520 | option. | ||
| 2521 | .It Fl kfile Ar file | ||
| 2522 | Read the password to derive the key from the first line of | ||
| 2523 | .Ar file . | ||
| 2524 | This is for compatibility with previous versions of | ||
| 2525 | .Nm OpenSSL . | ||
| 2526 | Superseded by the | ||
| 2527 | .Fl pass | ||
| 2528 | option. | ||
| 2529 | .It Fl nopad | ||
| 2530 | Disable standard block padding. | ||
| 2531 | .It Fl nosalt | ||
| 2532 | Don't use a | ||
| 2533 | .Ar salt | ||
| 2534 | in the key derivation routines. | ||
| 2535 | This option should | ||
| 2536 | .Em NEVER | ||
| 2537 | be used unless compatibility with previous versions of | ||
| 2538 | .Nm OpenSSL | ||
| 2539 | or | ||
| 2540 | .Nm SSLeay | ||
| 2541 | is required. | ||
| 2542 | .It Fl out Ar file | ||
| 2543 | The output | ||
| 2544 | .Ar file , | ||
| 2545 | standard output by default. | ||
| 2546 | .It Fl P | ||
| 2547 | Print out the | ||
| 2548 | .Ar salt , | ||
| 2549 | .Ar key , | ||
| 2550 | and | ||
| 2551 | .Ar IV | ||
| 2552 | used, then immediately exit; | ||
| 2553 | don't do any encryption or decryption. | ||
| 2554 | .It Fl p | ||
| 2555 | Print out the | ||
| 2556 | .Ar salt , | ||
| 2557 | .Ar key , | ||
| 2558 | and | ||
| 2559 | .Ar IV | ||
| 2560 | used. | ||
| 2561 | .It Fl pass Ar arg | ||
| 2562 | The password source. | ||
| 2563 | For more information about the format of | ||
| 2564 | .Ar arg , | ||
| 2565 | see the | ||
| 2566 | .Sx PASS PHRASE ARGUMENTS | ||
| 2567 | section above. | ||
| 2568 | .It Fl S Ar salt | ||
| 2569 | The actual | ||
| 2570 | .Ar salt | ||
| 2571 | to use: | ||
| 2572 | this must be represented as a string comprised only of hex digits. | ||
| 2573 | .It Fl salt | ||
| 2574 | Use a | ||
| 2575 | .Ar salt | ||
| 2576 | in the key derivation routines. | ||
| 2577 | This is the default. | ||
| 2578 | .El | ||
| 2579 | .Sh ENC NOTES | ||
| 2580 | The program can be called either as | ||
| 2581 | .Nm openssl ciphername | ||
| 2582 | or | ||
| 2583 | .Nm openssl enc -ciphername . | ||
| 2584 | .Pp | ||
| 2585 | A password will be prompted for to derive the | ||
| 2586 | .Ar key | ||
| 2587 | and | ||
| 2588 | .Ar IV | ||
| 2589 | if necessary. | ||
| 2590 | .Pp | ||
| 2591 | The | ||
| 2592 | .Fl nosalt | ||
| 2593 | option should | ||
| 2594 | .Em NEVER | ||
| 2595 | be used unless compatibility with previous versions of | ||
| 2596 | .Nm OpenSSL | ||
| 2597 | or | ||
| 2598 | .Nm SSLeay | ||
| 2599 | is required. | ||
| 2600 | .Pp | ||
| 2601 | With the | ||
| 2602 | .Fl nosalt | ||
| 2603 | option it is possible to perform efficient dictionary | ||
| 2604 | attacks on the password and to attack stream cipher encrypted data. | ||
| 2605 | The reason for this is that without the salt | ||
| 2606 | the same password always generates the same encryption key. | ||
| 2607 | When the salt | ||
| 2608 | is being used the first eight bytes of the encrypted data are reserved | ||
| 2609 | for the salt: | ||
| 2610 | it is generated at random when encrypting a file and read from the | ||
| 2611 | encrypted file when it is decrypted. | ||
| 2612 | .Pp | ||
| 2613 | Some of the ciphers do not have large keys and others have security | ||
| 2614 | implications if not used correctly. | ||
| 2615 | A beginner is advised to just use a strong block cipher in CBC mode | ||
| 2616 | such as bf or des3. | ||
| 2617 | .Pp | ||
| 2618 | All the block ciphers normally use PKCS#5 padding also known as standard block | ||
| 2619 | padding: | ||
| 2620 | this allows a rudimentary integrity or password check to be performed. | ||
| 2621 | However, since the chance of random data passing the test is | ||
| 2622 | better than 1 in 256, it isn't a very good test. | ||
| 2623 | .Pp | ||
| 2624 | If padding is disabled, the input data must be a multiple of the cipher | ||
| 2625 | block length. | ||
| 2626 | .Pp | ||
| 2627 | All RC2 ciphers have the same key and effective key length. | ||
| 2628 | .Pp | ||
| 2629 | Blowfish and RC5 algorithms use a 128-bit key. | ||
| 2630 | .Sh ENC SUPPORTED CIPHERS | ||
| 2631 | .Bd -unfilled -offset indent | ||
| 2632 | aes-128-cbc 128-bit AES in CBC mode | ||
| 2633 | aes-128-ecb 128-bit AES in ECB mode | ||
| 2634 | |||
| 2635 | aes-192-cbc 192-bit AES in CBC mode | ||
| 2636 | aes-192-ecb 192-bit AES in ECB mode | ||
| 2637 | |||
| 2638 | aes-256-cbc 256-bit AES in CBC mode | ||
| 2639 | aes-256-ecb 256-bit AES in ECB mode | ||
| 2640 | |||
| 2641 | base64 Base 64 | ||
| 2642 | |||
| 2643 | bf Alias for bf-cbc | ||
| 2644 | bf-cbc Blowfish in CBC mode | ||
| 2645 | bf-cfb Blowfish in CFB mode | ||
| 2646 | bf-ecb Blowfish in ECB mode | ||
| 2647 | bf-ofb Blowfish in OFB mode | ||
| 2648 | |||
| 2649 | cast Alias for cast-cbc | ||
| 2650 | cast-cbc CAST in CBC mode | ||
| 2651 | cast5-cbc CAST5 in CBC mode | ||
| 2652 | cast5-cfb CAST5 in CFB mode | ||
| 2653 | cast5-ecb CAST5 in ECB mode | ||
| 2654 | cast5-ofb CAST5 in OFB mode | ||
| 2655 | |||
| 2656 | des Alias for des-cbc | ||
| 2657 | des-cbc DES in CBC mode | ||
| 2658 | des-cfb DES in CBC mode | ||
| 2659 | des-ecb DES in ECB mode | ||
| 2660 | des-ofb DES in OFB mode | ||
| 2661 | |||
| 2662 | des-ede Two key triple DES EDE in ECB mode | ||
| 2663 | des-ede-cbc Two key triple DES EDE in CBC mode | ||
| 2664 | des-ede-cfb Two key triple DES EDE in CFB mode | ||
| 2665 | des-ede-ofb Two key triple DES EDE in OFB mode | ||
| 2666 | |||
| 2667 | des3 Alias for des-ede3-cbc | ||
| 2668 | des-ede3 Three key triple DES EDE in ECB mode | ||
| 2669 | des-ede3-cbc Three key triple DES EDE in CBC mode | ||
| 2670 | des-ede3-cfb Three key triple DES EDE CFB mode | ||
| 2671 | des-ede3-ofb Three key triple DES EDE in OFB mode | ||
| 2672 | |||
| 2673 | desx Alias for desx-cbc | ||
| 2674 | |||
| 2675 | rc2 Alias for rc2-cbc | ||
| 2676 | rc2-cbc 128-bit RC2 in CBC mode | ||
| 2677 | rc2-cfb 128-bit RC2 in CFB mode | ||
| 2678 | rc2-ecb 128-bit RC2 in ECB mode | ||
| 2679 | rc2-ofb 128-bit RC2 in OFB mode | ||
| 2680 | rc2-64-cbc 64-bit RC2 in CBC mode | ||
| 2681 | rc2-40-cbc 40-bit RC2 in CBC mode | ||
| 2682 | |||
| 2683 | rc4 128-bit RC4 | ||
| 2684 | rc4-40 40-bit RC4 | ||
| 2685 | .Ed | ||
| 2686 | .Sh ENC EXAMPLES | ||
| 2687 | Just base64 encode a binary file: | ||
| 2688 | .Pp | ||
| 2689 | .Dl $ openssl base64 -in file.bin -out file.b64 | ||
| 2690 | .Pp | ||
| 2691 | Decode the same file: | ||
| 2692 | .Pp | ||
| 2693 | .Dl $ openssl base64 -d -in file.b64 -out file.bin | ||
| 2694 | .Pp | ||
| 2695 | Encrypt a file using triple DES in CBC mode using a prompted password: | ||
| 2696 | .Pp | ||
| 2697 | .Dl $ openssl des3 -salt -in file.txt -out file.des3 | ||
| 2698 | .Pp | ||
| 2699 | Decrypt a file using a supplied password: | ||
| 2700 | .Pp | ||
| 2701 | .Dl "$ openssl des3 -d -in file.des3 -out file.txt -k mypassword" | ||
| 2702 | .Pp | ||
| 2703 | Encrypt a file then base64 encode it | ||
| 2704 | (so it can be sent via mail for example) | ||
| 2705 | using Blowfish in CBC mode: | ||
| 2706 | .Pp | ||
| 2707 | .Dl $ openssl bf -a -salt -in file.txt -out file.bf | ||
| 2708 | .Pp | ||
| 2709 | Base64 decode a file then decrypt it: | ||
| 2710 | .Pp | ||
| 2711 | .Dl "$ openssl bf -d -a -in file.bf -out file.txt" | ||
| 2712 | .Sh ENC BUGS | ||
| 2713 | The | ||
| 2714 | .Fl A | ||
| 2715 | option when used with large files doesn't work properly. | ||
| 2716 | .Pp | ||
| 2717 | There should be an option to allow an iteration count to be included. | ||
| 2718 | .Pp | ||
| 2719 | The | ||
| 2720 | .Nm enc | ||
| 2721 | program only supports a fixed number of algorithms with certain parameters. | ||
| 2722 | Therefore it is not possible to use RC2 with a 76-bit key | ||
| 2723 | or RC4 with an 84-bit key with this program. | ||
| 2724 | .\" | ||
| 2725 | .\" ERRSTR | ||
| 2726 | .\" | ||
| 2727 | .Sh ERRSTR | ||
| 2728 | .Nm openssl errstr | ||
| 2729 | .Op Fl stats | ||
| 2730 | .Ar errno ... | ||
| 2731 | .Pp | ||
| 2732 | The | ||
| 2733 | .Nm errstr | ||
| 2734 | command performs error number to error string conversion, | ||
| 2735 | generating a human-readable string representing the error code | ||
| 2736 | .Ar errno . | ||
| 2737 | The string is obtained through the | ||
| 2738 | .Xr ERR_error_string_n 3 | ||
| 2739 | function and has the following format: | ||
| 2740 | .Pp | ||
| 2741 | .Dl error:[error code]:[library name]:[function name]:[reason string] | ||
| 2742 | .Pp | ||
| 2743 | .Bq error code | ||
| 2744 | is an 8-digit hexadecimal number. | ||
| 2745 | The remaining fields | ||
| 2746 | .Bq library name , | ||
| 2747 | .Bq function name , | ||
| 2748 | and | ||
| 2749 | .Bq reason string | ||
| 2750 | are all ASCII text. | ||
| 2751 | .Pp | ||
| 2752 | The options are as follows: | ||
| 2753 | .Bl -tag -width "-stats" | ||
| 2754 | .It Fl stats | ||
| 2755 | Print debugging statistics about various aspects of the hash table. | ||
| 2756 | .El | ||
| 2757 | .Sh ERRSTR EXAMPLES | ||
| 2758 | The following error code: | ||
| 2759 | .Pp | ||
| 2760 | .Dl 27594:error:2006D080:lib(32):func(109):reason(128):bss_file.c:107: | ||
| 2761 | .Pp | ||
| 2762 | \&...can be displayed with: | ||
| 2763 | .Pp | ||
| 2764 | .Dl $ openssl errstr 2006D080 | ||
| 2765 | .Pp | ||
| 2766 | \&...to produce the error message: | ||
| 2767 | .Pp | ||
| 2768 | .Dl error:2006D080:BIO routines:BIO_new_file:no such file | ||
| 2769 | .\" | ||
| 2770 | .\" GENDH | ||
| 2771 | .\" | ||
| 2772 | .Sh GENDH | ||
| 2773 | Generation of Diffie-Hellman Parameters. | ||
| 2774 | Replaced by | ||
| 2775 | .Nm dhparam . | ||
| 2776 | See | ||
| 2777 | .Sx DHPARAM | ||
| 2778 | above. | ||
| 2779 | .\" | ||
| 2780 | .\" GENDSA | ||
| 2781 | .\" | ||
| 2782 | .Sh GENDSA | ||
| 2783 | .Nm openssl gendsa | ||
| 2784 | .Bk -words | ||
| 2785 | .Oo | ||
| 2786 | .Fl aes128 | aes192 | aes256 | | ||
| 2787 | .Fl des | des3 | ||
| 2788 | .Oc | ||
| 2789 | .Op Fl engine Ar id | ||
| 2790 | .Op Fl out Ar file | ||
| 2791 | .Op Fl rand Ar file ... | ||
| 2792 | .Op Ar paramfile | ||
| 2793 | .Ek | ||
| 2794 | .Pp | ||
| 2795 | The | ||
| 2796 | .Nm gendsa | ||
| 2797 | command generates a DSA private key from a DSA parameter file | ||
| 2798 | (which will typically be generated by the | ||
| 2799 | .Nm openssl dsaparam | ||
| 2800 | command). | ||
| 2801 | .Pp | ||
| 2802 | The options are as follows: | ||
| 2803 | .Bl -tag -width "XXXX" | ||
| 2804 | .It Xo | ||
| 2805 | .Fl aes128 | aes192 | aes256 | | ||
| 2806 | .Fl des | des3 | ||
| 2807 | .Xc | ||
| 2808 | These options encrypt the private key with the AES, DES, | ||
| 2809 | or the triple DES ciphers, respectively, before outputting it. | ||
| 2810 | A pass phrase is prompted for. | ||
| 2811 | If none of these options are specified, no encryption is used. | ||
| 2812 | .It Fl engine Ar id | ||
| 2813 | Specifying an engine (by it's unique | ||
| 2814 | .Ar id | ||
| 2815 | string) will cause | ||
| 2816 | .Nm gendsa | ||
| 2817 | to attempt to obtain a functional reference to the specified engine, | ||
| 2818 | thus initialising it if needed. | ||
| 2819 | The engine will then be set as the default for all available algorithms. | ||
| 2820 | .It Fl out Ar file | ||
| 2821 | The output | ||
| 2822 | .Ar file . | ||
| 2823 | If this argument is not specified, standard output is used. | ||
| 2824 | .It Ar paramfile | ||
| 2825 | This option specifies the DSA parameter file to use. | ||
| 2826 | The parameters in this file determine the size of the private key. | ||
| 2827 | DSA parameters can be generated and examined using the | ||
| 2828 | .Nm openssl dsaparam | ||
| 2829 | command. | ||
| 2830 | .It Fl rand Ar file ... | ||
| 2831 | A file or files containing random data used to seed the random number | ||
| 2832 | generator, or an EGD socket (see | ||
| 2833 | .Xr RAND_egd 3 ) . | ||
| 2834 | Multiple files can be specified separated by a | ||
| 2835 | .Sq \&: . | ||
| 2836 | .El | ||
| 2837 | .Sh GENDSA NOTES | ||
| 2838 | DSA key generation is little more than random number generation so it is | ||
| 2839 | much quicker than RSA key generation, for example. | ||
| 2840 | .\" | ||
| 2841 | .\" GENRSA | ||
| 2842 | .\" | ||
| 2843 | .Sh GENRSA | ||
| 2844 | .Nm openssl genrsa | ||
| 2845 | .Bk -words | ||
| 2846 | .Oo | ||
| 2847 | .Fl aes128 | aes192 | aes256 | | ||
| 2848 | .Fl des | des3 | ||
| 2849 | .Oc | ||
| 2850 | .Op Fl engine Ar id | ||
| 2851 | .Op Fl 3 | f4 | ||
| 2852 | .Op Fl out Ar file | ||
| 2853 | .Op Fl passout Ar arg | ||
| 2854 | .Op Fl rand Ar file ... | ||
| 2855 | .Op Ar numbits | ||
| 2856 | .Ek | ||
| 2857 | .Pp | ||
| 2858 | The | ||
| 2859 | .Nm genrsa | ||
| 2860 | command generates an RSA private key. | ||
| 2861 | .Pp | ||
| 2862 | The options are as follows: | ||
| 2863 | .Bl -tag -width "XXXX" | ||
| 2864 | .It Xo | ||
| 2865 | .Fl aes128 | aes192 | aes256 | | ||
| 2866 | .Fl des | des3 | ||
| 2867 | .Xc | ||
| 2868 | These options encrypt the private key with the AES, DES, | ||
| 2869 | or the triple DES ciphers, respectively, before outputting it. | ||
| 2870 | If none of these options are specified, no encryption is used. | ||
| 2871 | If encryption is used, a pass phrase is prompted for, | ||
| 2872 | if it is not supplied via the | ||
| 2873 | .Fl passout | ||
| 2874 | option. | ||
| 2875 | .It Fl engine Ar id | ||
| 2876 | Specifying an engine (by it's unique | ||
| 2877 | .Ar id | ||
| 2878 | string) will cause | ||
| 2879 | .Nm genrsa | ||
| 2880 | to attempt to obtain a functional reference to the specified engine, | ||
| 2881 | thus initialising it if needed. | ||
| 2882 | The engine will then be set as the default for all available algorithms. | ||
| 2883 | .It Fl 3 | f4 | ||
| 2884 | The public exponent to use, either 3 or 65537. | ||
| 2885 | The default is 65537. | ||
| 2886 | .It Ar numbits | ||
| 2887 | The size of the private key to generate in bits. | ||
| 2888 | This must be the last option specified. | ||
| 2889 | The default is 512. | ||
| 2890 | .It Fl out Ar file | ||
| 2891 | The output | ||
| 2892 | .Ar file . | ||
| 2893 | If this argument is not specified, standard output is used. | ||
| 2894 | .It Fl passout Ar arg | ||
| 2895 | The output file password source. | ||
| 2896 | For more information about the format of | ||
| 2897 | .Ar arg , | ||
| 2898 | see the | ||
| 2899 | .Sx PASS PHRASE ARGUMENTS | ||
| 2900 | section above. | ||
| 2901 | .It Fl rand Ar file ... | ||
| 2902 | A file or files | ||
| 2903 | containing random data used to seed the random number | ||
| 2904 | generator, or an EGD socket (see | ||
| 2905 | .Xr RAND_egd 3 ) . | ||
| 2906 | Multiple files can be specified separated by a | ||
| 2907 | .Sq \&: . | ||
| 2908 | .El | ||
| 2909 | .Sh GENRSA NOTES | ||
| 2910 | RSA private key generation essentially involves the generation of two prime | ||
| 2911 | numbers. | ||
| 2912 | When generating a private key, various symbols will be output to | ||
| 2913 | indicate the progress of the generation. | ||
| 2914 | A | ||
| 2915 | .Sq \&. | ||
| 2916 | represents each number which has passed an initial sieve test; | ||
| 2917 | .Sq + | ||
| 2918 | means a number has passed a single round of the Miller-Rabin primality test. | ||
| 2919 | A newline means that the number has passed all the prime tests | ||
| 2920 | .Pq the actual number depends on the key size . | ||
| 2921 | .Pp | ||
| 2922 | Because key generation is a random process, | ||
| 2923 | the time taken to generate a key may vary somewhat. | ||
| 2924 | .Sh GENRSA BUGS | ||
| 2925 | A quirk of the prime generation algorithm is that it cannot generate small | ||
| 2926 | primes. | ||
| 2927 | Therefore the number of bits should not be less that 64. | ||
| 2928 | For typical private keys this will not matter because for security reasons | ||
| 2929 | they will be much larger | ||
| 2930 | .Pq typically 1024 bits . | ||
| 2931 | .\" | ||
| 2932 | .\" NSEQ | ||
| 2933 | .\" | ||
| 2934 | .Sh NSEQ | ||
| 2935 | .Nm openssl nseq | ||
| 2936 | .Op Fl toseq | ||
| 2937 | .Op Fl in Ar file | ||
| 2938 | .Op Fl out Ar file | ||
| 2939 | .Pp | ||
| 2940 | The | ||
| 2941 | .Nm nseq | ||
| 2942 | command takes a file containing a Netscape certificate | ||
| 2943 | sequence and prints out the certificates contained in it or takes a | ||
| 2944 | file of certificates and converts it into a Netscape certificate | ||
| 2945 | sequence. | ||
| 2946 | .Pp | ||
| 2947 | The options are as follows: | ||
| 2948 | .Bl -tag -width "-toseq" | ||
| 2949 | .It Fl in Ar file | ||
| 2950 | This specifies the input | ||
| 2951 | .Ar file | ||
| 2952 | to read, or standard input if this option is not specified. | ||
| 2953 | .It Fl out Ar file | ||
| 2954 | Specifies the output | ||
| 2955 | .Ar file , | ||
| 2956 | or standard output by default. | ||
| 2957 | .It Fl toseq | ||
| 2958 | Normally, a Netscape certificate sequence will be input and the output | ||
| 2959 | is the certificates contained in it. | ||
| 2960 | With the | ||
| 2961 | .Fl toseq | ||
| 2962 | option the situation is reversed: | ||
| 2963 | a Netscape certificate sequence is created from a file of certificates. | ||
| 2964 | .El | ||
| 2965 | .Sh NSEQ EXAMPLES | ||
| 2966 | Output the certificates in a Netscape certificate sequence: | ||
| 2967 | .Bd -literal | ||
| 2968 | .Dl $ openssl nseq -in nseq.pem -out certs.pem | ||
| 2969 | .Ed | ||
| 2970 | .Pp | ||
| 2971 | Create a Netscape certificate sequence: | ||
| 2972 | .Bd -literal | ||
| 2973 | .Dl $ openssl nseq -in certs.pem -toseq -out nseq.pem | ||
| 2974 | .Ed | ||
| 2975 | .Sh NSEQ NOTES | ||
| 2976 | The PEM-encoded form uses the same headers and footers as a certificate: | ||
| 2977 | .Bd -unfilled -offset indent | ||
| 2978 | -----BEGIN CERTIFICATE----- | ||
| 2979 | -----END CERTIFICATE----- | ||
| 2980 | .Ed | ||
| 2981 | .Pp | ||
| 2982 | A Netscape certificate sequence is a Netscape specific form that can be sent | ||
| 2983 | to browsers as an alternative to the standard PKCS#7 format when several | ||
| 2984 | certificates are sent to the browser: | ||
| 2985 | for example during certificate enrollment. | ||
| 2986 | It is used by the Netscape certificate server, for example. | ||
| 2987 | .Sh NSEQ BUGS | ||
| 2988 | This program needs a few more options, | ||
| 2989 | like allowing DER or PEM input and output files | ||
| 2990 | and allowing multiple certificate files to be used. | ||
| 2991 | .\" | ||
| 2992 | .\" OCSP | ||
| 2993 | .\" | ||
| 2994 | .Sh OCSP | ||
| 2995 | .Nm openssl ocsp | ||
| 2996 | .Bk -words | ||
| 2997 | .Op Fl no_cert_checks | ||
| 2998 | .Op Fl no_cert_verify | ||
| 2999 | .Op Fl no_certs | ||
| 3000 | .Op Fl no_chain | ||
| 3001 | .Op Fl no_intern | ||
| 3002 | .Op Fl no_nonce | ||
| 3003 | .Op Fl no_signature_verify | ||
| 3004 | .Op Fl nonce | ||
| 3005 | .Op Fl noverify | ||
| 3006 | .Op Fl req_text | ||
| 3007 | .Op Fl resp_key_id | ||
| 3008 | .Op Fl resp_no_certs | ||
| 3009 | .Op Fl resp_text | ||
| 3010 | .Op Fl text | ||
| 3011 | .Op Fl trust_other | ||
| 3012 | .Op Fl CA Ar file | ||
| 3013 | .Op Fl CAfile Ar file | ||
| 3014 | .Op Fl CApath Ar directory | ||
| 3015 | .Op Fl cert Ar file | ||
| 3016 | .Oo | ||
| 3017 | .Fl host | ||
| 3018 | .Ar hostname : Ns Ar port | ||
| 3019 | .Oc | ||
| 3020 | .Op Fl index Ar indexfile | ||
| 3021 | .Op Fl issuer Ar file | ||
| 3022 | .Op Fl ndays Ar days | ||
| 3023 | .Op Fl nmin Ar minutes | ||
| 3024 | .Op Fl nrequest Ar number | ||
| 3025 | .Op Fl out Ar file | ||
| 3026 | .Op Fl path Ar path | ||
| 3027 | .Op Fl port Ar portnum | ||
| 3028 | .Op Fl reqin Ar file | ||
| 3029 | .Op Fl reqout Ar file | ||
| 3030 | .Op Fl respin Ar file | ||
| 3031 | .Op Fl respout Ar file | ||
| 3032 | .Op Fl rkey Ar file | ||
| 3033 | .Op Fl rother Ar file | ||
| 3034 | .Op Fl rsigner Ar file | ||
| 3035 | .Op Fl serial Ar number | ||
| 3036 | .Op Fl sign_other Ar file | ||
| 3037 | .Op Fl signer Ar file | ||
| 3038 | .Op Fl signkey Ar file | ||
| 3039 | .Op Fl status_age Ar age | ||
| 3040 | .Op Fl url Ar responder_url | ||
| 3041 | .Op Fl VAfile Ar file | ||
| 3042 | .Op Fl validity_period Ar nsec | ||
| 3043 | .Op Fl verify_other Ar file | ||
| 3044 | .Ek | ||
| 3045 | .Pp | ||
| 3046 | The Online Certificate Status Protocol | ||
| 3047 | .Pq OCSP | ||
| 3048 | enables applications to determine the | ||
| 3049 | .Pq revocation | ||
| 3050 | state of an identified certificate | ||
| 3051 | .Pq RFC 2560 . | ||
| 3052 | .Pp | ||
| 3053 | The | ||
| 3054 | .Nm ocsp | ||
| 3055 | command performs many common OCSP tasks. | ||
| 3056 | It can be used to print out requests and responses, | ||
| 3057 | create requests and send queries to an OCSP responder, | ||
| 3058 | and behave like a mini OCSP server itself. | ||
| 3059 | .Pp | ||
| 3060 | The options are as follows: | ||
| 3061 | .Bl -tag -width "XXXX" | ||
| 3062 | .It Fl CAfile Ar file , Fl CApath Ar directory | ||
| 3063 | .Ar file | ||
| 3064 | or | ||
| 3065 | .Ar path | ||
| 3066 | containing trusted CA certificates. | ||
| 3067 | These are used to verify the signature on the OCSP response. | ||
| 3068 | .It Fl cert Ar file | ||
| 3069 | Add the certificate | ||
| 3070 | .Ar file | ||
| 3071 | to the request. | ||
| 3072 | The issuer certificate is taken from the previous | ||
| 3073 | .Fl issuer | ||
| 3074 | option, or an error occurs if no issuer certificate is specified. | ||
| 3075 | .It Xo | ||
| 3076 | .Fl host Ar hostname : Ns Ar port , | ||
| 3077 | .Fl path Ar path | ||
| 3078 | .Xc | ||
| 3079 | If the | ||
| 3080 | .Fl host | ||
| 3081 | option is present, then the OCSP request is sent to the host | ||
| 3082 | .Ar hostname | ||
| 3083 | on port | ||
| 3084 | .Ar port . | ||
| 3085 | .Fl path | ||
| 3086 | specifies the HTTP path name to use, or | ||
| 3087 | .Sq / | ||
| 3088 | by default. | ||
| 3089 | .It Fl issuer Ar file | ||
| 3090 | This specifies the current issuer certificate. | ||
| 3091 | This option can be used multiple times. | ||
| 3092 | The certificate specified in | ||
| 3093 | .Ar file | ||
| 3094 | must be in PEM format. | ||
| 3095 | This option | ||
| 3096 | .Em must | ||
| 3097 | come before any | ||
| 3098 | .Fl cert | ||
| 3099 | options. | ||
| 3100 | .It Fl no_cert_checks | ||
| 3101 | Don't perform any additional checks on the OCSP response signer's certificate. | ||
| 3102 | That is, do not make any checks to see if the signer's certificate is | ||
| 3103 | authorised to provide the necessary status information: | ||
| 3104 | as a result this option should only be used for testing purposes. | ||
| 3105 | .It Fl no_cert_verify | ||
| 3106 | Don't verify the OCSP response signer's certificate at all. | ||
| 3107 | Since this option allows the OCSP response to be signed by any certificate, | ||
| 3108 | it should only be used for testing purposes. | ||
| 3109 | .It Fl no_certs | ||
| 3110 | Don't include any certificates in signed request. | ||
| 3111 | .It Fl no_chain | ||
| 3112 | Do not use certificates in the response as additional untrusted CA | ||
| 3113 | certificates. | ||
| 3114 | .It Fl no_intern | ||
| 3115 | Ignore certificates contained in the OCSP response | ||
| 3116 | when searching for the signer's certificate. | ||
| 3117 | With this option, the signer's certificate must be specified with either the | ||
| 3118 | .Fl verify_other | ||
| 3119 | or | ||
| 3120 | .Fl VAfile | ||
| 3121 | options. | ||
| 3122 | .It Fl no_signature_verify | ||
| 3123 | Don't check the signature on the OCSP response. | ||
| 3124 | Since this option tolerates invalid signatures on OCSP responses, | ||
| 3125 | it will normally only be used for testing purposes. | ||
| 3126 | .It Fl nonce , no_nonce | ||
| 3127 | Add an OCSP | ||
| 3128 | .Em nonce | ||
| 3129 | extension to a request or disable an OCSP | ||
| 3130 | .Em nonce | ||
| 3131 | addition. | ||
| 3132 | Normally, if an OCSP request is input using the | ||
| 3133 | .Fl respin | ||
| 3134 | option no | ||
| 3135 | .Em nonce | ||
| 3136 | is added: | ||
| 3137 | using the | ||
| 3138 | .Fl nonce | ||
| 3139 | option will force addition of a | ||
| 3140 | .Em nonce . | ||
| 3141 | If an OCSP request is being created (using the | ||
| 3142 | .Fl cert | ||
| 3143 | and | ||
| 3144 | .Fl serial | ||
| 3145 | options) | ||
| 3146 | a | ||
| 3147 | .Em nonce | ||
| 3148 | is automatically added; specifying | ||
| 3149 | .Fl no_nonce | ||
| 3150 | overrides this. | ||
| 3151 | .It Fl noverify | ||
| 3152 | Don't attempt to verify the OCSP response signature or the | ||
| 3153 | .Em nonce | ||
| 3154 | values. | ||
| 3155 | This option will normally only be used for debugging | ||
| 3156 | since it disables all verification of the responder's certificate. | ||
| 3157 | .It Fl out Ar file | ||
| 3158 | Specify output | ||
| 3159 | .Ar file ; | ||
| 3160 | default is standard output. | ||
| 3161 | .It Fl req_text , resp_text , text | ||
| 3162 | Print out the text form of the OCSP request, response, or both, respectively. | ||
| 3163 | .It Fl reqin Ar file , Fl respin Ar file | ||
| 3164 | Read an OCSP request or response file from | ||
| 3165 | .Ar file . | ||
| 3166 | These options are ignored | ||
| 3167 | if an OCSP request or response creation is implied by other options | ||
| 3168 | (for example with the | ||
| 3169 | .Fl serial , cert , | ||
| 3170 | and | ||
| 3171 | .Fl host | ||
| 3172 | options). | ||
| 3173 | .It Fl reqout Ar file , Fl respout Ar file | ||
| 3174 | Write out the DER-encoded certificate request or response to | ||
| 3175 | .Ar file . | ||
| 3176 | .It Fl serial Ar num | ||
| 3177 | Same as the | ||
| 3178 | .Fl cert | ||
| 3179 | option except the certificate with serial number | ||
| 3180 | .Ar num | ||
| 3181 | is added to the request. | ||
| 3182 | The serial number is interpreted as a decimal integer unless preceded by | ||
| 3183 | .Sq 0x . | ||
| 3184 | Negative integers can also be specified by preceding the value with a | ||
| 3185 | .Sq - | ||
| 3186 | sign. | ||
| 3187 | .It Fl sign_other Ar file | ||
| 3188 | Additional certificates to include in the signed request. | ||
| 3189 | .It Fl signer Ar file , Fl signkey Ar file | ||
| 3190 | Sign the OCSP request using the certificate specified in the | ||
| 3191 | .Fl signer | ||
| 3192 | option and the private key specified by the | ||
| 3193 | .Fl signkey | ||
| 3194 | option. | ||
| 3195 | If the | ||
| 3196 | .Fl signkey | ||
| 3197 | option is not present, then the private key is read from the same file | ||
| 3198 | as the certificate. | ||
| 3199 | If neither option is specified, the OCSP request is not signed. | ||
| 3200 | .It Fl trust_other | ||
| 3201 | The certificates specified by the | ||
| 3202 | .Fl verify_other | ||
| 3203 | option should be explicitly trusted and no additional checks will be | ||
| 3204 | performed on them. | ||
| 3205 | This is useful when the complete responder certificate chain is not available | ||
| 3206 | or trusting a root CA is not appropriate. | ||
| 3207 | .It Fl url Ar responder_url | ||
| 3208 | Specify the responder URL. | ||
| 3209 | Both HTTP and HTTPS | ||
| 3210 | .Pq SSL/TLS | ||
| 3211 | URLs can be specified. | ||
| 3212 | .It Fl VAfile Ar file | ||
| 3213 | .Ar file | ||
| 3214 | containing explicitly trusted responder certificates. | ||
| 3215 | Equivalent to the | ||
| 3216 | .Fl verify_other | ||
| 3217 | and | ||
| 3218 | .Fl trust_other | ||
| 3219 | options. | ||
| 3220 | .It Fl validity_period Ar nsec , Fl status_age Ar age | ||
| 3221 | These options specify the range of times, in seconds, which will be tolerated | ||
| 3222 | in an OCSP response. | ||
| 3223 | Each certificate status response includes a | ||
| 3224 | .Em notBefore | ||
| 3225 | time and an optional | ||
| 3226 | .Em notAfter | ||
| 3227 | time. | ||
| 3228 | The current time should fall between these two values, | ||
| 3229 | but the interval between the two times may be only a few seconds. | ||
| 3230 | In practice the OCSP responder and clients' clocks may not be precisely | ||
| 3231 | synchronised and so such a check may fail. | ||
| 3232 | To avoid this the | ||
| 3233 | .Fl validity_period | ||
| 3234 | option can be used to specify an acceptable error range in seconds, | ||
| 3235 | the default value is 5 minutes. | ||
| 3236 | .Pp | ||
| 3237 | If the | ||
| 3238 | .Em notAfter | ||
| 3239 | time is omitted from a response, then this means that new status | ||
| 3240 | information is immediately available. | ||
| 3241 | In this case the age of the | ||
| 3242 | .Em notBefore | ||
| 3243 | field is checked to see it is not older than | ||
| 3244 | .Ar age | ||
| 3245 | seconds old. | ||
| 3246 | By default, this additional check is not performed. | ||
| 3247 | .It Fl verify_other Ar file | ||
| 3248 | .Ar file | ||
| 3249 | containing additional certificates to search when attempting to locate | ||
| 3250 | the OCSP response signing certificate. | ||
| 3251 | Some responders omit the actual signer's certificate from the response; | ||
| 3252 | this option can be used to supply the necessary certificate in such cases. | ||
| 3253 | .El | ||
| 3254 | .Sh OCSP SERVER OPTIONS | ||
| 3255 | .Bl -tag -width "XXXX" | ||
| 3256 | .It Fl CA Ar file | ||
| 3257 | CA certificate corresponding to the revocation information in | ||
| 3258 | .Ar indexfile . | ||
| 3259 | .It Fl index Ar indexfile | ||
| 3260 | .Ar indexfile | ||
| 3261 | is a text index file in | ||
| 3262 | .Nm ca | ||
| 3263 | format containing certificate revocation information. | ||
| 3264 | .Pp | ||
| 3265 | If the | ||
| 3266 | .Fl index | ||
| 3267 | option is specified, the | ||
| 3268 | .Nm ocsp | ||
| 3269 | utility is in | ||
| 3270 | .Em responder | ||
| 3271 | mode, otherwise it is in | ||
| 3272 | .Em client | ||
| 3273 | mode. | ||
| 3274 | The request(s) the responder processes can be either specified on | ||
| 3275 | the command line (using the | ||
| 3276 | .Fl issuer | ||
| 3277 | and | ||
| 3278 | .Fl serial | ||
| 3279 | options), supplied in a file (using the | ||
| 3280 | .Fl respin | ||
| 3281 | option) or via external OCSP clients (if | ||
| 3282 | .Ar port | ||
| 3283 | or | ||
| 3284 | .Ar url | ||
| 3285 | is specified). | ||
| 3286 | .Pp | ||
| 3287 | If the | ||
| 3288 | .Fl index | ||
| 3289 | option is present, then the | ||
| 3290 | .Fl CA | ||
| 3291 | and | ||
| 3292 | .Fl rsigner | ||
| 3293 | options must also be present. | ||
| 3294 | .It Fl nmin Ar minutes , Fl ndays Ar days | ||
| 3295 | Number of | ||
| 3296 | .Ar minutes | ||
| 3297 | or | ||
| 3298 | .Ar days | ||
| 3299 | when fresh revocation information is available: used in the | ||
| 3300 | .Ar nextUpdate | ||
| 3301 | field. | ||
| 3302 | If neither option is present, the | ||
| 3303 | .Em nextUpdate | ||
| 3304 | field is omitted, meaning fresh revocation information is immediately available. | ||
| 3305 | .It Fl nrequest Ar number | ||
| 3306 | The OCSP server will exit after receiving | ||
| 3307 | .Ar number | ||
| 3308 | requests, default unlimited. | ||
| 3309 | .It Fl port Ar portnum | ||
| 3310 | Port to listen for OCSP requests on. | ||
| 3311 | The port may also be specified using the | ||
| 3312 | .Fl url | ||
| 3313 | option. | ||
| 3314 | .It Fl resp_key_id | ||
| 3315 | Identify the signer certificate using the key ID; | ||
| 3316 | default is to use the subject name. | ||
| 3317 | .It Fl resp_no_certs | ||
| 3318 | Don't include any certificates in the OCSP response. | ||
| 3319 | .It Fl rkey Ar file | ||
| 3320 | The private key to sign OCSP responses with; | ||
| 3321 | if not present, the file specified in the | ||
| 3322 | .Fl rsigner | ||
| 3323 | option is used. | ||
| 3324 | .It Fl rother Ar file | ||
| 3325 | Additional certificates to include in the OCSP response. | ||
| 3326 | .It Fl rsigner Ar file | ||
| 3327 | The certificate to sign OCSP responses with. | ||
| 3328 | .El | ||
| 3329 | .Sh OCSP RESPONSE VERIFICATION | ||
| 3330 | OCSP Response follows the rules specified in RFC 2560. | ||
| 3331 | .Pp | ||
| 3332 | Initially the OCSP responder certificate is located and the signature on | ||
| 3333 | the OCSP request checked using the responder certificate's public key. | ||
| 3334 | .Pp | ||
| 3335 | Then a normal certificate verify is performed on the OCSP responder certificate | ||
| 3336 | building up a certificate chain in the process. | ||
| 3337 | The locations of the trusted certificates used to build the chain can be | ||
| 3338 | specified by the | ||
| 3339 | .Fl CAfile | ||
| 3340 | and | ||
| 3341 | .Fl CApath | ||
| 3342 | options or they will be looked for in the standard | ||
| 3343 | .Nm OpenSSL | ||
| 3344 | certificates | ||
| 3345 | directory. | ||
| 3346 | .Pp | ||
| 3347 | If the initial verify fails, the OCSP verify process halts with an | ||
| 3348 | error. | ||
| 3349 | .Pp | ||
| 3350 | Otherwise the issuing CA certificate in the request is compared to the OCSP | ||
| 3351 | responder certificate: if there is a match then the OCSP verify succeeds. | ||
| 3352 | .Pp | ||
| 3353 | Otherwise the OCSP responder certificate's CA is checked against the issuing | ||
| 3354 | CA certificate in the request. | ||
| 3355 | If there is a match and the OCSPSigning extended key usage is present | ||
| 3356 | in the OCSP responder certificate, then the OCSP verify succeeds. | ||
| 3357 | .Pp | ||
| 3358 | Otherwise the root CA of the OCSP responder's CA is checked to see if it | ||
| 3359 | is trusted for OCSP signing. | ||
| 3360 | If it is, the OCSP verify succeeds. | ||
| 3361 | .Pp | ||
| 3362 | If none of these checks is successful, the OCSP verify fails. | ||
| 3363 | .Pp | ||
| 3364 | What this effectively means is that if the OCSP responder certificate is | ||
| 3365 | authorised directly by the CA it is issuing revocation information about | ||
| 3366 | .Pq and it is correctly configured , | ||
| 3367 | then verification will succeed. | ||
| 3368 | .Pp | ||
| 3369 | If the OCSP responder is a | ||
| 3370 | .Em global responder | ||
| 3371 | which can give details about multiple CAs and has its own separate | ||
| 3372 | certificate chain, then its root CA can be trusted for OCSP signing. | ||
| 3373 | For example: | ||
| 3374 | .Bd -literal -offset indent | ||
| 3375 | $ openssl x509 -in ocspCA.pem -addtrust OCSPSigning \e | ||
| 3376 | -out trustedCA.pem | ||
| 3377 | .Ed | ||
| 3378 | .Pp | ||
| 3379 | Alternatively, the responder certificate itself can be explicitly trusted | ||
| 3380 | with the | ||
| 3381 | .Fl VAfile | ||
| 3382 | option. | ||
| 3383 | .Sh OCSP NOTES | ||
| 3384 | As noted, most of the verify options are for testing or debugging purposes. | ||
| 3385 | Normally, only the | ||
| 3386 | .Fl CApath , CAfile | ||
| 3387 | and | ||
| 3388 | .Pq if the responder is a `global VA' | ||
| 3389 | .Fl VAfile | ||
| 3390 | options need to be used. | ||
| 3391 | .Pp | ||
| 3392 | The OCSP server is only useful for test and demonstration purposes: | ||
| 3393 | it is not really usable as a full OCSP responder. | ||
| 3394 | It contains only a very simple HTTP request handling and can only handle | ||
| 3395 | the POST form of OCSP queries. | ||
| 3396 | It also handles requests serially, meaning it cannot respond to | ||
| 3397 | new requests until it has processed the current one. | ||
| 3398 | The text index file format of revocation is also inefficient for large | ||
| 3399 | quantities of revocation data. | ||
| 3400 | .Pp | ||
| 3401 | It is possible to run the | ||
| 3402 | .Nm ocsp | ||
| 3403 | application in | ||
| 3404 | .Em responder | ||
| 3405 | mode via a CGI script using the | ||
| 3406 | .Fl respin | ||
| 3407 | and | ||
| 3408 | .Fl respout | ||
| 3409 | options. | ||
| 3410 | .Sh OCSP EXAMPLES | ||
| 3411 | Create an OCSP request and write it to a file: | ||
| 3412 | .Bd -literal -offset indent | ||
| 3413 | $ openssl ocsp -issuer issuer.pem -cert c1.pem -cert c2.pem \e | ||
| 3414 | -reqout req.der | ||
| 3415 | .Ed | ||
| 3416 | .Pp | ||
| 3417 | Send a query to an OCSP responder with URL | ||
| 3418 | .Pa http://ocsp.myhost.com/ , | ||
| 3419 | save the response to a file and print it out in text form: | ||
| 3420 | .Bd -literal -offset indent | ||
| 3421 | $ openssl ocsp -issuer issuer.pem -cert c1.pem -cert c2.pem \e | ||
| 3422 | -url http://ocsp.myhost.com/ -resp_text -respout resp.der | ||
| 3423 | .Ed | ||
| 3424 | .Pp | ||
| 3425 | Read in an OCSP response and print out in text form: | ||
| 3426 | .Pp | ||
| 3427 | .Dl $ openssl ocsp -respin resp.der -text | ||
| 3428 | .Pp | ||
| 3429 | OCSP server on port 8888 using a standard | ||
| 3430 | .Nm ca | ||
| 3431 | configuration, and a separate responder certificate. | ||
| 3432 | All requests and responses are printed to a file: | ||
| 3433 | .Bd -literal -offset indent | ||
| 3434 | $ openssl ocsp -index demoCA/index.txt -port 8888 -rsigner \e | ||
| 3435 | rcert.pem -CA demoCA/cacert.pem -text -out log.txt | ||
| 3436 | .Ed | ||
| 3437 | .Pp | ||
| 3438 | As above, but exit after processing one request: | ||
| 3439 | .Bd -literal -offset indent | ||
| 3440 | $ openssl ocsp -index demoCA/index.txt -port 8888 -rsigner \e | ||
| 3441 | rcert.pem -CA demoCA/cacert.pem -nrequest 1 | ||
| 3442 | .Ed | ||
| 3443 | .Pp | ||
| 3444 | Query status information using internally generated request: | ||
| 3445 | .Bd -literal -offset indent | ||
| 3446 | $ openssl ocsp -index demoCA/index.txt -rsigner rcert.pem -CA \e | ||
| 3447 | demoCA/cacert.pem -issuer demoCA/cacert.pem -serial 1 | ||
| 3448 | .Ed | ||
| 3449 | .Pp | ||
| 3450 | Query status information using request read from a file and write | ||
| 3451 | the response to a second file: | ||
| 3452 | .Bd -literal -offset indent | ||
| 3453 | $ openssl ocsp -index demoCA/index.txt -rsigner rcert.pem -CA \e | ||
| 3454 | demoCA/cacert.pem -reqin req.der -respout resp.der | ||
| 3455 | .Ed | ||
| 3456 | .\" | ||
| 3457 | .\" PASSWD | ||
| 3458 | .\" | ||
| 3459 | .Sh PASSWD | ||
| 3460 | .Nm openssl passwd | ||
| 3461 | .Op Fl 1 | apr1 | crypt | ||
| 3462 | .Op Fl noverify | ||
| 3463 | .Op Fl quiet | ||
| 3464 | .Op Fl reverse | ||
| 3465 | .Op Fl stdin | ||
| 3466 | .Op Fl table | ||
| 3467 | .Op Fl in Ar file | ||
| 3468 | .Op Fl salt Ar string | ||
| 3469 | .Op Ar password | ||
| 3470 | .Pp | ||
| 3471 | The | ||
| 3472 | .Nm passwd | ||
| 3473 | command computes the hash of a password typed at run-time | ||
| 3474 | or the hash of each password in a list. | ||
| 3475 | The password list is taken from the named | ||
| 3476 | .Ar file | ||
| 3477 | for option | ||
| 3478 | .Fl in , | ||
| 3479 | from stdin for option | ||
| 3480 | .Fl stdin , | ||
| 3481 | or from the command line, or from the terminal otherwise. | ||
| 3482 | The | ||
| 3483 | .Ux | ||
| 3484 | standard algorithm | ||
| 3485 | .Em crypt | ||
| 3486 | and the MD5-based | ||
| 3487 | .Bx | ||
| 3488 | password algorithm | ||
| 3489 | .Em 1 | ||
| 3490 | and its Apache variant | ||
| 3491 | .Em apr1 | ||
| 3492 | are available. | ||
| 3493 | .Pp | ||
| 3494 | The options are as follows: | ||
| 3495 | .Bl -tag -width "XXXX" | ||
| 3496 | .It Fl 1 | ||
| 3497 | Use the MD5 based | ||
| 3498 | .Bx | ||
| 3499 | password algorithm | ||
| 3500 | .Em 1 . | ||
| 3501 | .It Fl apr1 | ||
| 3502 | Use the | ||
| 3503 | .Em apr1 | ||
| 3504 | algorithm | ||
| 3505 | .Pq Apache variant of the | ||
| 3506 | .Bx | ||
| 3507 | algorithm. | ||
| 3508 | .It Fl crypt | ||
| 3509 | Use the | ||
| 3510 | .Em crypt | ||
| 3511 | algorithm | ||
| 3512 | .Pq default . | ||
| 3513 | .It Fl in Ar file | ||
| 3514 | Read passwords from | ||
| 3515 | .Ar file . | ||
| 3516 | .It Fl noverify | ||
| 3517 | Don't verify when reading a password from the terminal. | ||
| 3518 | .It Fl quiet | ||
| 3519 | Don't output warnings when passwords given on the command line are truncated. | ||
| 3520 | .It Fl reverse | ||
| 3521 | Switch table columns. | ||
| 3522 | This only makes sense in conjunction with the | ||
| 3523 | .Fl table | ||
| 3524 | option. | ||
| 3525 | .It Fl salt Ar string | ||
| 3526 | Use the specified | ||
| 3527 | .Ar salt . | ||
| 3528 | When reading a password from the terminal, this implies | ||
| 3529 | .Fl noverify . | ||
| 3530 | .It Fl stdin | ||
| 3531 | Read passwords from | ||
| 3532 | .Em stdin . | ||
| 3533 | .It Fl table | ||
| 3534 | In the output list, prepend the cleartext password and a TAB character | ||
| 3535 | to each password hash. | ||
| 3536 | .El | ||
| 3537 | .Sh PASSWD EXAMPLES | ||
| 3538 | .Dl $ openssl passwd -crypt -salt xx password | ||
| 3539 | prints | ||
| 3540 | .Qq xxj31ZMTZzkVA . | ||
| 3541 | .Pp | ||
| 3542 | .Dl $ openssl passwd -1 -salt xxxxxxxx password | ||
| 3543 | prints | ||
| 3544 | .Qq $1$xxxxxxxx$UYCIxa628.9qXjpQCjM4a. . | ||
| 3545 | .Pp | ||
| 3546 | .Dl $ openssl passwd -apr1 -salt xxxxxxxx password | ||
| 3547 | prints | ||
| 3548 | .Qq $apr1$xxxxxxxx$dxHfLAsjHkDRmG83UXe8K0 . | ||
| 3549 | .\" | ||
| 3550 | .\" PKCS7 | ||
| 3551 | .\" | ||
| 3552 | .Sh PKCS7 | ||
| 3553 | .Nm openssl pkcs7 | ||
| 3554 | .Bk -words | ||
| 3555 | .Op Fl noout | ||
| 3556 | .Op Fl print_certs | ||
| 3557 | .Op Fl text | ||
| 3558 | .Op Fl engine Ar id | ||
| 3559 | .Op Fl in Ar file | ||
| 3560 | .Op Fl inform Ar DER | PEM | ||
| 3561 | .Op Fl out Ar file | ||
| 3562 | .Op Fl outform Ar DER | PEM | ||
| 3563 | .Ek | ||
| 3564 | .Pp | ||
| 3565 | The | ||
| 3566 | .Nm pkcs7 | ||
| 3567 | command processes PKCS#7 files in DER or PEM format. | ||
| 3568 | .Pp | ||
| 3569 | The options are as follows: | ||
| 3570 | .Bl -tag -width "XXXX" | ||
| 3571 | .It Fl engine Ar id | ||
| 3572 | Specifying an engine (by it's unique | ||
| 3573 | .Ar id | ||
| 3574 | string) will cause | ||
| 3575 | .Nm pkcs7 | ||
| 3576 | to attempt to obtain a functional reference to the specified engine, | ||
| 3577 | thus initialising it if needed. | ||
| 3578 | The engine will then be set as the default for all available algorithms. | ||
| 3579 | .It Fl in Ar file | ||
| 3580 | This specifies the input | ||
| 3581 | .Ar file | ||
| 3582 | to read from, or standard input if this option is not specified. | ||
| 3583 | .It Fl inform Ar DER | PEM | ||
| 3584 | This specifies the input format. | ||
| 3585 | .Ar DER | ||
| 3586 | format is a DER-encoded PKCS#7 v1.5 structure. | ||
| 3587 | .Ar PEM | ||
| 3588 | .Pq the default | ||
| 3589 | is a base64-encoded version of the DER form with header and footer lines. | ||
| 3590 | .It Fl noout | ||
| 3591 | Don't output the encoded version of the PKCS#7 structure | ||
| 3592 | (or certificates if | ||
| 3593 | .Fl print_certs | ||
| 3594 | is set). | ||
| 3595 | .It Fl out Ar file | ||
| 3596 | Specifies the output | ||
| 3597 | .Ar file | ||
| 3598 | to write to, or standard output by default. | ||
| 3599 | .It Fl outform Ar DER | PEM | ||
| 3600 | This specifies the output format; the options have the same meaning as the | ||
| 3601 | .Fl inform | ||
| 3602 | option. | ||
| 3603 | .It Fl print_certs | ||
| 3604 | Prints out any certificates or CRLs contained in the file. | ||
| 3605 | They are preceded by their subject and issuer names in a one-line format. | ||
| 3606 | .It Fl text | ||
| 3607 | Prints out certificate details in full rather than just subject and | ||
| 3608 | issuer names. | ||
| 3609 | .El | ||
| 3610 | .Sh PKCS7 EXAMPLES | ||
| 3611 | Convert a PKCS#7 file from PEM to DER: | ||
| 3612 | .Pp | ||
| 3613 | .Dl $ openssl pkcs7 -in file.pem -outform DER -out file.der | ||
| 3614 | .Pp | ||
| 3615 | Output all certificates in a file: | ||
| 3616 | .Pp | ||
| 3617 | .Dl $ openssl pkcs7 -in file.pem -print_certs -out certs.pem | ||
| 3618 | .Sh PKCS7 NOTES | ||
| 3619 | The PEM PKCS#7 format uses the header and footer lines: | ||
| 3620 | .Bd -unfilled -offset indent | ||
| 3621 | -----BEGIN PKCS7----- | ||
| 3622 | -----END PKCS7----- | ||
| 3623 | .Ed | ||
| 3624 | .Pp | ||
| 3625 | For compatibility with some CAs it will also accept: | ||
| 3626 | .Bd -unfilled -offset indent | ||
| 3627 | -----BEGIN CERTIFICATE----- | ||
| 3628 | -----END CERTIFICATE----- | ||
| 3629 | .Ed | ||
| 3630 | .Sh PKCS7 RESTRICTIONS | ||
| 3631 | There is no option to print out all the fields of a PKCS#7 file. | ||
| 3632 | .Pp | ||
| 3633 | The PKCS#7 routines only understand PKCS#7 v 1.5 as specified in RFC 2315. | ||
| 3634 | They cannot currently parse, for example, the new CMS as described in RFC 2630. | ||
| 3635 | .\" | ||
| 3636 | .\" PKCS8 | ||
| 3637 | .\" | ||
| 3638 | .Sh PKCS8 | ||
| 3639 | .Nm openssl pkcs8 | ||
| 3640 | .Bk -words | ||
| 3641 | .Op Fl embed | ||
| 3642 | .Op Fl nocrypt | ||
| 3643 | .Op Fl noiter | ||
| 3644 | .Op Fl nooct | ||
| 3645 | .Op Fl nsdb | ||
| 3646 | .Op Fl topk8 | ||
| 3647 | .Op Fl engine Ar id | ||
| 3648 | .Op Fl in Ar file | ||
| 3649 | .Op Fl inform Ar DER | PEM | ||
| 3650 | .Op Fl out Ar file | ||
| 3651 | .Op Fl outform Ar DER | PEM | ||
| 3652 | .Op Fl passin Ar arg | ||
| 3653 | .Op Fl passout Ar arg | ||
| 3654 | .Op Fl v1 Ar alg | ||
| 3655 | .Op Fl v2 Ar alg | ||
| 3656 | .Ek | ||
| 3657 | .Pp | ||
| 3658 | The | ||
| 3659 | .Nm pkcs8 | ||
| 3660 | command processes private keys in PKCS#8 format. | ||
| 3661 | It can handle both unencrypted PKCS#8 PrivateKeyInfo format | ||
| 3662 | and EncryptedPrivateKeyInfo format with a variety of PKCS#5 | ||
| 3663 | .Pq v1.5 and v2.0 | ||
| 3664 | and PKCS#12 algorithms. | ||
| 3665 | .Pp | ||
| 3666 | The options are as follows: | ||
| 3667 | .Bl -tag -width "XXXX" | ||
| 3668 | .It Fl embed | ||
| 3669 | This option generates DSA keys in a broken format. | ||
| 3670 | The DSA parameters are embedded inside the | ||
| 3671 | .Em PrivateKey | ||
| 3672 | structure. | ||
| 3673 | In this form the OCTET STRING contains an ASN1 SEQUENCE consisting of | ||
| 3674 | two structures: | ||
| 3675 | a SEQUENCE containing the parameters and an ASN1 INTEGER containing | ||
| 3676 | the private key. | ||
| 3677 | .It Fl engine Ar id | ||
| 3678 | Specifying an engine (by it's unique | ||
| 3679 | .Ar id | ||
| 3680 | string) will cause | ||
| 3681 | .Nm pkcs8 | ||
| 3682 | to attempt to obtain a functional reference to the specified engine, | ||
| 3683 | thus initialising it if needed. | ||
| 3684 | The engine will then be set as the default for all available algorithms. | ||
| 3685 | .It Fl in Ar file | ||
| 3686 | This specifies the input | ||
| 3687 | .Ar file | ||
| 3688 | to read a key from, or standard input if this option is not specified. | ||
| 3689 | If the key is encrypted, a pass phrase will be prompted for. | ||
| 3690 | .It Fl inform Ar DER | PEM | ||
| 3691 | This specifies the input format. | ||
| 3692 | If a PKCS#8 format key is expected on input, | ||
| 3693 | then either a | ||
| 3694 | DER- or PEM-encoded version of a PKCS#8 key will be expected. | ||
| 3695 | Otherwise the DER or PEM format of the traditional format private key is used. | ||
| 3696 | .It Fl nocrypt | ||
| 3697 | PKCS#8 keys generated or input are normally PKCS#8 | ||
| 3698 | .Em EncryptedPrivateKeyInfo | ||
| 3699 | structures using an appropriate password-based encryption algorithm. | ||
| 3700 | With this option, an unencrypted | ||
| 3701 | .Em PrivateKeyInfo | ||
| 3702 | structure is expected or output. | ||
| 3703 | This option does not encrypt private keys at all and should only be used | ||
| 3704 | when absolutely necessary. | ||
| 3705 | Certain software such as some versions of Java code signing software use | ||
| 3706 | unencrypted private keys. | ||
| 3707 | .It Fl noiter | ||
| 3708 | Use an iteration count of 1. | ||
| 3709 | See the | ||
| 3710 | .Sx PKCS12 | ||
| 3711 | section below for a detailed explanation of this option. | ||
| 3712 | .It Fl nooct | ||
| 3713 | This option generates RSA private keys in a broken format that some software | ||
| 3714 | uses. | ||
| 3715 | Specifically the private key should be enclosed in an OCTET STRING, | ||
| 3716 | but some software just includes the structure itself without the | ||
| 3717 | surrounding OCTET STRING. | ||
| 3718 | .It Fl nsdb | ||
| 3719 | This option generates DSA keys in a broken format compatible with Netscape | ||
| 3720 | private key databases. | ||
| 3721 | The | ||
| 3722 | .Em PrivateKey | ||
| 3723 | contains a SEQUENCE consisting of the public and private keys, respectively. | ||
| 3724 | .It Fl out Ar file | ||
| 3725 | This specifies the output | ||
| 3726 | .Ar file | ||
| 3727 | to write a key to, or standard output by default. | ||
| 3728 | If any encryption options are set, a pass phrase will be prompted for. | ||
| 3729 | The output filename should | ||
| 3730 | .Em not | ||
| 3731 | be the same as the input filename. | ||
| 3732 | .It Fl outform Ar DER | PEM | ||
| 3733 | This specifies the output format; the options have the same meaning as the | ||
| 3734 | .Fl inform | ||
| 3735 | option. | ||
| 3736 | .It Fl passin Ar arg | ||
| 3737 | The input file password source. | ||
| 3738 | For more information about the format of | ||
| 3739 | .Ar arg , | ||
| 3740 | see the | ||
| 3741 | .Sx PASS PHRASE ARGUMENTS | ||
| 3742 | section above. | ||
| 3743 | .It Fl passout Ar arg | ||
| 3744 | The output file password source. | ||
| 3745 | For more information about the format of | ||
| 3746 | .Ar arg , | ||
| 3747 | see the | ||
| 3748 | .Sx PASS PHRASE ARGUMENTS | ||
| 3749 | section above. | ||
| 3750 | .It Fl topk8 | ||
| 3751 | Normally, a PKCS#8 private key is expected on input and a traditional format | ||
| 3752 | private key will be written. | ||
| 3753 | With the | ||
| 3754 | .Fl topk8 | ||
| 3755 | option the situation is reversed: | ||
| 3756 | it reads a traditional format private key and writes a PKCS#8 format key. | ||
| 3757 | .It Fl v1 Ar alg | ||
| 3758 | This option specifies a PKCS#5 v1.5 or PKCS#12 algorithm to use. | ||
| 3759 | A complete list of possible algorithms is included below. | ||
| 3760 | .It Fl v2 Ar alg | ||
| 3761 | This option enables the use of PKCS#5 v2.0 algorithms. | ||
| 3762 | Normally, PKCS#8 private keys are encrypted with the password-based | ||
| 3763 | encryption algorithm called | ||
| 3764 | .Em pbeWithMD5AndDES-CBC ; | ||
| 3765 | this uses 56-bit DES encryption but it was the strongest encryption | ||
| 3766 | algorithm supported in PKCS#5 v1.5. | ||
| 3767 | Using the | ||
| 3768 | .Fl v2 | ||
| 3769 | option PKCS#5 v2.0 algorithms are used which can use any | ||
| 3770 | encryption algorithm such as 168-bit triple DES or 128-bit RC2, however | ||
| 3771 | not many implementations support PKCS#5 v2.0 yet. | ||
| 3772 | If using private keys with | ||
| 3773 | .Nm OpenSSL | ||
| 3774 | then this doesn't matter. | ||
| 3775 | .Pp | ||
| 3776 | The | ||
| 3777 | .Ar alg | ||
| 3778 | argument is the encryption algorithm to use; valid values include | ||
| 3779 | .Ar des , des3 , | ||
| 3780 | and | ||
| 3781 | .Ar rc2 . | ||
| 3782 | It is recommended that | ||
| 3783 | .Ar des3 | ||
| 3784 | is used. | ||
| 3785 | .El | ||
| 3786 | .Sh PKCS8 NOTES | ||
| 3787 | The encrypted form of a PEM-encoded PKCS#8 file uses the following | ||
| 3788 | headers and footers: | ||
| 3789 | .Bd -unfilled -offset indent | ||
| 3790 | -----BEGIN ENCRYPTED PRIVATE KEY----- | ||
| 3791 | -----END ENCRYPTED PRIVATE KEY----- | ||
| 3792 | .Ed | ||
| 3793 | .Pp | ||
| 3794 | The unencrypted form uses: | ||
| 3795 | .Bd -unfilled -offset indent | ||
| 3796 | -----BEGIN PRIVATE KEY----- | ||
| 3797 | -----END PRIVATE KEY----- | ||
| 3798 | .Ed | ||
| 3799 | .Pp | ||
| 3800 | Private keys encrypted using PKCS#5 v2.0 algorithms and high iteration | ||
| 3801 | counts are more secure than those encrypted using the traditional | ||
| 3802 | .Nm SSLeay | ||
| 3803 | compatible formats. | ||
| 3804 | So if additional security is considered important, the keys should be converted. | ||
| 3805 | .Pp | ||
| 3806 | The default encryption is only 56 bits because this is the encryption | ||
| 3807 | that most current implementations of PKCS#8 support. | ||
| 3808 | .Pp | ||
| 3809 | Some software may use PKCS#12 password-based encryption algorithms | ||
| 3810 | with PKCS#8 format private keys: these are handled automatically | ||
| 3811 | but there is no option to produce them. | ||
| 3812 | .Pp | ||
| 3813 | It is possible to write out | ||
| 3814 | DER-encoded encrypted private keys in PKCS#8 format because the encryption | ||
| 3815 | details are included at an ASN1 | ||
| 3816 | level whereas the traditional format includes them at a PEM level. | ||
| 3817 | .Sh PKCS#5 V1.5 AND PKCS#12 ALGORITHMS | ||
| 3818 | Various algorithms can be used with the | ||
| 3819 | .Fl v1 | ||
| 3820 | command line option, including PKCS#5 v1.5 and PKCS#12. | ||
| 3821 | These are described in more detail below. | ||
| 3822 | .Pp | ||
| 3823 | .Bl -tag -width "XXXX" -compact | ||
| 3824 | .It Ar PBE-MD2-DES | PBE-MD5-DES | ||
| 3825 | These algorithms were included in the original PKCS#5 v1.5 specification. | ||
| 3826 | They only offer 56 bits of protection since they both use DES. | ||
| 3827 | .Pp | ||
| 3828 | .It Ar PBE-SHA1-RC2-64 | PBE-MD2-RC2-64 | PBE-MD5-RC2-64 | PBE-SHA1-DES | ||
| 3829 | These algorithms are not mentioned in the original PKCS#5 v1.5 specification | ||
| 3830 | but they use the same key derivation algorithm and are supported by some | ||
| 3831 | software. | ||
| 3832 | They are mentioned in PKCS#5 v2.0. | ||
| 3833 | They use either 64-bit RC2 or 56-bit DES. | ||
| 3834 | .Pp | ||
| 3835 | .It Ar PBE-SHA1-RC4-128 | PBE-SHA1-RC4-40 | PBE-SHA1-3DES | PBE-SHA1-2DES | ||
| 3836 | .It Ar PBE-SHA1-RC2-128 | PBE-SHA1-RC2-40 | ||
| 3837 | These algorithms use the PKCS#12 password-based encryption algorithm and | ||
| 3838 | allow strong encryption algorithms like triple DES or 128-bit RC2 to be used. | ||
| 3839 | .El | ||
| 3840 | .Sh PKCS8 EXAMPLES | ||
| 3841 | Convert a private key from traditional to PKCS#5 v2.0 format using triple DES: | ||
| 3842 | .Pp | ||
| 3843 | .Dl "$ openssl pkcs8 -in key.pem -topk8 -v2 des3 -out enckey.pem" | ||
| 3844 | .Pp | ||
| 3845 | Convert a private key to PKCS#8 using a PKCS#5 1.5 compatible algorithm | ||
| 3846 | .Pq DES : | ||
| 3847 | .Pp | ||
| 3848 | .Dl $ openssl pkcs8 -in key.pem -topk8 -out enckey.pem | ||
| 3849 | .Pp | ||
| 3850 | Convert a private key to PKCS#8 using a PKCS#12 compatible algorithm | ||
| 3851 | .Pq 3DES : | ||
| 3852 | .Bd -literal -offset indent | ||
| 3853 | $ openssl pkcs8 -in key.pem -topk8 -out enckey.pem \e | ||
| 3854 | -v1 PBE-SHA1-3DES | ||
| 3855 | .Ed | ||
| 3856 | .Pp | ||
| 3857 | Read a DER-unencrypted PKCS#8 format private key: | ||
| 3858 | .Pp | ||
| 3859 | .Dl "$ openssl pkcs8 -inform DER -nocrypt -in key.der -out key.pem" | ||
| 3860 | .Pp | ||
| 3861 | Convert a private key from any PKCS#8 format to traditional format: | ||
| 3862 | .Pp | ||
| 3863 | .Dl $ openssl pkcs8 -in pk8.pem -out key.pem | ||
| 3864 | .Sh PKCS8 STANDARDS | ||
| 3865 | Test vectors from this PKCS#5 v2.0 implementation were posted to the | ||
| 3866 | pkcs-tng mailing list using triple DES, DES and RC2 with high iteration counts; | ||
| 3867 | several people confirmed that they could decrypt the private | ||
| 3868 | keys produced and therefore it can be assumed that the PKCS#5 v2.0 | ||
| 3869 | implementation is reasonably accurate at least as far as these | ||
| 3870 | algorithms are concerned. | ||
| 3871 | .Pp | ||
| 3872 | The format of PKCS#8 DSA | ||
| 3873 | .Pq and other | ||
| 3874 | private keys is not well documented: | ||
| 3875 | it is hidden away in PKCS#11 v2.01, section 11.9; | ||
| 3876 | .Nm OpenSSL Ns Li 's | ||
| 3877 | default DSA PKCS#8 private key format complies with this standard. | ||
| 3878 | .Sh PKCS8 BUGS | ||
| 3879 | There should be an option that prints out the encryption algorithm | ||
| 3880 | in use and other details such as the iteration count. | ||
| 3881 | .Pp | ||
| 3882 | PKCS#8 using triple DES and PKCS#5 v2.0 should be the default private | ||
| 3883 | key format; for | ||
| 3884 | .Nm OpenSSL | ||
| 3885 | compatibility, several of the utilities use the old format at present. | ||
| 3886 | .\" | ||
| 3887 | .\" PKCS12 | ||
| 3888 | .\" | ||
| 3889 | .Sh PKCS12 | ||
| 3890 | .Nm "openssl pkcs12" | ||
| 3891 | .Bk -words | ||
| 3892 | .Oo | ||
| 3893 | .Fl aes128 | aes192 | aes256 | | ||
| 3894 | .Fl des | des3 | ||
| 3895 | .Oc | ||
| 3896 | .Op Fl cacerts | ||
| 3897 | .Op Fl chain | ||
| 3898 | .Op Fl clcerts | ||
| 3899 | .Op Fl descert | ||
| 3900 | .Op Fl export | ||
| 3901 | .Op Fl info | ||
| 3902 | .Op Fl keyex | ||
| 3903 | .Op Fl keysig | ||
| 3904 | .Op Fl maciter | ||
| 3905 | .Op Fl nocerts | ||
| 3906 | .Op Fl nodes | ||
| 3907 | .Op Fl noiter | ||
| 3908 | .Op Fl nokeys | ||
| 3909 | .Op Fl nomaciter | ||
| 3910 | .Op Fl nomacver | ||
| 3911 | .Op Fl noout | ||
| 3912 | .Op Fl twopass | ||
| 3913 | .Op Fl CAfile Ar file | ||
| 3914 | .Op Fl CApath Ar directory | ||
| 3915 | .Op Fl caname Ar name | ||
| 3916 | .Op Fl certfile Ar file | ||
| 3917 | .Op Fl certpbe Ar alg | ||
| 3918 | .Op Fl engine Ar id | ||
| 3919 | .Op Fl in Ar file | ||
| 3920 | .Op Fl inkey Ar file | ||
| 3921 | .Op Fl keypbe Ar alg | ||
| 3922 | .Op Fl name Ar name | ||
| 3923 | .Op Fl out Ar file | ||
| 3924 | .Op Fl passin Ar arg | ||
| 3925 | .Op Fl passout Ar arg | ||
| 3926 | .Op Fl rand Ar file ... | ||
| 3927 | .Ek | ||
| 3928 | .Pp | ||
| 3929 | The | ||
| 3930 | .Nm pkcs12 | ||
| 3931 | command allows PKCS#12 files | ||
| 3932 | .Pq sometimes referred to as PFX files | ||
| 3933 | to be created and parsed. | ||
| 3934 | PKCS#12 files are used by several programs including Netscape, MSIE | ||
| 3935 | and MS Outlook. | ||
| 3936 | .Pp | ||
| 3937 | There are a lot of options; the meaning of some depends on whether a | ||
| 3938 | PKCS#12 file is being created or parsed. | ||
| 3939 | By default, a PKCS#12 file is parsed; | ||
| 3940 | a PKCS#12 file can be created by using the | ||
| 3941 | .Fl export | ||
| 3942 | option | ||
| 3943 | .Pq see below . | ||
| 3944 | .Sh PKCS12 PARSING OPTIONS | ||
| 3945 | .Bl -tag -width "XXXX" | ||
| 3946 | .It Xo | ||
| 3947 | .Fl aes128 | aes192 | aes256 | | ||
| 3948 | .Fl des | des3 | ||
| 3949 | .Xc | ||
| 3950 | Use AES, DES, or triple DES, respectively, | ||
| 3951 | to encrypt private keys before outputting. | ||
| 3952 | The default is triple DES. | ||
| 3953 | .It Fl cacerts | ||
| 3954 | Only output CA certificates | ||
| 3955 | .Pq not client certificates . | ||
| 3956 | .It Fl clcerts | ||
| 3957 | Only output client certificates | ||
| 3958 | .Pq not CA certificates . | ||
| 3959 | .It Fl in Ar file | ||
| 3960 | This specifies the | ||
| 3961 | .Ar file | ||
| 3962 | of the PKCS#12 file to be parsed. | ||
| 3963 | Standard input is used by default. | ||
| 3964 | .It Fl info | ||
| 3965 | Output additional information about the PKCS#12 file structure, | ||
| 3966 | algorithms used, and iteration counts. | ||
| 3967 | .It Fl nocerts | ||
| 3968 | No certificates at all will be output. | ||
| 3969 | .It Fl nodes | ||
| 3970 | Don't encrypt the private keys at all. | ||
| 3971 | .It Fl nokeys | ||
| 3972 | No private keys will be output. | ||
| 3973 | .It Fl nomacver | ||
| 3974 | Don't attempt to verify the integrity MAC before reading the file. | ||
| 3975 | .It Fl noout | ||
| 3976 | This option inhibits output of the keys and certificates to the output file | ||
| 3977 | version of the PKCS#12 file. | ||
| 3978 | .It Fl out Ar file | ||
| 3979 | The | ||
| 3980 | .Ar file | ||
| 3981 | to write certificates and private keys to, standard output by default. | ||
| 3982 | They are all written in PEM format. | ||
| 3983 | .It Fl passin Ar arg | ||
| 3984 | The PKCS#12 file | ||
| 3985 | .Pq i.e. input file | ||
| 3986 | password source. | ||
| 3987 | For more information about the format of | ||
| 3988 | .Ar arg , | ||
| 3989 | see the | ||
| 3990 | .Sx PASS PHRASE ARGUMENTS | ||
| 3991 | section above. | ||
| 3992 | .It Fl passout Ar arg | ||
| 3993 | Pass phrase source to encrypt any outputed private keys with. | ||
| 3994 | For more information about the format of | ||
| 3995 | .Ar arg , | ||
| 3996 | see the | ||
| 3997 | .Sx PASS PHRASE ARGUMENTS | ||
| 3998 | section above. | ||
| 3999 | .It Fl twopass | ||
| 4000 | Prompt for separate integrity and encryption passwords: most software | ||
| 4001 | always assumes these are the same so this option will render such | ||
| 4002 | PKCS#12 files unreadable. | ||
| 4003 | .El | ||
| 4004 | .Sh PKCS12 FILE CREATION OPTIONS | ||
| 4005 | .Bl -tag -width "XXXX" | ||
| 4006 | .It Fl CAfile Ar file | ||
| 4007 | File of CAs | ||
| 4008 | .Pq PEM format . | ||
| 4009 | .It Fl CApath Ar directory | ||
| 4010 | Directory of CAs | ||
| 4011 | .Pq PEM format . | ||
| 4012 | .It Fl caname Ar name | ||
| 4013 | This specifies the | ||
| 4014 | .Qq friendly name | ||
| 4015 | for other certificates. | ||
| 4016 | This option may be used multiple times to specify names for all certificates | ||
| 4017 | in the order they appear. | ||
| 4018 | Netscape ignores friendly names on other certificates, | ||
| 4019 | whereas MSIE displays them. | ||
| 4020 | .It Fl certfile Ar file | ||
| 4021 | A file to read additional certificates from. | ||
| 4022 | .It Fl certpbe Ar alg , Fl keypbe Ar alg | ||
| 4023 | These options allow the algorithm used to encrypt the private key and | ||
| 4024 | certificates to be selected. | ||
| 4025 | Although any PKCS#5 v1.5 or PKCS#12 algorithms can be selected, | ||
| 4026 | it is advisable to only use PKCS#12 algorithms. | ||
| 4027 | See the list in the | ||
| 4028 | .Sx PKCS12 NOTES | ||
| 4029 | section for more information. | ||
| 4030 | .It Fl chain | ||
| 4031 | If this option is present, an attempt is made to include the entire | ||
| 4032 | certificate chain of the user certificate. | ||
| 4033 | The standard CA store is used for this search. | ||
| 4034 | If the search fails, it is considered a fatal error. | ||
| 4035 | .It Fl descert | ||
| 4036 | Encrypt the certificate using triple DES; this may render the PKCS#12 | ||
| 4037 | file unreadable by some | ||
| 4038 | .Qq export grade | ||
| 4039 | software. | ||
| 4040 | By default, the private key is encrypted using triple DES and the | ||
| 4041 | certificate using 40-bit RC2. | ||
| 4042 | .It Fl engine Ar id | ||
| 4043 | Specifying an engine (by it's unique | ||
| 4044 | .Ar id | ||
| 4045 | string) will cause | ||
| 4046 | .Nm pkcs12 | ||
| 4047 | to attempt to obtain a functional reference to the specified engine, | ||
| 4048 | thus initialising it if needed. | ||
| 4049 | The engine will then be set as the default for all available algorithms. | ||
| 4050 | .It Fl export | ||
| 4051 | This option specifies that a PKCS#12 file will be created rather than | ||
| 4052 | parsed. | ||
| 4053 | .It Fl in Ar file | ||
| 4054 | The | ||
| 4055 | .Ar file | ||
| 4056 | to read certificates and private keys from, standard input by default. | ||
| 4057 | They must all be in PEM format. | ||
| 4058 | The order doesn't matter but one private key and its corresponding | ||
| 4059 | certificate should be present. | ||
| 4060 | If additional certificates are present, they will also be included | ||
| 4061 | in the PKCS#12 file. | ||
| 4062 | .It Fl inkey Ar file | ||
| 4063 | File to read private key from. | ||
| 4064 | If not present, a private key must be present in the input file. | ||
| 4065 | .It Fl keyex | keysig | ||
| 4066 | Specifies that the private key is to be used for key exchange or just signing. | ||
| 4067 | This option is only interpreted by MSIE and similar MS software. | ||
| 4068 | Normally, | ||
| 4069 | .Qq export grade | ||
| 4070 | software will only allow 512-bit RSA keys to be | ||
| 4071 | used for encryption purposes, but arbitrary length keys for signing. | ||
| 4072 | The | ||
| 4073 | .Fl keysig | ||
| 4074 | option marks the key for signing only. | ||
| 4075 | Signing only keys can be used for S/MIME signing, authenticode | ||
| 4076 | .Pq ActiveX control signing | ||
| 4077 | and SSL client authentication; | ||
| 4078 | however, due to a bug only MSIE 5.0 and later support | ||
| 4079 | the use of signing only keys for SSL client authentication. | ||
| 4080 | .It Fl maciter | ||
| 4081 | This option is included for compatibility with previous versions; it used | ||
| 4082 | to be needed to use MAC iterations counts but they are now used by default. | ||
| 4083 | .It Fl name Ar name | ||
| 4084 | This specifies the | ||
| 4085 | .Qq friendly name | ||
| 4086 | for the certificate and private key. | ||
| 4087 | This name is typically displayed in list boxes by software importing the file. | ||
| 4088 | .It Fl nomaciter , noiter | ||
| 4089 | These options affect the iteration counts on the MAC and key algorithms. | ||
| 4090 | Unless you wish to produce files compatible with MSIE 4.0, you should leave | ||
| 4091 | these options alone. | ||
| 4092 | .Pp | ||
| 4093 | To discourage attacks by using large dictionaries of common passwords, | ||
| 4094 | the algorithm that derives keys from passwords can have an iteration count | ||
| 4095 | applied to it: this causes a certain part of the algorithm to be repeated | ||
| 4096 | and slows it down. | ||
| 4097 | The MAC is used to check the file integrity but since it will normally | ||
| 4098 | have the same password as the keys and certificates it could also be attacked. | ||
| 4099 | By default, both MAC and encryption iteration counts are set to 2048; | ||
| 4100 | using these options the MAC and encryption iteration counts can be set to 1. | ||
| 4101 | Since this reduces the file security you should not use these options | ||
| 4102 | unless you really have to. | ||
| 4103 | Most software supports both MAC and key iteration counts. | ||
| 4104 | MSIE 4.0 doesn't support MAC iteration counts, so it needs the | ||
| 4105 | .Fl nomaciter | ||
| 4106 | option. | ||
| 4107 | .It Fl out Ar file | ||
| 4108 | This specifies | ||
| 4109 | .Ar file | ||
| 4110 | to write the PKCS#12 file to. | ||
| 4111 | Standard output is used by default. | ||
| 4112 | .It Fl passin Ar arg | ||
| 4113 | Pass phrase source to decrypt any input private keys with. | ||
| 4114 | For more information about the format of | ||
| 4115 | .Ar arg , | ||
| 4116 | see the | ||
| 4117 | .Sx PASS PHRASE ARGUMENTS | ||
| 4118 | section above. | ||
| 4119 | .It Fl passout Ar arg | ||
| 4120 | The PKCS#12 file | ||
| 4121 | .Pq i.e. output file | ||
| 4122 | password source. | ||
| 4123 | For more information about the format of | ||
| 4124 | .Ar arg , | ||
| 4125 | see the | ||
| 4126 | .Sx PASS PHRASE ARGUMENTS | ||
| 4127 | section above. | ||
| 4128 | .It Fl rand Ar file ... | ||
| 4129 | A file or files | ||
| 4130 | containing random data used to seed the random number generator, | ||
| 4131 | or an EGD socket (see | ||
| 4132 | .Xr RAND_egd 3 ) . | ||
| 4133 | Multiple files can be specified separated by a | ||
| 4134 | .Sq \&: . | ||
| 4135 | .El | ||
| 4136 | .Sh PKCS12 NOTES | ||
| 4137 | Although there are a large number of options, | ||
| 4138 | most of them are very rarely used. | ||
| 4139 | For PKCS#12 file parsing, only | ||
| 4140 | .Fl in | ||
| 4141 | and | ||
| 4142 | .Fl out | ||
| 4143 | need to be used for PKCS#12 file creation. | ||
| 4144 | .Fl export | ||
| 4145 | and | ||
| 4146 | .Fl name | ||
| 4147 | are also used. | ||
| 4148 | .Pp | ||
| 4149 | If none of the | ||
| 4150 | .Fl clcerts , cacerts , | ||
| 4151 | or | ||
| 4152 | .Fl nocerts | ||
| 4153 | options are present, then all certificates will be output in the order | ||
| 4154 | they appear in the input PKCS#12 files. | ||
| 4155 | There is no guarantee that the first certificate present is | ||
| 4156 | the one corresponding to the private key. | ||
| 4157 | Certain software which requires a private key and certificate and assumes | ||
| 4158 | the first certificate in the file is the one corresponding to the private key: | ||
| 4159 | this may not always be the case. | ||
| 4160 | Using the | ||
| 4161 | .Fl clcerts | ||
| 4162 | option will solve this problem by only outputting the certificate | ||
| 4163 | corresponding to the private key. | ||
| 4164 | If the CA certificates are required, they can be output to a separate | ||
| 4165 | file using the | ||
| 4166 | .Fl nokeys | ||
| 4167 | and | ||
| 4168 | .Fl cacerts | ||
| 4169 | options to just output CA certificates. | ||
| 4170 | .Pp | ||
| 4171 | The | ||
| 4172 | .Fl keypbe | ||
| 4173 | and | ||
| 4174 | .Fl certpbe | ||
| 4175 | algorithms allow the precise encryption algorithms for private keys | ||
| 4176 | and certificates to be specified. | ||
| 4177 | Normally, the defaults are fine but occasionally software can't handle | ||
| 4178 | triple DES encrypted private keys; | ||
| 4179 | then the option | ||
| 4180 | .Fl keypbe Ar PBE-SHA1-RC2-40 | ||
| 4181 | can be used to reduce the private key encryption to 40-bit RC2. | ||
| 4182 | A complete description of all algorithms is contained in the | ||
| 4183 | .Sx PKCS8 | ||
| 4184 | section above. | ||
| 4185 | .Sh PKCS12 EXAMPLES | ||
| 4186 | Parse a PKCS#12 file and output it to a file: | ||
| 4187 | .Pp | ||
| 4188 | .Dl $ openssl pkcs12 -in file.p12 -out file.pem | ||
| 4189 | .Pp | ||
| 4190 | Output only client certificates to a file: | ||
| 4191 | .Pp | ||
| 4192 | .Dl $ openssl pkcs12 -in file.p12 -clcerts -out file.pem | ||
| 4193 | .Pp | ||
| 4194 | Don't encrypt the private key: | ||
| 4195 | .Pp | ||
| 4196 | .Dl $ openssl pkcs12 -in file.p12 -out file.pem -nodes | ||
| 4197 | .Pp | ||
| 4198 | Print some info about a PKCS#12 file: | ||
| 4199 | .Pp | ||
| 4200 | .Dl $ openssl pkcs12 -in file.p12 -info -noout | ||
| 4201 | .Pp | ||
| 4202 | Create a PKCS#12 file: | ||
| 4203 | .Bd -literal -offset indent | ||
| 4204 | $ openssl pkcs12 -export -in file.pem -out file.p12 \e | ||
| 4205 | -name "My Certificate" | ||
| 4206 | .Ed | ||
| 4207 | .Pp | ||
| 4208 | Include some extra certificates: | ||
| 4209 | .Bd -literal -offset indent | ||
| 4210 | $ openssl pkcs12 -export -in file.pem -out file.p12 \e | ||
| 4211 | -name "My Certificate" -certfile othercerts.pem | ||
| 4212 | .Ed | ||
| 4213 | .Sh PKCS12 BUGS | ||
| 4214 | Some would argue that the PKCS#12 standard is one big bug :\-) | ||
| 4215 | .Pp | ||
| 4216 | Versions of | ||
| 4217 | .Nm OpenSSL | ||
| 4218 | before 0.9.6a had a bug in the PKCS#12 key generation routines. | ||
| 4219 | Under rare circumstances this could produce a PKCS#12 file encrypted | ||
| 4220 | with an invalid key. | ||
| 4221 | As a result some PKCS#12 files which triggered this bug | ||
| 4222 | from other implementations | ||
| 4223 | .Pq MSIE or Netscape | ||
| 4224 | could not be decrypted by | ||
| 4225 | .Nm OpenSSL | ||
| 4226 | and similarly | ||
| 4227 | .Nm OpenSSL | ||
| 4228 | could produce PKCS#12 files which could not be decrypted by other | ||
| 4229 | implementations. | ||
| 4230 | The chances of producing such a file are relatively small: less than 1 in 256. | ||
| 4231 | .Pp | ||
| 4232 | A side effect of fixing this bug is that any old invalidly encrypted PKCS#12 | ||
| 4233 | files can no longer be parsed by the fixed version. | ||
| 4234 | Under such circumstances the | ||
| 4235 | .Nm pkcs12 | ||
| 4236 | utility will report that the MAC is OK but fail with a decryption | ||
| 4237 | error when extracting private keys. | ||
| 4238 | .Pp | ||
| 4239 | This problem can be resolved by extracting the private keys and certificates | ||
| 4240 | from the PKCS#12 file using an older version of | ||
| 4241 | .Nm OpenSSL | ||
| 4242 | and recreating | ||
| 4243 | the PKCS#12 file from the keys and certificates using a newer version of | ||
| 4244 | .Nm OpenSSL . | ||
| 4245 | For example: | ||
| 4246 | .Bd -literal -offset indent | ||
| 4247 | $ old-openssl -in bad.p12 -out keycerts.pem | ||
| 4248 | $ openssl -in keycerts.pem -export -name "My PKCS#12 file" \e | ||
| 4249 | -out fixed.p12 | ||
| 4250 | .Ed | ||
| 4251 | .\" | ||
| 4252 | .\" RAND | ||
| 4253 | .\" | ||
| 4254 | .Sh RAND | ||
| 4255 | .Cm openssl rand | ||
| 4256 | .Op Fl base64 | ||
| 4257 | .Op Fl hex | ||
| 4258 | .Op Fl engine Ar id | ||
| 4259 | .Op Fl out Ar file | ||
| 4260 | .Op Fl rand Ar file ... | ||
| 4261 | .Ar num | ||
| 4262 | .Pp | ||
| 4263 | The | ||
| 4264 | .Nm rand | ||
| 4265 | command outputs | ||
| 4266 | .Ar num | ||
| 4267 | pseudo-random bytes after seeding | ||
| 4268 | the random number generator once. | ||
| 4269 | As in other | ||
| 4270 | .Nm openssl | ||
| 4271 | command line tools, PRNG seeding uses the file | ||
| 4272 | .Pa $HOME/.rnd | ||
| 4273 | or | ||
| 4274 | .Pa .rnd | ||
| 4275 | in addition to the files given in the | ||
| 4276 | .Fl rand | ||
| 4277 | option. | ||
| 4278 | A new | ||
| 4279 | .Pa $HOME/.rnd | ||
| 4280 | or | ||
| 4281 | .Pa .rnd | ||
| 4282 | file will be written back if enough | ||
| 4283 | seeding was obtained from these sources. | ||
| 4284 | .Pp | ||
| 4285 | The options are as follows: | ||
| 4286 | .Bl -tag -width "XXXX" | ||
| 4287 | .It Fl base64 | ||
| 4288 | Perform | ||
| 4289 | .Em base64 | ||
| 4290 | encoding on the output. | ||
| 4291 | .It Fl engine Ar id | ||
| 4292 | Specifying an engine (by it's unique | ||
| 4293 | .Ar id | ||
| 4294 | string) will cause | ||
| 4295 | .Nm rand | ||
| 4296 | to attempt to obtain a functional reference to the specified engine, | ||
| 4297 | thus initialising it if needed. | ||
| 4298 | The engine will then be set as the default for all available algorithms. | ||
| 4299 | .It Fl hex | ||
| 4300 | Specify hexadecimal output. | ||
| 4301 | .It Fl out Ar file | ||
| 4302 | Write to | ||
| 4303 | .Ar file | ||
| 4304 | instead of standard output. | ||
| 4305 | .It Fl rand Ar file ... | ||
| 4306 | Use specified file or files, or EGD socket (see | ||
| 4307 | .Xr RAND_egd 3 ) | ||
| 4308 | for seeding the random number generator. | ||
| 4309 | Multiple files can be specified separated by a | ||
| 4310 | .Sq \&: . | ||
| 4311 | .El | ||
| 4312 | .\" | ||
| 4313 | .\" REQ | ||
| 4314 | .\" | ||
| 4315 | .Sh REQ | ||
| 4316 | .Nm openssl req | ||
| 4317 | .Bk -words | ||
| 4318 | .Op Fl asn1-kludge | ||
| 4319 | .Op Fl batch | ||
| 4320 | .Op Fl md2 | md4 | md5 | sha1 | ||
| 4321 | .Op Fl modulus | ||
| 4322 | .Op Fl new | ||
| 4323 | .Op Fl newhdr | ||
| 4324 | .Op Fl nodes | ||
| 4325 | .Op Fl noout | ||
| 4326 | .Op Fl pubkey | ||
| 4327 | .Op Fl subject | ||
| 4328 | .Op Fl text | ||
| 4329 | .Op Fl utf8 | ||
| 4330 | .Op Fl verbose | ||
| 4331 | .Op Fl verify | ||
| 4332 | .Op Fl x509 | ||
| 4333 | .Op Fl config Ar file | ||
| 4334 | .Op Fl days Ar n | ||
| 4335 | .Op Fl engine Ar id | ||
| 4336 | .Op Fl extensions Ar section | ||
| 4337 | .Op Fl in Ar file | ||
| 4338 | .Op Fl inform Ar DER | PEM | ||
| 4339 | .Op Fl key Ar keyfile | ||
| 4340 | .Op Fl keyform Ar DER | PEM | ||
| 4341 | .Op Fl keyout Ar file | ||
| 4342 | .Op Fl nameopt Ar option | ||
| 4343 | .Oo Xo | ||
| 4344 | .Fl newkey | ||
| 4345 | .Ar dsa : Ns Ar file | ||
| 4346 | .Xc | ||
| 4347 | .Oc | ||
| 4348 | .Oo Xo | ||
| 4349 | .Fl newkey | ||
| 4350 | .Ar rsa : Ns Ar bits | ||
| 4351 | .Xc | ||
| 4352 | .Oc | ||
| 4353 | .Op Fl out Ar file | ||
| 4354 | .Op Fl outform Ar DER | PEM | ||
| 4355 | .Op Fl passin Ar arg | ||
| 4356 | .Op Fl passout Ar arg | ||
| 4357 | .Op Fl rand Ar file ... | ||
| 4358 | .Op Fl reqexts Ar section | ||
| 4359 | .Op Fl reqopt Ar option | ||
| 4360 | .Op Fl set_serial Ar n | ||
| 4361 | .Op Fl subj Ar arg | ||
| 4362 | .Ek | ||
| 4363 | .Pp | ||
| 4364 | The | ||
| 4365 | .Nm req | ||
| 4366 | command primarily creates and processes certificate requests | ||
| 4367 | in PKCS#10 format. | ||
| 4368 | It can additionally create self-signed certificates, | ||
| 4369 | for use as root CAs, for example. | ||
| 4370 | .Pp | ||
| 4371 | The options are as follows: | ||
| 4372 | .Bl -tag -width "XXXX" | ||
| 4373 | .It Fl asn1-kludge | ||
| 4374 | By default, the | ||
| 4375 | .Nm req | ||
| 4376 | command outputs certificate requests containing | ||
| 4377 | no attributes in the correct PKCS#10 format. | ||
| 4378 | However certain CAs will only | ||
| 4379 | accept requests containing no attributes in an invalid form: this | ||
| 4380 | option produces this invalid format. | ||
| 4381 | .Pp | ||
| 4382 | More precisely, the | ||
| 4383 | .Em Attributes | ||
| 4384 | in a PKCS#10 certificate request are defined as a SET OF Attribute. | ||
| 4385 | They are | ||
| 4386 | .Em not | ||
| 4387 | optional, so if no attributes are present then they should be encoded as an | ||
| 4388 | empty SET OF. | ||
| 4389 | The invalid form does not include the empty | ||
| 4390 | SET OF, whereas the correct form does. | ||
| 4391 | .Pp | ||
| 4392 | It should be noted that very few CAs still require the use of this option. | ||
| 4393 | .It Fl batch | ||
| 4394 | Non-interactive mode. | ||
| 4395 | .It Fl config Ar file | ||
| 4396 | This allows an alternative configuration file to be specified; | ||
| 4397 | this overrides the compile time filename or any specified in | ||
| 4398 | the | ||
| 4399 | .Ev OPENSSL_CONF | ||
| 4400 | environment variable. | ||
| 4401 | .It Fl days Ar n | ||
| 4402 | When the | ||
| 4403 | .Fl x509 | ||
| 4404 | option is being used, this specifies the number of | ||
| 4405 | days to certify the certificate for. | ||
| 4406 | The default is 30 days. | ||
| 4407 | .It Fl engine Ar id | ||
| 4408 | Specifying an engine (by it's unique | ||
| 4409 | .Ar id | ||
| 4410 | string) will cause | ||
| 4411 | .Nm req | ||
| 4412 | to attempt to obtain a functional reference to the specified engine, | ||
| 4413 | thus initialising it if needed. | ||
| 4414 | The engine will then be set as the default for all available algorithms. | ||
| 4415 | .It Fl extensions Ar section , Fl reqexts Ar section | ||
| 4416 | These options specify alternative sections to include certificate | ||
| 4417 | extensions (if the | ||
| 4418 | .Fl x509 | ||
| 4419 | option is present) or certificate request extensions. | ||
| 4420 | This allows several different sections to | ||
| 4421 | be used in the same configuration file to specify requests for | ||
| 4422 | a variety of purposes. | ||
| 4423 | .It Fl in Ar file | ||
| 4424 | This specifies the input | ||
| 4425 | .Ar file | ||
| 4426 | to read a request from, or standard input | ||
| 4427 | if this option is not specified. | ||
| 4428 | A request is only read if the creation options | ||
| 4429 | .Fl new | ||
| 4430 | and | ||
| 4431 | .Fl newkey | ||
| 4432 | are not specified. | ||
| 4433 | .It Fl inform Ar DER | PEM | ||
| 4434 | This specifies the input format. | ||
| 4435 | The | ||
| 4436 | .Ar DER | ||
| 4437 | argument uses an ASN1 DER-encoded form compatible with the PKCS#10. | ||
| 4438 | The | ||
| 4439 | .Ar PEM | ||
| 4440 | form is the default format: | ||
| 4441 | it consists of the DER format base64-encoded with additional header and | ||
| 4442 | footer lines. | ||
| 4443 | .It Fl key Ar keyfile | ||
| 4444 | This specifies the file to read the private key from. | ||
| 4445 | It also accepts PKCS#8 format private keys for PEM format files. | ||
| 4446 | .It Fl keyform Ar DER | PEM | ||
| 4447 | The format of the private key file specified in the | ||
| 4448 | .Fl key | ||
| 4449 | argument. | ||
| 4450 | .Ar PEM | ||
| 4451 | is the default. | ||
| 4452 | .It Fl keyout Ar file | ||
| 4453 | This gives the | ||
| 4454 | .Ar file | ||
| 4455 | to write the newly created private key to. | ||
| 4456 | If this option is not specified, the filename present in the | ||
| 4457 | configuration file is used. | ||
| 4458 | .It Fl md2 | md4 | md5 | sha1 | ||
| 4459 | This specifies the message digest to sign the request with. | ||
| 4460 | This overrides the digest algorithm specified in the configuration file. | ||
| 4461 | This option is ignored for DSA requests: they always use SHA1. | ||
| 4462 | .It Fl modulus | ||
| 4463 | This option prints out the value of the modulus of the public key | ||
| 4464 | contained in the request. | ||
| 4465 | .It Fl nameopt Ar option , Fl reqopt Ar option | ||
| 4466 | These options determine how the subject or issuer names are displayed. | ||
| 4467 | The | ||
| 4468 | .Ar option | ||
| 4469 | argument can be a single option or multiple options separated by commas. | ||
| 4470 | Alternatively, these options may be used more than once to set multiple options. | ||
| 4471 | See the | ||
| 4472 | .Sx X509 | ||
| 4473 | section below for details. | ||
| 4474 | .It Fl new | ||
| 4475 | This option generates a new certificate request. | ||
| 4476 | It will prompt the user for the relevant field values. | ||
| 4477 | The actual fields prompted for and their maximum and minimum sizes | ||
| 4478 | are specified in the configuration file and any requested extensions. | ||
| 4479 | .Pp | ||
| 4480 | If the | ||
| 4481 | .Fl key | ||
| 4482 | option is not used, it will generate a new RSA private | ||
| 4483 | key using information specified in the configuration file. | ||
| 4484 | .It Fl newhdr | ||
| 4485 | Adds the word NEW to the PEM file header and footer lines | ||
| 4486 | on the outputed request. | ||
| 4487 | Some software | ||
| 4488 | .Pq Netscape certificate server | ||
| 4489 | and some CAs need this. | ||
| 4490 | .It Fl newkey Ar arg | ||
| 4491 | This option creates a new certificate request and a new private key. | ||
| 4492 | The argument takes one of two forms: | ||
| 4493 | .Ar rsa : Ns Ar nbits , | ||
| 4494 | where | ||
| 4495 | .Ar nbits | ||
| 4496 | is the number of bits, generates an RSA key | ||
| 4497 | .Ar nbits | ||
| 4498 | in size. | ||
| 4499 | .Ar dsa : Ns Ar file | ||
| 4500 | generates a DSA key using the parameters in the file | ||
| 4501 | .Ar file . | ||
| 4502 | .It Fl nodes | ||
| 4503 | If this option is specified and a private key is created, it | ||
| 4504 | will not be encrypted. | ||
| 4505 | .It Fl noout | ||
| 4506 | This option prevents output of the encoded version of the request. | ||
| 4507 | .It Fl out Ar file | ||
| 4508 | This specifies the output | ||
| 4509 | .Ar file | ||
| 4510 | to write to, or standard output by default. | ||
| 4511 | .It Fl outform Ar DER | PEM | ||
| 4512 | This specifies the output format; the options have the same meaning as the | ||
| 4513 | .Fl inform | ||
| 4514 | option. | ||
| 4515 | .It Fl passin Ar arg | ||
| 4516 | The input file password source. | ||
| 4517 | For more information about the format of | ||
| 4518 | .Ar arg , | ||
| 4519 | see the | ||
| 4520 | .Sx PASS PHRASE ARGUMENTS | ||
| 4521 | section above. | ||
| 4522 | .It Fl passout Ar arg | ||
| 4523 | The output file password source. | ||
| 4524 | For more information about the format of | ||
| 4525 | .Ar arg , | ||
| 4526 | see the | ||
| 4527 | .Sx PASS PHRASE ARGUMENTS | ||
| 4528 | section above. | ||
| 4529 | .It Fl pubkey | ||
| 4530 | Outputs the public key. | ||
| 4531 | .It Fl rand Ar file ... | ||
| 4532 | A file or files containing random data used to seed the random number generator, | ||
| 4533 | or an EGD socket (see | ||
| 4534 | .Xr RAND_egd 3 ) . | ||
| 4535 | Multiple files can be specified separated by a | ||
| 4536 | .Sq \&: . | ||
| 4537 | .It Fl set_serial Ar n | ||
| 4538 | Serial number to use when outputting a self-signed certificate. | ||
| 4539 | This may be specified as a decimal value or a hex value if preceded by | ||
| 4540 | .Sq 0x . | ||
| 4541 | It is possible to use negative serial numbers but this is not recommended. | ||
| 4542 | .It Fl subj Ar arg | ||
| 4543 | Sets subject name for new request or supersedes the subject name | ||
| 4544 | when processing a request. | ||
| 4545 | The arg must be formatted as | ||
| 4546 | .Em /type0=value0/type1=value1/type2=... ; | ||
| 4547 | characters may be escaped by | ||
| 4548 | .Sq \e | ||
| 4549 | .Pq backslash , | ||
| 4550 | no spaces are skipped. | ||
| 4551 | .It Fl subject | ||
| 4552 | Output the request's subject. | ||
| 4553 | .It Fl text | ||
| 4554 | Prints out the certificate request in text form. | ||
| 4555 | .It Fl utf8 | ||
| 4556 | This option causes field values to be interpreted as UTF8 strings; | ||
| 4557 | by default they are interpreted as ASCII. | ||
| 4558 | This means that the field values, whether prompted from a terminal or | ||
| 4559 | obtained from a configuration file, must be valid UTF8 strings. | ||
| 4560 | .It Fl verbose | ||
| 4561 | Print extra details about the operations being performed. | ||
| 4562 | .It Fl verify | ||
| 4563 | Verifies the signature on the request. | ||
| 4564 | .It Fl x509 | ||
| 4565 | This option outputs a self-signed certificate instead of a certificate | ||
| 4566 | request. | ||
| 4567 | This is typically used to generate a test certificate or | ||
| 4568 | a self-signed root CA. | ||
| 4569 | The extensions added to the certificate | ||
| 4570 | .Pq if any | ||
| 4571 | are specified in the configuration file. | ||
| 4572 | Unless specified using the | ||
| 4573 | .Fl set_serial | ||
| 4574 | option, 0 will be used for the serial number. | ||
| 4575 | .El | ||
| 4576 | .Sh REQ CONFIGURATION FILE FORMAT | ||
| 4577 | The configuration options are specified in the | ||
| 4578 | .Em req | ||
| 4579 | section of the configuration file. | ||
| 4580 | As with all configuration files, if no value is specified in the specific | ||
| 4581 | section (i.e.\& | ||
| 4582 | .Em req ) | ||
| 4583 | then the initial unnamed or | ||
| 4584 | .Em default | ||
| 4585 | section is searched too. | ||
| 4586 | .Pp | ||
| 4587 | The options available are described in detail below. | ||
| 4588 | .Bl -tag -width "XXXX" | ||
| 4589 | .It Ar attributes | ||
| 4590 | This specifies the section containing any request attributes: its format | ||
| 4591 | is the same as | ||
| 4592 | .Ar distinguished_name . | ||
| 4593 | Typically these may contain the | ||
| 4594 | .Em challengePassword | ||
| 4595 | or | ||
| 4596 | .Em unstructuredName | ||
| 4597 | types. | ||
| 4598 | They are currently ignored by | ||
| 4599 | .Nm OpenSSL Ns Li 's | ||
| 4600 | request signing utilities, but some CAs might want them. | ||
| 4601 | .It Ar default_bits | ||
| 4602 | This specifies the default key size in bits. | ||
| 4603 | If not specified, 512 is used. | ||
| 4604 | It is used if the | ||
| 4605 | .Fl new | ||
| 4606 | option is used. | ||
| 4607 | It can be overridden by using the | ||
| 4608 | .Fl newkey | ||
| 4609 | option. | ||
| 4610 | .It Ar default_keyfile | ||
| 4611 | This is the default file to write a private key to. | ||
| 4612 | If not specified, the key is written to standard output. | ||
| 4613 | This can be overridden by the | ||
| 4614 | .Fl keyout | ||
| 4615 | option. | ||
| 4616 | .It Ar default_md | ||
| 4617 | This option specifies the digest algorithm to use. | ||
| 4618 | Possible values include | ||
| 4619 | .Ar md5 | ||
| 4620 | and | ||
| 4621 | .Ar sha1 . | ||
| 4622 | If not present, MD5 is used. | ||
| 4623 | This option can be overridden on the command line. | ||
| 4624 | .It Ar distinguished_name | ||
| 4625 | This specifies the section containing the distinguished name fields to | ||
| 4626 | prompt for when generating a certificate or certificate request. | ||
| 4627 | The format is described in the next section. | ||
| 4628 | .It Ar encrypt_key | ||
| 4629 | If this is set to | ||
| 4630 | .Em no | ||
| 4631 | and a private key is generated, it is | ||
| 4632 | .Em not | ||
| 4633 | encrypted. | ||
| 4634 | This is equivalent to the | ||
| 4635 | .Fl nodes | ||
| 4636 | command line option. | ||
| 4637 | For compatibility, | ||
| 4638 | .Ar encrypt_rsa_key | ||
| 4639 | is an equivalent option. | ||
| 4640 | .It Ar input_password | output_password | ||
| 4641 | The passwords for the input private key file | ||
| 4642 | .Pq if present | ||
| 4643 | and the output private key file | ||
| 4644 | .Pq if one will be created . | ||
| 4645 | The command line options | ||
| 4646 | .Fl passin | ||
| 4647 | and | ||
| 4648 | .Fl passout | ||
| 4649 | override the configuration file values. | ||
| 4650 | .It Ar oid_file | ||
| 4651 | This specifies a file containing additional OBJECT IDENTIFIERS. | ||
| 4652 | Each line of the file should consist of the numerical form of the | ||
| 4653 | object identifier, followed by whitespace, then the short name followed | ||
| 4654 | by whitespace and finally the long name. | ||
| 4655 | .It Ar oid_section | ||
| 4656 | This specifies a section in the configuration file containing extra | ||
| 4657 | object identifiers. | ||
| 4658 | Each line should consist of the short name of the | ||
| 4659 | object identifier followed by | ||
| 4660 | .Sq = | ||
| 4661 | and the numerical form. | ||
| 4662 | The short and long names are the same when this option is used. | ||
| 4663 | .It Ar prompt | ||
| 4664 | If set to the value | ||
| 4665 | .Em no , | ||
| 4666 | this disables prompting of certificate fields | ||
| 4667 | and just takes values from the config file directly. | ||
| 4668 | It also changes the expected format of the | ||
| 4669 | .Em distinguished_name | ||
| 4670 | and | ||
| 4671 | .Em attributes | ||
| 4672 | sections. | ||
| 4673 | .It Ar RANDFILE | ||
| 4674 | This specifies a file in which random number seed information is | ||
| 4675 | placed and read from, or an EGD socket (see | ||
| 4676 | .Xr RAND_egd 3 ) . | ||
| 4677 | It is used for private key generation. | ||
| 4678 | .It Ar req_extensions | ||
| 4679 | This specifies the configuration file section containing a list of | ||
| 4680 | extensions to add to the certificate request. | ||
| 4681 | It can be overridden by the | ||
| 4682 | .Fl reqexts | ||
| 4683 | command line switch. | ||
| 4684 | .It Ar string_mask | ||
| 4685 | This option masks out the use of certain string types in certain | ||
| 4686 | fields. | ||
| 4687 | Most users will not need to change this option. | ||
| 4688 | .Pp | ||
| 4689 | It can be set to several values: | ||
| 4690 | .Ar default , | ||
| 4691 | which is also the default option, uses | ||
| 4692 | .Em PrintableStrings , T61Strings | ||
| 4693 | and | ||
| 4694 | .Em BMPStrings ; | ||
| 4695 | if the | ||
| 4696 | .Ar pkix | ||
| 4697 | value is used, then only | ||
| 4698 | .Em PrintableStrings | ||
| 4699 | and | ||
| 4700 | .Em BMPStrings | ||
| 4701 | will be used. | ||
| 4702 | This follows the PKIX recommendation in RFC 2459. | ||
| 4703 | If the | ||
| 4704 | .Fl utf8only | ||
| 4705 | option is used, then only | ||
| 4706 | .Em UTF8Strings | ||
| 4707 | will be used: this is the PKIX recommendation in RFC 2459 after 2003. | ||
| 4708 | Finally, the | ||
| 4709 | .Ar nombstr | ||
| 4710 | option just uses | ||
| 4711 | .Em PrintableStrings | ||
| 4712 | and | ||
| 4713 | .Em T61Strings : | ||
| 4714 | certain software has problems with | ||
| 4715 | .Em BMPStrings | ||
| 4716 | and | ||
| 4717 | .Em UTF8Strings : | ||
| 4718 | in particular Netscape. | ||
| 4719 | .It Ar utf8 | ||
| 4720 | If set to the value | ||
| 4721 | .Em yes , | ||
| 4722 | then field values are interpreted as UTF8 strings; | ||
| 4723 | by default they are interpreted as ASCII. | ||
| 4724 | This means that the field values, whether prompted from a terminal or | ||
| 4725 | obtained from a configuration file, must be valid UTF8 strings. | ||
| 4726 | .It Ar x509_extensions | ||
| 4727 | This specifies the configuration file section containing a list of | ||
| 4728 | extensions to add to a certificate generated when the | ||
| 4729 | .Fl x509 | ||
| 4730 | switch is used. | ||
| 4731 | It can be overridden by the | ||
| 4732 | .Fl extensions | ||
| 4733 | command line switch. | ||
| 4734 | .El | ||
| 4735 | .Sh REQ DISTINGUISHED NAME AND ATTRIBUTE SECTION FORMAT | ||
| 4736 | There are two separate formats for the distinguished name and attribute | ||
| 4737 | sections. | ||
| 4738 | If the | ||
| 4739 | .Fl prompt | ||
| 4740 | option is set to | ||
| 4741 | .Em no , | ||
| 4742 | then these sections just consist of field names and values: for example, | ||
| 4743 | .Bd -unfilled -offset indent | ||
| 4744 | CN=My Name | ||
| 4745 | OU=My Organization | ||
| 4746 | emailAddress=someone@somewhere.org | ||
| 4747 | .Ed | ||
| 4748 | .Pp | ||
| 4749 | This allows external programs | ||
| 4750 | .Pq e.g. GUI based | ||
| 4751 | to generate a template file with all the field names and values | ||
| 4752 | and just pass it to | ||
| 4753 | .Nm req . | ||
| 4754 | An example of this kind of configuration file is contained in the | ||
| 4755 | .Sx REQ EXAMPLES | ||
| 4756 | section. | ||
| 4757 | .Pp | ||
| 4758 | Alternatively if the | ||
| 4759 | .Fl prompt | ||
| 4760 | option is absent or not set to | ||
| 4761 | .Em no , | ||
| 4762 | then the file contains field prompting information. | ||
| 4763 | It consists of lines of the form: | ||
| 4764 | .Bd -unfilled -offset indent | ||
| 4765 | fieldName="prompt" | ||
| 4766 | fieldName_default="default field value" | ||
| 4767 | fieldName_min= 2 | ||
| 4768 | fieldName_max= 4 | ||
| 4769 | .Ed | ||
| 4770 | .Pp | ||
| 4771 | .Qq fieldName | ||
| 4772 | is the field name being used, for example | ||
| 4773 | .Em commonName | ||
| 4774 | .Pq or CN . | ||
| 4775 | The | ||
| 4776 | .Qq prompt | ||
| 4777 | string is used to ask the user to enter the relevant details. | ||
| 4778 | If the user enters nothing, the default value is used; | ||
| 4779 | if no default value is present, the field is omitted. | ||
| 4780 | A field can still be omitted if a default value is present, | ||
| 4781 | if the user just enters the | ||
| 4782 | .Sq \&. | ||
| 4783 | character. | ||
| 4784 | .Pp | ||
| 4785 | The number of characters entered must be between the | ||
| 4786 | .Em fieldName_min | ||
| 4787 | and | ||
| 4788 | .Em fieldName_max | ||
| 4789 | limits: | ||
| 4790 | there may be additional restrictions based on the field being used | ||
| 4791 | (for example | ||
| 4792 | .Em countryName | ||
| 4793 | can only ever be two characters long and must fit in a | ||
| 4794 | .Em PrintableString ) . | ||
| 4795 | .Pp | ||
| 4796 | Some fields (such as | ||
| 4797 | .Em organizationName ) | ||
| 4798 | can be used more than once in a DN. | ||
| 4799 | This presents a problem because configuration files will | ||
| 4800 | not recognize the same name occurring twice. | ||
| 4801 | To avoid this problem, if the | ||
| 4802 | .Em fieldName | ||
| 4803 | contains some characters followed by a full stop, they will be ignored. | ||
| 4804 | So, for example, a second | ||
| 4805 | .Em organizationName | ||
| 4806 | can be input by calling it | ||
| 4807 | .Qq 1.organizationName . | ||
| 4808 | .Pp | ||
| 4809 | The actual permitted field names are any object identifier short or | ||
| 4810 | long names. | ||
| 4811 | These are compiled into | ||
| 4812 | .Nm OpenSSL | ||
| 4813 | and include the usual values such as | ||
| 4814 | .Em commonName , countryName , localityName , organizationName , | ||
| 4815 | .Em organizationUnitName , stateOrProvinceName . | ||
| 4816 | Additionally, | ||
| 4817 | .Em emailAddress | ||
| 4818 | is included as well as | ||
| 4819 | .Em name , surname , givenName initials | ||
| 4820 | and | ||
| 4821 | .Em dnQualifier . | ||
| 4822 | .Pp | ||
| 4823 | Additional object identifiers can be defined with the | ||
| 4824 | .Ar oid_file | ||
| 4825 | or | ||
| 4826 | .Ar oid_section | ||
| 4827 | options in the configuration file. | ||
| 4828 | Any additional fields will be treated as though they were a | ||
| 4829 | .Em DirectoryString . | ||
| 4830 | .Sh REQ EXAMPLES | ||
| 4831 | Examine and verify a certificate request: | ||
| 4832 | .Pp | ||
| 4833 | .Dl $ openssl req -in req.pem -text -verify -noout | ||
| 4834 | .Pp | ||
| 4835 | Create a private key and then generate a certificate request from it: | ||
| 4836 | .Bd -literal -offset indent | ||
| 4837 | $ openssl genrsa -out key.pem 1024 | ||
| 4838 | $ openssl req -new -key key.pem -out req.pem | ||
| 4839 | .Ed | ||
| 4840 | .Pp | ||
| 4841 | The same but just using req: | ||
| 4842 | .Pp | ||
| 4843 | .Dl $ openssl req -newkey rsa:1024 -keyout key.pem -out req.pem | ||
| 4844 | .Pp | ||
| 4845 | Generate a self-signed root certificate: | ||
| 4846 | .Pp | ||
| 4847 | .Dl "$ openssl req -x509 -newkey rsa:1024 -keyout key.pem -out req.pem" | ||
| 4848 | .Pp | ||
| 4849 | Example of a file pointed to by the | ||
| 4850 | .Ar oid_file | ||
| 4851 | option: | ||
| 4852 | .Bd -unfilled -offset indent | ||
| 4853 | 1.2.3.4 shortName A longer Name | ||
| 4854 | 1.2.3.6 otherName Other longer Name | ||
| 4855 | .Ed | ||
| 4856 | .Pp | ||
| 4857 | Example of a section pointed to by | ||
| 4858 | .Ar oid_section | ||
| 4859 | making use of variable expansion: | ||
| 4860 | .Bd -unfilled -offset indent | ||
| 4861 | testoid1=1.2.3.5 | ||
| 4862 | testoid2=${testoid1}.6 | ||
| 4863 | .Ed | ||
| 4864 | .Pp | ||
| 4865 | Sample configuration file prompting for field values: | ||
| 4866 | .Bd -literal | ||
| 4867 | \& [ req ] | ||
| 4868 | \& default_bits = 1024 | ||
| 4869 | \& default_keyfile = privkey.pem | ||
| 4870 | \& distinguished_name = req_distinguished_name | ||
| 4871 | \& attributes = req_attributes | ||
| 4872 | \& x509_extensions = v3_ca | ||
| 4873 | |||
| 4874 | \& dirstring_type = nobmp | ||
| 4875 | |||
| 4876 | \& [ req_distinguished_name ] | ||
| 4877 | \& countryName = Country Name (2 letter code) | ||
| 4878 | \& countryName_default = AU | ||
| 4879 | \& countryName_min = 2 | ||
| 4880 | \& countryName_max = 2 | ||
| 4881 | |||
| 4882 | \& localityName = Locality Name (eg, city) | ||
| 4883 | |||
| 4884 | \& organizationalUnitName = Organizational Unit Name (eg, section) | ||
| 4885 | |||
| 4886 | \& commonName = Common Name (eg, YOUR name) | ||
| 4887 | \& commonName_max = 64 | ||
| 4888 | |||
| 4889 | \& emailAddress = Email Address | ||
| 4890 | \& emailAddress_max = 40 | ||
| 4891 | |||
| 4892 | \& [ req_attributes ] | ||
| 4893 | \& challengePassword = A challenge password | ||
| 4894 | \& challengePassword_min = 4 | ||
| 4895 | \& challengePassword_max = 20 | ||
| 4896 | |||
| 4897 | \& [ v3_ca ] | ||
| 4898 | |||
| 4899 | \& subjectKeyIdentifier=hash | ||
| 4900 | \& authorityKeyIdentifier=keyid:always,issuer:always | ||
| 4901 | \& basicConstraints = CA:true | ||
| 4902 | .Ed | ||
| 4903 | .Pp | ||
| 4904 | Sample configuration containing all field values: | ||
| 4905 | .Bd -literal | ||
| 4906 | \& RANDFILE = $ENV::HOME/.rnd | ||
| 4907 | |||
| 4908 | \& [ req ] | ||
| 4909 | \& default_bits = 1024 | ||
| 4910 | \& default_keyfile = keyfile.pem | ||
| 4911 | \& distinguished_name = req_distinguished_name | ||
| 4912 | \& attributes = req_attributes | ||
| 4913 | \& prompt = no | ||
| 4914 | \& output_password = mypass | ||
| 4915 | |||
| 4916 | \& [ req_distinguished_name ] | ||
| 4917 | \& C = GB | ||
| 4918 | \& ST = Test State or Province | ||
| 4919 | \& L = Test Locality | ||
| 4920 | \& O = Organization Name | ||
| 4921 | \& OU = Organizational Unit Name | ||
| 4922 | \& CN = Common Name | ||
| 4923 | \& emailAddress = test@email.address | ||
| 4924 | |||
| 4925 | \& [ req_attributes ] | ||
| 4926 | \& challengePassword = A challenge password | ||
| 4927 | .Ed | ||
| 4928 | .Sh REQ NOTES | ||
| 4929 | The header and footer lines in the PEM format are normally: | ||
| 4930 | .Bd -unfilled -offset indent | ||
| 4931 | -----BEGIN CERTIFICATE REQUEST----- | ||
| 4932 | -----END CERTIFICATE REQUEST----- | ||
| 4933 | .Ed | ||
| 4934 | .Pp | ||
| 4935 | Some software | ||
| 4936 | .Pq some versions of Netscape certificate server | ||
| 4937 | instead needs: | ||
| 4938 | .Bd -unfilled -offset indent | ||
| 4939 | -----BEGIN NEW CERTIFICATE REQUEST----- | ||
| 4940 | -----END NEW CERTIFICATE REQUEST----- | ||
| 4941 | .Ed | ||
| 4942 | .Pp | ||
| 4943 | which is produced with the | ||
| 4944 | .Fl newhdr | ||
| 4945 | option but is otherwise compatible. | ||
| 4946 | Either form is accepted transparently on input. | ||
| 4947 | .Pp | ||
| 4948 | The certificate requests generated by Xenroll with MSIE have extensions added. | ||
| 4949 | It includes the | ||
| 4950 | .Em keyUsage | ||
| 4951 | extension which determines the type of key | ||
| 4952 | .Pq signature only or general purpose | ||
| 4953 | and any additional OIDs entered by the script in an | ||
| 4954 | .Em extendedKeyUsage | ||
| 4955 | extension. | ||
| 4956 | .Sh REQ DIAGNOSTICS | ||
| 4957 | The following messages are frequently asked about: | ||
| 4958 | .Bd -unfilled -offset indent | ||
| 4959 | Using configuration from /some/path/openssl.cnf | ||
| 4960 | Unable to load config info | ||
| 4961 | .Ed | ||
| 4962 | .Pp | ||
| 4963 | This is followed some time later by... | ||
| 4964 | .Bd -unfilled -offset indent | ||
| 4965 | unable to find 'distinguished_name' in config | ||
| 4966 | problems making Certificate Request | ||
| 4967 | .Ed | ||
| 4968 | .Pp | ||
| 4969 | The first error message is the clue: it can't find the configuration | ||
| 4970 | file! | ||
| 4971 | Certain operations | ||
| 4972 | .Pq like examining a certificate request | ||
| 4973 | don't need a configuration file so its use isn't enforced. | ||
| 4974 | Generation of certificates or requests, however, do need a configuration file. | ||
| 4975 | This could be regarded as a bug. | ||
| 4976 | .Pp | ||
| 4977 | Another puzzling message is this: | ||
| 4978 | .Bd -unfilled -offset indent | ||
| 4979 | Attributes: | ||
| 4980 | a0:00 | ||
| 4981 | .Ed | ||
| 4982 | .Pp | ||
| 4983 | This is displayed when no attributes are present and the request includes | ||
| 4984 | the correct empty SET OF structure | ||
| 4985 | .Pq the DER encoding of which is 0xa0 0x00 . | ||
| 4986 | If you just see: | ||
| 4987 | .Pp | ||
| 4988 | .D1 Attributes: | ||
| 4989 | .Pp | ||
| 4990 | then the SET OF is missing and the encoding is technically invalid | ||
| 4991 | .Pq but it is tolerated . | ||
| 4992 | See the description of the command line option | ||
| 4993 | .Fl asn1-kludge | ||
| 4994 | for more information. | ||
| 4995 | .Sh REQ ENVIRONMENT VARIABLES | ||
| 4996 | The variable | ||
| 4997 | .Ev OPENSSL_CONF , | ||
| 4998 | if defined, allows an alternative configuration | ||
| 4999 | file location to be specified; it will be overridden by the | ||
| 5000 | .Fl config | ||
| 5001 | command line switch if it is present. | ||
| 5002 | For compatibility reasons the | ||
| 5003 | .Ev SSLEAY_CONF | ||
| 5004 | environment variable serves the same purpose but its use is discouraged. | ||
| 5005 | .Sh REQ BUGS | ||
| 5006 | .Nm OpenSSL Ns Li 's | ||
| 5007 | handling of T61Strings | ||
| 5008 | .Pq aka TeletexStrings | ||
| 5009 | is broken: it effectively treats them as ISO 8859-1 | ||
| 5010 | .Pq Latin 1 ; | ||
| 5011 | Netscape and MSIE have similar behaviour. | ||
| 5012 | This can cause problems if you need characters that aren't available in | ||
| 5013 | .Em PrintableStrings | ||
| 5014 | and you don't want to or can't use | ||
| 5015 | .Em BMPStrings . | ||
| 5016 | .Pp | ||
| 5017 | As a consequence of the T61String handling, the only correct way to represent | ||
| 5018 | accented characters in | ||
| 5019 | .Nm OpenSSL | ||
| 5020 | is to use a | ||
| 5021 | .Em BMPString : | ||
| 5022 | unfortunately Netscape currently chokes on these. | ||
| 5023 | If you have to use accented characters with Netscape | ||
| 5024 | and MSIE then you currently need to use the invalid T61String form. | ||
| 5025 | .Pp | ||
| 5026 | The current prompting is not very friendly. | ||
| 5027 | It doesn't allow you to confirm what you've just entered. | ||
| 5028 | Other things, like extensions in certificate requests, are | ||
| 5029 | statically defined in the configuration file. | ||
| 5030 | Some of these, like an email address in | ||
| 5031 | .Em subjectAltName , | ||
| 5032 | should be input by the user. | ||
| 5033 | .\" | ||
| 5034 | .\" RSA | ||
| 5035 | .\" | ||
| 5036 | .Sh RSA | ||
| 5037 | .Cm openssl rsa | ||
| 5038 | .Bk -words | ||
| 5039 | .Oo | ||
| 5040 | .Fl aes128 | aes192 | aes256 | | ||
| 5041 | .Fl des | des3 | ||
| 5042 | .Oc | ||
| 5043 | .Op Fl check | ||
| 5044 | .Op Fl modulus | ||
| 5045 | .Op Fl noout | ||
| 5046 | .Op Fl pubin | ||
| 5047 | .Op Fl pubout | ||
| 5048 | .Op Fl sgckey | ||
| 5049 | .Op Fl text | ||
| 5050 | .Op Fl engine Ar id | ||
| 5051 | .Op Fl in Ar file | ||
| 5052 | .Op Fl inform Ar DER | NET | PEM | ||
| 5053 | .Op Fl out Ar file | ||
| 5054 | .Op Fl outform Ar DER | NET | PEM | ||
| 5055 | .Op Fl passin Ar arg | ||
| 5056 | .Op Fl passout Ar arg | ||
| 5057 | .Ek | ||
| 5058 | .Pp | ||
| 5059 | The | ||
| 5060 | .Nm rsa | ||
| 5061 | command processes RSA keys. | ||
| 5062 | They can be converted between various forms and their components printed out. | ||
| 5063 | .Pp | ||
| 5064 | .Sy Note : | ||
| 5065 | this command uses the traditional | ||
| 5066 | .Nm SSLeay | ||
| 5067 | compatible format for private key encryption: | ||
| 5068 | newer applications should use the more secure PKCS#8 format using the | ||
| 5069 | .Nm pkcs8 | ||
| 5070 | utility. | ||
| 5071 | .Pp | ||
| 5072 | The options are as follows: | ||
| 5073 | .Bl -tag -width "XXXX" | ||
| 5074 | .It Xo | ||
| 5075 | .Fl aes128 | aes192 | aes256 | | ||
| 5076 | .Fl des | des3 | ||
| 5077 | .Xc | ||
| 5078 | These options encrypt the private key with the AES, DES, | ||
| 5079 | or the triple DES ciphers, respectively, before outputting it. | ||
| 5080 | A pass phrase is prompted for. | ||
| 5081 | If none of these options is specified the key is written in plain text. | ||
| 5082 | This means that using the | ||
| 5083 | .Nm rsa | ||
| 5084 | utility to read in an encrypted key with no encryption option can be used | ||
| 5085 | to remove the pass phrase from a key, or by setting the encryption options | ||
| 5086 | it can be used to add or change the pass phrase. | ||
| 5087 | These options can only be used with PEM format output files. | ||
| 5088 | .It Fl check | ||
| 5089 | This option checks the consistency of an RSA private key. | ||
| 5090 | .It Fl engine Ar id | ||
| 5091 | Specifying an engine (by it's unique | ||
| 5092 | .Ar id | ||
| 5093 | string) will cause | ||
| 5094 | .Nm rsa | ||
| 5095 | to attempt to obtain a functional reference to the specified engine, | ||
| 5096 | thus initialising it if needed. | ||
| 5097 | The engine will then be set as the default for all available algorithms. | ||
| 5098 | .It Fl in Ar file | ||
| 5099 | This specifies the input | ||
| 5100 | .Ar file | ||
| 5101 | to read a key from, or standard input if this | ||
| 5102 | option is not specified. | ||
| 5103 | If the key is encrypted, a pass phrase will be prompted for. | ||
| 5104 | .It Fl inform Ar DER | NET | PEM | ||
| 5105 | This specifies the input format. | ||
| 5106 | The | ||
| 5107 | .Ar DER | ||
| 5108 | argument | ||
| 5109 | uses an ASN1 DER-encoded form compatible with the PKCS#1 | ||
| 5110 | RSAPrivateKey or SubjectPublicKeyInfo format. | ||
| 5111 | The | ||
| 5112 | .Ar PEM | ||
| 5113 | form is the default format: it consists of the DER format base64-encoded with | ||
| 5114 | additional header and footer lines. | ||
| 5115 | On input PKCS#8 format private keys are also accepted. | ||
| 5116 | The | ||
| 5117 | .Ar NET | ||
| 5118 | form is a format described in the | ||
| 5119 | .Sx RSA NOTES | ||
| 5120 | section. | ||
| 5121 | .It Fl noout | ||
| 5122 | This option prevents output of the encoded version of the key. | ||
| 5123 | .It Fl modulus | ||
| 5124 | This option prints out the value of the modulus of the key. | ||
| 5125 | .It Fl out Ar file | ||
| 5126 | This specifies the output | ||
| 5127 | .Ar file | ||
| 5128 | to write a key to, or standard output if this option is not specified. | ||
| 5129 | If any encryption options are set, a pass phrase will be prompted for. | ||
| 5130 | The output filename should | ||
| 5131 | .Em not | ||
| 5132 | be the same as the input filename. | ||
| 5133 | .It Fl outform Ar DER | NET | PEM | ||
| 5134 | This specifies the output format; the options have the same meaning as the | ||
| 5135 | .Fl inform | ||
| 5136 | option. | ||
| 5137 | .It Fl passin Ar arg | ||
| 5138 | The input file password source. | ||
| 5139 | For more information about the format of | ||
| 5140 | .Ar arg , | ||
| 5141 | see the | ||
| 5142 | .Sx PASS PHRASE ARGUMENTS | ||
| 5143 | section above. | ||
| 5144 | .It Fl passout Ar arg | ||
| 5145 | The output file password source. | ||
| 5146 | For more information about the format of | ||
| 5147 | .Ar arg , | ||
| 5148 | see the | ||
| 5149 | .Sx PASS PHRASE ARGUMENTS | ||
| 5150 | section above. | ||
| 5151 | .It Fl pubin | ||
| 5152 | By default, a private key is read from the input file; with this | ||
| 5153 | option a public key is read instead. | ||
| 5154 | .It Fl pubout | ||
| 5155 | By default, a private key is output; | ||
| 5156 | with this option a public key will be output instead. | ||
| 5157 | This option is automatically set if the input is a public key. | ||
| 5158 | .It Fl sgckey | ||
| 5159 | Use the modified | ||
| 5160 | .Em NET | ||
| 5161 | algorithm used with some versions of Microsoft IIS and SGC keys. | ||
| 5162 | .It Fl text | ||
| 5163 | Prints out the various public or private key components in | ||
| 5164 | plain text, in addition to the encoded version. | ||
| 5165 | .El | ||
| 5166 | .Sh RSA NOTES | ||
| 5167 | The PEM private key format uses the header and footer lines: | ||
| 5168 | .Bd -unfilled -offset indent | ||
| 5169 | -----BEGIN RSA PRIVATE KEY----- | ||
| 5170 | -----END RSA PRIVATE KEY----- | ||
| 5171 | .Ed | ||
| 5172 | .Pp | ||
| 5173 | The PEM public key format uses the header and footer lines: | ||
| 5174 | .Bd -unfilled -offset indent | ||
| 5175 | -----BEGIN PUBLIC KEY----- | ||
| 5176 | -----END PUBLIC KEY----- | ||
| 5177 | .Ed | ||
| 5178 | .Pp | ||
| 5179 | The | ||
| 5180 | .Em NET | ||
| 5181 | form is a format compatible with older Netscape servers | ||
| 5182 | and Microsoft IIS .key files; this uses unsalted RC4 for its encryption. | ||
| 5183 | It is not very secure and so should only be used when necessary. | ||
| 5184 | .Pp | ||
| 5185 | Some newer version of IIS have additional data in the exported .key files. | ||
| 5186 | To use these with the | ||
| 5187 | .Nm rsa | ||
| 5188 | utility, view the file with a binary editor | ||
| 5189 | and look for the string | ||
| 5190 | .Qq private-key , | ||
| 5191 | then trace back to the byte sequence 0x30, 0x82 | ||
| 5192 | .Pq this is an ASN1 SEQUENCE . | ||
| 5193 | Copy all the data from this point onwards to another file and use that as | ||
| 5194 | the input to the | ||
| 5195 | .Nm rsa | ||
| 5196 | utility with the | ||
| 5197 | .Fl inform Ar NET | ||
| 5198 | option. | ||
| 5199 | If there is an error after entering the password, try the | ||
| 5200 | .Fl sgckey | ||
| 5201 | option. | ||
| 5202 | .Sh RSA EXAMPLES | ||
| 5203 | To remove the pass phrase on an RSA private key: | ||
| 5204 | .Pp | ||
| 5205 | .Dl $ openssl rsa -in key.pem -out keyout.pem | ||
| 5206 | .Pp | ||
| 5207 | To encrypt a private key using triple DES: | ||
| 5208 | .Pp | ||
| 5209 | .Dl $ openssl rsa -in key.pem -des3 -out keyout.pem | ||
| 5210 | .Pp | ||
| 5211 | To convert a private key from PEM to DER format: | ||
| 5212 | .Pp | ||
| 5213 | .Dl $ openssl rsa -in key.pem -outform DER -out keyout.der | ||
| 5214 | .Pp | ||
| 5215 | To print out the components of a private key to standard output: | ||
| 5216 | .Pp | ||
| 5217 | .Dl $ openssl rsa -in key.pem -text -noout | ||
| 5218 | .Pp | ||
| 5219 | To just output the public part of a private key: | ||
| 5220 | .Pp | ||
| 5221 | .Dl $ openssl rsa -in key.pem -pubout -out pubkey.pem | ||
| 5222 | .Sh RSA BUGS | ||
| 5223 | The command line password arguments don't currently work with | ||
| 5224 | .Em NET | ||
| 5225 | format. | ||
| 5226 | .Pp | ||
| 5227 | There should be an option that automatically handles .key files, | ||
| 5228 | without having to manually edit them. | ||
| 5229 | .\" | ||
| 5230 | .\" RSAUTL | ||
| 5231 | .\" | ||
| 5232 | .Sh RSAUTL | ||
| 5233 | .Nm openssl rsautl | ||
| 5234 | .Bk -words | ||
| 5235 | .Op Fl asn1parse | ||
| 5236 | .Op Fl certin | ||
| 5237 | .Op Fl decrypt | ||
| 5238 | .Op Fl encrypt | ||
| 5239 | .Op Fl hexdump | ||
| 5240 | .Op Fl oaep | pkcs | raw | ssl | ||
| 5241 | .Op Fl pubin | ||
| 5242 | .Op Fl sign | ||
| 5243 | .Op Fl verify | ||
| 5244 | .Op Fl engine Ar id | ||
| 5245 | .Op Fl in Ar file | ||
| 5246 | .Op Fl inkey Ar file | ||
| 5247 | .Op Fl keyform Ar DER | PEM | ||
| 5248 | .Op Fl out Ar file | ||
| 5249 | .Ek | ||
| 5250 | .Pp | ||
| 5251 | The | ||
| 5252 | .Nm rsautl | ||
| 5253 | command can be used to sign, verify, encrypt and decrypt | ||
| 5254 | data using the RSA algorithm. | ||
| 5255 | .Pp | ||
| 5256 | The options are as follows: | ||
| 5257 | .Bl -tag -width "XXXX" | ||
| 5258 | .It Fl asn1parse | ||
| 5259 | Asn1parse the output data; this is useful when combined with the | ||
| 5260 | .Fl verify | ||
| 5261 | option. | ||
| 5262 | .It Fl certin | ||
| 5263 | The input is a certificate containing an RSA public key. | ||
| 5264 | .It Fl decrypt | ||
| 5265 | Decrypt the input data using an RSA private key. | ||
| 5266 | .It Fl encrypt | ||
| 5267 | Encrypt the input data using an RSA public key. | ||
| 5268 | .It Fl engine Ar id | ||
| 5269 | Specifying an engine (by it's unique | ||
| 5270 | .Ar id | ||
| 5271 | string) will cause | ||
| 5272 | .Nm rsautl | ||
| 5273 | to attempt to obtain a functional reference to the specified engine, | ||
| 5274 | thus initialising it if needed. | ||
| 5275 | The engine will then be set as the default for all available algorithms. | ||
| 5276 | .It Fl hexdump | ||
| 5277 | Hex dump the output data. | ||
| 5278 | .It Fl in Ar file | ||
| 5279 | This specifies the input | ||
| 5280 | .Ar file | ||
| 5281 | to read data from, or standard input | ||
| 5282 | if this option is not specified. | ||
| 5283 | .It Fl inkey Ar file | ||
| 5284 | The input key file, by default it should be an RSA private key. | ||
| 5285 | .It Fl keyform Ar DER | PEM | ||
| 5286 | Private ket format. | ||
| 5287 | Default is | ||
| 5288 | .Ar PEM . | ||
| 5289 | .It Fl oaep | pkcs | raw | ssl | ||
| 5290 | The padding to use: | ||
| 5291 | PKCS#1 OAEP, PKCS#1 v1.5 | ||
| 5292 | .Pq the default , | ||
| 5293 | no padding, | ||
| 5294 | or special padding used in SSL v2 backwards compatible handshakes, respectively. | ||
| 5295 | For signatures, only | ||
| 5296 | .Fl pkcs | ||
| 5297 | and | ||
| 5298 | .Fl raw | ||
| 5299 | can be used. | ||
| 5300 | .It Fl out Ar file | ||
| 5301 | Specifies the output | ||
| 5302 | .Ar file | ||
| 5303 | to write to, or standard output by | ||
| 5304 | default. | ||
| 5305 | .It Fl pubin | ||
| 5306 | The input file is an RSA public key. | ||
| 5307 | .It Fl sign | ||
| 5308 | Sign the input data and output the signed result. | ||
| 5309 | This requires an RSA private key. | ||
| 5310 | .It Fl verify | ||
| 5311 | Verify the input data and output the recovered data. | ||
| 5312 | .El | ||
| 5313 | .Sh RSAUTL NOTES | ||
| 5314 | .Nm rsautl , | ||
| 5315 | because it uses the RSA algorithm directly, can only be | ||
| 5316 | used to sign or verify small pieces of data. | ||
| 5317 | .Sh RSAUTL EXAMPLES | ||
| 5318 | Sign some data using a private key: | ||
| 5319 | .Pp | ||
| 5320 | .Dl "$ openssl rsautl -sign -in file -inkey key.pem -out sig" | ||
| 5321 | .Pp | ||
| 5322 | Recover the signed data: | ||
| 5323 | .Pp | ||
| 5324 | .Dl $ openssl rsautl -verify -in sig -inkey key.pem | ||
| 5325 | .Pp | ||
| 5326 | Examine the raw signed data: | ||
| 5327 | .Pp | ||
| 5328 | .Li "\ \&$ openssl rsautl -verify -in file -inkey key.pem -raw -hexdump" | ||
| 5329 | .Bd -unfilled | ||
| 5330 | \& 0000 - 00 01 ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ | ||
| 5331 | \& 0010 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ | ||
| 5332 | \& 0020 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ | ||
| 5333 | \& 0030 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ | ||
| 5334 | \& 0040 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ | ||
| 5335 | \& 0050 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ | ||
| 5336 | \& 0060 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ | ||
| 5337 | \& 0070 - ff ff ff ff 00 68 65 6c-6c 6f 20 77 6f 72 6c 64 .....hello world | ||
| 5338 | .Ed | ||
| 5339 | .Pp | ||
| 5340 | The PKCS#1 block formatting is evident from this. | ||
| 5341 | If this was done using encrypt and decrypt, the block would have been of type 2 | ||
| 5342 | .Pq the second byte | ||
| 5343 | and random padding data visible instead of the 0xff bytes. | ||
| 5344 | .Pp | ||
| 5345 | It is possible to analyse the signature of certificates using this | ||
| 5346 | utility in conjunction with | ||
| 5347 | .Nm asn1parse . | ||
| 5348 | Consider the self-signed example in | ||
| 5349 | .Pa certs/pca-cert.pem : | ||
| 5350 | running | ||
| 5351 | .Nm asn1parse | ||
| 5352 | as follows yields: | ||
| 5353 | .Pp | ||
| 5354 | .Li "\ \&$ openssl asn1parse -in pca-cert.pem" | ||
| 5355 | .Bd -unfilled | ||
| 5356 | \& 0:d=0 hl=4 l= 742 cons: SEQUENCE | ||
| 5357 | \& 4:d=1 hl=4 l= 591 cons: SEQUENCE | ||
| 5358 | \& 8:d=2 hl=2 l= 3 cons: cont [ 0 ] | ||
| 5359 | \& 10:d=3 hl=2 l= 1 prim: INTEGER :02 | ||
| 5360 | \& 13:d=2 hl=2 l= 1 prim: INTEGER :00 | ||
| 5361 | \& 16:d=2 hl=2 l= 13 cons: SEQUENCE | ||
| 5362 | \& 18:d=3 hl=2 l= 9 prim: OBJECT :md5WithRSAEncryption | ||
| 5363 | \& 29:d=3 hl=2 l= 0 prim: NULL | ||
| 5364 | \& 31:d=2 hl=2 l= 92 cons: SEQUENCE | ||
| 5365 | \& 33:d=3 hl=2 l= 11 cons: SET | ||
| 5366 | \& 35:d=4 hl=2 l= 9 cons: SEQUENCE | ||
| 5367 | \& 37:d=5 hl=2 l= 3 prim: OBJECT :countryName | ||
| 5368 | \& 42:d=5 hl=2 l= 2 prim: PRINTABLESTRING :AU | ||
| 5369 | \& .... | ||
| 5370 | \& 599:d=1 hl=2 l= 13 cons: SEQUENCE | ||
| 5371 | \& 601:d=2 hl=2 l= 9 prim: OBJECT :md5WithRSAEncryption | ||
| 5372 | \& 612:d=2 hl=2 l= 0 prim: NULL | ||
| 5373 | \& 614:d=1 hl=3 l= 129 prim: BIT STRING | ||
| 5374 | .Ed | ||
| 5375 | .Pp | ||
| 5376 | The final BIT STRING contains the actual signature. | ||
| 5377 | It can be extracted with: | ||
| 5378 | .Pp | ||
| 5379 | .Dl "$ openssl asn1parse -in pca-cert.pem -out sig -noout -strparse 614" | ||
| 5380 | .Pp | ||
| 5381 | The certificate public key can be extracted with: | ||
| 5382 | .Pp | ||
| 5383 | .Dl $ openssl x509 -in test/testx509.pem -pubkey -noout \*(Gtpubkey.pem | ||
| 5384 | .Pp | ||
| 5385 | The signature can be analysed with: | ||
| 5386 | .Pp | ||
| 5387 | .Li "\ \&$ openssl rsautl -in sig -verify -asn1parse -inkey pubkey.pem -pubin" | ||
| 5388 | .Bd -unfilled | ||
| 5389 | \& 0:d=0 hl=2 l= 32 cons: SEQUENCE | ||
| 5390 | \& 2:d=1 hl=2 l= 12 cons: SEQUENCE | ||
| 5391 | \& 4:d=2 hl=2 l= 8 prim: OBJECT :md5 | ||
| 5392 | \& 14:d=2 hl=2 l= 0 prim: NULL | ||
| 5393 | \& 16:d=1 hl=2 l= 16 prim: OCTET STRING | ||
| 5394 | \& 0000 - f3 46 9e aa 1a 4a 73 c9-37 ea 93 00 48 25 08 b5 .F...Js.7...H%.. | ||
| 5395 | .Ed | ||
| 5396 | .Pp | ||
| 5397 | This is the parsed version of an ASN1 | ||
| 5398 | .Em DigestInfo | ||
| 5399 | structure. | ||
| 5400 | It can be seen that the digest used was MD5. | ||
| 5401 | The actual part of the certificate that was signed can be extracted with: | ||
| 5402 | .Pp | ||
| 5403 | .Dl "$ openssl asn1parse -in pca-cert.pem -out tbs -noout -strparse 4" | ||
| 5404 | .Pp | ||
| 5405 | and its digest computed with: | ||
| 5406 | .Pp | ||
| 5407 | .Dl $ openssl md5 -c tbs | ||
| 5408 | .D1 MD5(tbs)= f3:46:9e:aa:1a:4a:73:c9:37:ea:93:00:48:25:08:b5 | ||
| 5409 | .Pp | ||
| 5410 | which it can be seen agrees with the recovered value above. | ||
| 5411 | .\" | ||
| 5412 | .\" S_CLIENT | ||
| 5413 | .\" | ||
| 5414 | .Sh S_CLIENT | ||
| 5415 | .Nm openssl s_client | ||
| 5416 | .Bk -words | ||
| 5417 | .Op Fl 4 | 6 | ||
| 5418 | .Op Fl bugs | ||
| 5419 | .Op Fl crlf | ||
| 5420 | .Op Fl debug | ||
| 5421 | .Op Fl ign_eof | ||
| 5422 | .Op Fl msg | ||
| 5423 | .Op Fl nbio | ||
| 5424 | .Op Fl nbio_test | ||
| 5425 | .Op Fl no_ssl2 | ||
| 5426 | .Op Fl no_ssl3 | ||
| 5427 | .Op Fl no_tls1 | ||
| 5428 | .Op Fl pause | ||
| 5429 | .Op Fl prexit | ||
| 5430 | .Op Fl quiet | ||
| 5431 | .Op Fl reconnect | ||
| 5432 | .Op Fl serverpref | ||
| 5433 | .Op Fl showcerts | ||
| 5434 | .Op Fl ssl2 | ||
| 5435 | .Op Fl ssl3 | ||
| 5436 | .Op Fl state | ||
| 5437 | .Op Fl tls1 | ||
| 5438 | .Op Fl CAfile Ar file | ||
| 5439 | .Op Fl CApath Ar directory | ||
| 5440 | .Op Fl cert Ar file | ||
| 5441 | .Op Fl cipher Ar cipherlist | ||
| 5442 | .Oo | ||
| 5443 | .Fl connect Ar host : Ns Ar port | | ||
| 5444 | .Ar host Ns / Ns Ar port | ||
| 5445 | .Oc | ||
| 5446 | .Op Fl engine Ar id | ||
| 5447 | .Op Fl key Ar keyfile | ||
| 5448 | .Op Fl rand Ar file ... | ||
| 5449 | .Op Fl starttls Ar protocol | ||
| 5450 | .Op Fl verify Ar depth | ||
| 5451 | .Ek | ||
| 5452 | .Pp | ||
| 5453 | The | ||
| 5454 | .Nm s_client | ||
| 5455 | command implements a generic SSL/TLS client which connects | ||
| 5456 | to a remote host using SSL/TLS. | ||
| 5457 | It is a | ||
| 5458 | .Em very | ||
| 5459 | useful diagnostic tool for SSL servers. | ||
| 5460 | .Pp | ||
| 5461 | The options are as follows: | ||
| 5462 | .Bl -tag -width "XXXX" | ||
| 5463 | .It Fl 4 | ||
| 5464 | Specify that | ||
| 5465 | .Nm s_client | ||
| 5466 | should attempt connections using IPv4 only. | ||
| 5467 | .It Fl 6 | ||
| 5468 | Specify that | ||
| 5469 | .Nm s_client | ||
| 5470 | should attempt connections using IPv6 only. | ||
| 5471 | .It Fl bugs | ||
| 5472 | There are several known bugs in SSL and TLS implementations. | ||
| 5473 | Adding this option enables various workarounds. | ||
| 5474 | .It Fl CAfile Ar file | ||
| 5475 | A | ||
| 5476 | .Ar file | ||
| 5477 | containing trusted certificates to use during server authentication | ||
| 5478 | and to use when attempting to build the client certificate chain. | ||
| 5479 | .It Fl CApath Ar directory | ||
| 5480 | The | ||
| 5481 | .Ar directory | ||
| 5482 | to use for server certificate verification. | ||
| 5483 | This directory must be in | ||
| 5484 | .Qq hash format ; | ||
| 5485 | see | ||
| 5486 | .Fl verify | ||
| 5487 | for more information. | ||
| 5488 | These are also used when building the client certificate chain. | ||
| 5489 | .It Fl cert Ar file | ||
| 5490 | The certificate to use, if one is requested by the server. | ||
| 5491 | The default is not to use a certificate. | ||
| 5492 | .It Fl cipher Ar cipherlist | ||
| 5493 | This allows the cipher list sent by the client to be modified. | ||
| 5494 | Although the server determines which cipher suite is used, it should take | ||
| 5495 | the first supported cipher in the list sent by the client. | ||
| 5496 | See the | ||
| 5497 | .Sx CIPHERS | ||
| 5498 | section above for more information. | ||
| 5499 | .It Xo | ||
| 5500 | .Fl connect Ar host : Ns Ar port | | ||
| 5501 | .Ar host Ns / Ns Ar port | ||
| 5502 | .Xc | ||
| 5503 | This specifies the | ||
| 5504 | .Ar host | ||
| 5505 | and optional | ||
| 5506 | .Ar port | ||
| 5507 | to connect to. | ||
| 5508 | If not specified, an attempt is made to connect to the local host | ||
| 5509 | on port 4433. | ||
| 5510 | Alternatively, the host and port pair may be separated using a forward-slash | ||
| 5511 | character. | ||
| 5512 | This form is useful for numeric IPv6 addresses. | ||
| 5513 | .It Fl crlf | ||
| 5514 | This option translates a line feed from the terminal into CR+LF as required | ||
| 5515 | by some servers. | ||
| 5516 | .It Fl debug | ||
| 5517 | Print extensive debugging information including a hex dump of all traffic. | ||
| 5518 | .It Fl engine Ar id | ||
| 5519 | Specifying an engine (by it's unique | ||
| 5520 | .Ar id | ||
| 5521 | string) will cause | ||
| 5522 | .Nm s_client | ||
| 5523 | to attempt to obtain a functional reference to the specified engine, | ||
| 5524 | thus initialising it if needed. | ||
| 5525 | The engine will then be set as the default for all available algorithms. | ||
| 5526 | .It Fl ign_eof | ||
| 5527 | Inhibit shutting down the connection when end of file is reached in the | ||
| 5528 | input. | ||
| 5529 | .It Fl key Ar keyfile | ||
| 5530 | The private key to use. | ||
| 5531 | If not specified, the certificate file will be used. | ||
| 5532 | .It Fl msg | ||
| 5533 | Show all protocol messages with hex dump. | ||
| 5534 | .It Fl nbio | ||
| 5535 | Turns on non-blocking I/O. | ||
| 5536 | .It Fl nbio_test | ||
| 5537 | Tests non-blocking I/O. | ||
| 5538 | .It Xo | ||
| 5539 | .Fl no_ssl2 | no_ssl3 | no_tls1 | | ||
| 5540 | .Fl ssl2 | ssl3 | tls1 | ||
| 5541 | .Xc | ||
| 5542 | These options disable the use of certain SSL or TLS protocols. | ||
| 5543 | By default, the initial handshake uses a method which should be compatible | ||
| 5544 | with all servers and permit them to use SSL v3, SSL v2, or TLS as appropriate. | ||
| 5545 | .Pp | ||
| 5546 | Unfortunately there are a lot of ancient and broken servers in use which | ||
| 5547 | cannot handle this technique and will fail to connect. | ||
| 5548 | Some servers only work if TLS is turned off with the | ||
| 5549 | .Fl no_tls | ||
| 5550 | option, others will only support SSL v2 and may need the | ||
| 5551 | .Fl ssl2 | ||
| 5552 | option. | ||
| 5553 | .It Fl pause | ||
| 5554 | Pauses 1 second between each read and write call. | ||
| 5555 | .It Fl prexit | ||
| 5556 | Print session information when the program exits. | ||
| 5557 | This will always attempt | ||
| 5558 | to print out information even if the connection fails. | ||
| 5559 | Normally, information will only be printed out once if the connection succeeds. | ||
| 5560 | This option is useful because the cipher in use may be renegotiated | ||
| 5561 | or the connection may fail because a client certificate is required or is | ||
| 5562 | requested only after an attempt is made to access a certain URL. | ||
| 5563 | .Sy Note : | ||
| 5564 | the output produced by this option is not always accurate because a | ||
| 5565 | connection might never have been established. | ||
| 5566 | .It Fl quiet | ||
| 5567 | Inhibit printing of session and certificate information. | ||
| 5568 | This implicitly turns on | ||
| 5569 | .Fl ign_eof | ||
| 5570 | as well. | ||
| 5571 | .It Fl rand Ar file ... | ||
| 5572 | A file or files containing random data used to seed the random number generator, | ||
| 5573 | or an EGD socket (see | ||
| 5574 | .Xr RAND_egd 3 ) . | ||
| 5575 | Multiple files can be specified separated by a | ||
| 5576 | .Sq \&: . | ||
| 5577 | .It Fl reconnect | ||
| 5578 | Reconnects to the same server 5 times using the same session ID; this can | ||
| 5579 | be used as a test that session caching is working. | ||
| 5580 | .It Fl serverpref | ||
| 5581 | Use server's cipher preferences | ||
| 5582 | .Pq SSLv2 only . | ||
| 5583 | .It Fl showcerts | ||
| 5584 | Display the whole server certificate chain: normally only the server | ||
| 5585 | certificate itself is displayed. | ||
| 5586 | .It Fl starttls Ar protocol | ||
| 5587 | Send the protocol-specific message(s) to switch to TLS for communication. | ||
| 5588 | .Ar protocol | ||
| 5589 | is a keyword for the intended protocol. | ||
| 5590 | Currently, the only supported keywords are | ||
| 5591 | .Qq smtp | ||
| 5592 | and | ||
| 5593 | .Qq pop3 . | ||
| 5594 | .It Fl state | ||
| 5595 | Prints out the SSL session states. | ||
| 5596 | .It Fl verify Ar depth | ||
| 5597 | The verify | ||
| 5598 | .Ar depth | ||
| 5599 | to use. | ||
| 5600 | This specifies the maximum length of the | ||
| 5601 | server certificate chain and turns on server certificate verification. | ||
| 5602 | Currently the verify operation continues after errors so all the problems | ||
| 5603 | with a certificate chain can be seen. | ||
| 5604 | As a side effect the connection will never fail due to a server | ||
| 5605 | certificate verify failure. | ||
| 5606 | .El | ||
| 5607 | .Sh S_CLIENT CONNECTED COMMANDS | ||
| 5608 | If a connection is established with an SSL server, any data received | ||
| 5609 | from the server is displayed and any key presses will be sent to the | ||
| 5610 | server. | ||
| 5611 | When used interactively (which means neither | ||
| 5612 | .Fl quiet | ||
| 5613 | nor | ||
| 5614 | .Fl ign_eof | ||
| 5615 | have been given), the session will be renegotiated if the line begins with an | ||
| 5616 | .Em R ; | ||
| 5617 | if the line begins with a | ||
| 5618 | .Em Q | ||
| 5619 | or if end of file is reached, the connection will be closed down. | ||
| 5620 | .Sh S_CLIENT NOTES | ||
| 5621 | .Nm s_client | ||
| 5622 | can be used to debug SSL servers. | ||
| 5623 | To connect to an SSL HTTP server the command: | ||
| 5624 | .Pp | ||
| 5625 | .Dl $ openssl s_client -connect servername:443 | ||
| 5626 | .Pp | ||
| 5627 | would typically be used | ||
| 5628 | .Pq HTTPS uses port 443 . | ||
| 5629 | If the connection succeeds, an HTTP command can be given such as | ||
| 5630 | .Qq GET | ||
| 5631 | to retrieve a web page. | ||
| 5632 | .Pp | ||
| 5633 | If the handshake fails, there are several possible causes; if it is | ||
| 5634 | nothing obvious like no client certificate, then the | ||
| 5635 | .Fl bugs , ssl2 , ssl3 , tls1 , | ||
| 5636 | .Fl no_ssl2 , no_ssl3 , | ||
| 5637 | and | ||
| 5638 | .Fl no_tls1 | ||
| 5639 | options can be tried in case it is a buggy server. | ||
| 5640 | In particular these options should be tried | ||
| 5641 | .Em before | ||
| 5642 | submitting a bug report to an | ||
| 5643 | .Nm OpenSSL | ||
| 5644 | mailing list. | ||
| 5645 | .Pp | ||
| 5646 | A frequent problem when attempting to get client certificates working | ||
| 5647 | is that a web client complains it has no certificates or gives an empty | ||
| 5648 | list to choose from. | ||
| 5649 | This is normally because the server is not sending the client's certificate | ||
| 5650 | authority in its | ||
| 5651 | .Qq acceptable CA list | ||
| 5652 | when it requests a certificate. | ||
| 5653 | By using | ||
| 5654 | .Nm s_client | ||
| 5655 | the CA list can be viewed and checked. | ||
| 5656 | However some servers only request client authentication | ||
| 5657 | after a specific URL is requested. | ||
| 5658 | To obtain the list in this case it is necessary to use the | ||
| 5659 | .Fl prexit | ||
| 5660 | option and send an HTTP request for an appropriate page. | ||
| 5661 | .Pp | ||
| 5662 | If a certificate is specified on the command line using the | ||
| 5663 | .Fl cert | ||
| 5664 | option, it will not be used unless the server specifically requests | ||
| 5665 | a client certificate. | ||
| 5666 | Therefore merely including a client certificate | ||
| 5667 | on the command line is no guarantee that the certificate works. | ||
| 5668 | .Pp | ||
| 5669 | If there are problems verifying a server certificate, the | ||
| 5670 | .Fl showcerts | ||
| 5671 | option can be used to show the whole chain. | ||
| 5672 | .Pp | ||
| 5673 | Compression methods are only supported for | ||
| 5674 | .Fl tls1 . | ||
| 5675 | .Sh S_CLIENT BUGS | ||
| 5676 | Because this program has a lot of options and also because some of | ||
| 5677 | the techniques used are rather old, the C source of | ||
| 5678 | .Nm s_client | ||
| 5679 | is rather hard to read and not a model of how things should be done. | ||
| 5680 | A typical SSL client program would be much simpler. | ||
| 5681 | .Pp | ||
| 5682 | The | ||
| 5683 | .Fl verify | ||
| 5684 | option should really exit if the server verification fails. | ||
| 5685 | .Pp | ||
| 5686 | The | ||
| 5687 | .Fl prexit | ||
| 5688 | option is a bit of a hack. | ||
| 5689 | We should really report information whenever a session is renegotiated. | ||
| 5690 | .\" | ||
| 5691 | .\" S_SERVER | ||
| 5692 | .\" | ||
| 5693 | .Sh S_SERVER | ||
| 5694 | .Nm openssl s_server | ||
| 5695 | .Bk -words | ||
| 5696 | .Op Fl bugs | ||
| 5697 | .Op Fl crl_check | ||
| 5698 | .Op Fl crl_check_all | ||
| 5699 | .Op Fl crlf | ||
| 5700 | .Op Fl debug | ||
| 5701 | .Op Fl hack | ||
| 5702 | .Op Fl HTTP | ||
| 5703 | .Op Fl msg | ||
| 5704 | .Op Fl nbio | ||
| 5705 | .Op Fl nbio_test | ||
| 5706 | .Op Fl no_dhe | ||
| 5707 | .Op Fl no_ssl2 | ||
| 5708 | .Op Fl no_ssl3 | ||
| 5709 | .Op Fl no_tls1 | ||
| 5710 | .Op Fl no_tmp_rsa | ||
| 5711 | .Op Fl nocert | ||
| 5712 | .Op Fl quiet | ||
| 5713 | .Op Fl serverpref | ||
| 5714 | .Op Fl ssl2 | ||
| 5715 | .Op Fl ssl3 | ||
| 5716 | .Op Fl state | ||
| 5717 | .Op Fl tls1 | ||
| 5718 | .Op Fl WWW | ||
| 5719 | .Op Fl www | ||
| 5720 | .Op Fl accept Ar port | ||
| 5721 | .Op Fl CAfile Ar file | ||
| 5722 | .Op Fl CApath Ar directory | ||
| 5723 | .Op Fl cert Ar file | ||
| 5724 | .Op Fl cipher Ar cipherlist | ||
| 5725 | .Op Fl context Ar id | ||
| 5726 | .Op Fl dcert Ar file | ||
| 5727 | .Op Fl dhparam Ar file | ||
| 5728 | .Op Fl dkey Ar file | ||
| 5729 | .Op Fl engine Ar id | ||
| 5730 | .Op Fl id_prefix Ar arg | ||
| 5731 | .Op Fl key Ar keyfile | ||
| 5732 | .Op Fl rand Ar file ... | ||
| 5733 | .Op Fl Verify Ar depth | ||
| 5734 | .Op Fl verify Ar depth | ||
| 5735 | .Ek | ||
| 5736 | .Pp | ||
| 5737 | The | ||
| 5738 | .Nm s_server | ||
| 5739 | command implements a generic SSL/TLS server which listens | ||
| 5740 | for connections on a given port using SSL/TLS. | ||
| 5741 | .Pp | ||
| 5742 | The options are as follows: | ||
| 5743 | .Bl -tag -width "XXXX" | ||
| 5744 | .It Fl accept Ar port | ||
| 5745 | The TCP | ||
| 5746 | .Ar port | ||
| 5747 | to listen on for connections. | ||
| 5748 | If not specified, 4433 is used. | ||
| 5749 | .It Fl bugs | ||
| 5750 | There are several known bugs in SSL and TLS implementations. | ||
| 5751 | Adding this option enables various workarounds. | ||
| 5752 | .It Fl CAfile Ar file | ||
| 5753 | A file containing trusted certificates to use during client authentication | ||
| 5754 | and to use when attempting to build the server certificate chain. | ||
| 5755 | The list is also used in the list of acceptable client CAs passed to the | ||
| 5756 | client when a certificate is requested. | ||
| 5757 | .It Fl CApath Ar directory | ||
| 5758 | The | ||
| 5759 | .Ar directory | ||
| 5760 | to use for client certificate verification. | ||
| 5761 | This directory must be in | ||
| 5762 | .Qq hash format ; | ||
| 5763 | see | ||
| 5764 | .Fl verify | ||
| 5765 | for more information. | ||
| 5766 | These are also used when building the server certificate chain. | ||
| 5767 | .It Fl cert Ar file | ||
| 5768 | The certificate to use; most server's cipher suites require the use of a | ||
| 5769 | certificate and some require a certificate with a certain public key type: | ||
| 5770 | for example the DSS cipher suites require a certificate containing a DSS | ||
| 5771 | .Pq DSA | ||
| 5772 | key. | ||
| 5773 | If not specified, the file | ||
| 5774 | .Pa server.pem | ||
| 5775 | will be used. | ||
| 5776 | .It Fl cipher Ar cipherlist | ||
| 5777 | This allows the cipher list used by the server to be modified. | ||
| 5778 | When the client sends a list of supported ciphers, the first client cipher | ||
| 5779 | also included in the server list is used. | ||
| 5780 | Because the client specifies the preference order, the order of the server | ||
| 5781 | cipherlist is irrelevant. | ||
| 5782 | See the | ||
| 5783 | .Sx CIPHERS | ||
| 5784 | section for more information. | ||
| 5785 | .It Fl context Ar id | ||
| 5786 | Sets the SSL context ID. | ||
| 5787 | It can be given any string value. | ||
| 5788 | If this option is not present, a default value will be used. | ||
| 5789 | .It Fl crl_check , crl_check_all | ||
| 5790 | Check the peer certificate has not been revoked by its CA. | ||
| 5791 | The CRLs are appended to the certificate file. | ||
| 5792 | With the | ||
| 5793 | .Fl crl_check_all | ||
| 5794 | option, all CRLs of all CAs in the chain are checked. | ||
| 5795 | .It Fl crlf | ||
| 5796 | This option translates a line feed from the terminal into CR+LF. | ||
| 5797 | .It Fl dcert Ar file , Fl dkey Ar file | ||
| 5798 | Specify an additional certificate and private key; these behave in the | ||
| 5799 | same manner as the | ||
| 5800 | .Fl cert | ||
| 5801 | and | ||
| 5802 | .Fl key | ||
| 5803 | options except there is no default if they are not specified | ||
| 5804 | .Pq no additional certificate or key is used . | ||
| 5805 | As noted above some cipher suites require a certificate containing a key of | ||
| 5806 | a certain type. | ||
| 5807 | Some cipher suites need a certificate carrying an RSA key | ||
| 5808 | and some a DSS | ||
| 5809 | .Pq DSA | ||
| 5810 | key. | ||
| 5811 | By using RSA and DSS certificates and keys, | ||
| 5812 | a server can support clients which only support RSA or DSS cipher suites | ||
| 5813 | by using an appropriate certificate. | ||
| 5814 | .It Fl debug | ||
| 5815 | Print extensive debugging information including a hex dump of all traffic. | ||
| 5816 | .It Fl dhparam Ar file | ||
| 5817 | The DH parameter file to use. | ||
| 5818 | The ephemeral DH cipher suites generate keys | ||
| 5819 | using a set of DH parameters. | ||
| 5820 | If not specified, an attempt is made to | ||
| 5821 | load the parameters from the server certificate file. | ||
| 5822 | If this fails, a static set of parameters hard coded into the | ||
| 5823 | .Nm s_server | ||
| 5824 | program will be used. | ||
| 5825 | .It Fl engine Ar id | ||
| 5826 | Specifying an engine (by it's unique | ||
| 5827 | .Ar id | ||
| 5828 | string) will cause | ||
| 5829 | .Nm s_server | ||
| 5830 | to attempt to obtain a functional reference to the specified engine, | ||
| 5831 | thus initialising it if needed. | ||
| 5832 | The engine will then be set as the default for all available algorithms. | ||
| 5833 | .It Fl hack | ||
| 5834 | This option enables a further workaround for some early Netscape | ||
| 5835 | SSL code | ||
| 5836 | .Pq \&? . | ||
| 5837 | .It Fl HTTP | ||
| 5838 | Emulates a simple web server. | ||
| 5839 | Pages will be resolved relative to the current directory; | ||
| 5840 | for example if the URL | ||
| 5841 | .Pa https://myhost/page.html | ||
| 5842 | is requested, the file | ||
| 5843 | .Pa ./page.html | ||
| 5844 | will be loaded. | ||
| 5845 | The files loaded are assumed to contain a complete and correct HTTP | ||
| 5846 | response (lines that are part of the HTTP response line and headers | ||
| 5847 | must end with CRLF). | ||
| 5848 | .It Fl id_prefix Ar arg | ||
| 5849 | Generate SSL/TLS session IDs prefixed by | ||
| 5850 | .Ar arg . | ||
| 5851 | This is mostly useful for testing any SSL/TLS code | ||
| 5852 | .Pq e.g. proxies | ||
| 5853 | that wish to deal with multiple servers, when each of which might be | ||
| 5854 | generating a unique range of session IDs | ||
| 5855 | .Pq e.g. with a certain prefix . | ||
| 5856 | .It Fl key Ar keyfile | ||
| 5857 | The private key to use. | ||
| 5858 | If not specified, the certificate file will be used. | ||
| 5859 | .It Fl msg | ||
| 5860 | Show all protocol messages with hex dump. | ||
| 5861 | .It Fl nbio | ||
| 5862 | Turns on non-blocking I/O. | ||
| 5863 | .It Fl nbio_test | ||
| 5864 | Tests non-blocking I/O. | ||
| 5865 | .It Fl no_dhe | ||
| 5866 | If this option is set, no DH parameters will be loaded, effectively | ||
| 5867 | disabling the ephemeral DH cipher suites. | ||
| 5868 | .It Xo | ||
| 5869 | .Fl no_ssl2 | no_ssl3 | no_tls1 | | ||
| 5870 | .Fl ssl2 | ssl3 | tls1 | ||
| 5871 | .Xc | ||
| 5872 | These options disable the use of certain SSL or TLS protocols. | ||
| 5873 | By default, the initial handshake uses a method which should be compatible | ||
| 5874 | with all servers and permit them to use SSL v3, SSL v2, or TLS as appropriate. | ||
| 5875 | .It Fl no_tmp_rsa | ||
| 5876 | Certain export cipher suites sometimes use a temporary RSA key; this option | ||
| 5877 | disables temporary RSA key generation. | ||
| 5878 | .It Fl nocert | ||
| 5879 | If this option is set, no certificate is used. | ||
| 5880 | This restricts the cipher suites available to the anonymous ones | ||
| 5881 | .Pq currently just anonymous DH . | ||
| 5882 | .It Fl quiet | ||
| 5883 | Inhibit printing of session and certificate information. | ||
| 5884 | .It Fl rand Ar file ... | ||
| 5885 | A file or files containing random data used to seed the random number generator, | ||
| 5886 | or an EGD socket (see | ||
| 5887 | .Xr RAND_egd 3 ) . | ||
| 5888 | Multiple files can be specified separated by a | ||
| 5889 | .Sq \&: . | ||
| 5890 | .It Fl serverpref | ||
| 5891 | Use server's cipher preferences. | ||
| 5892 | .It Fl state | ||
| 5893 | Prints out the SSL session states. | ||
| 5894 | .It Fl WWW | ||
| 5895 | Emulates a simple web server. | ||
| 5896 | Pages will be resolved relative to the current directory; | ||
| 5897 | for example if the URL | ||
| 5898 | .Pa https://myhost/page.html | ||
| 5899 | is requested, the file | ||
| 5900 | .Pa ./page.html | ||
| 5901 | will be loaded. | ||
| 5902 | .It Fl www | ||
| 5903 | Sends a status message back to the client when it connects. | ||
| 5904 | This includes lots of information about the ciphers used and various | ||
| 5905 | session parameters. | ||
| 5906 | The output is in HTML format so this option will normally be used with a | ||
| 5907 | web browser. | ||
| 5908 | .It Fl Verify Ar depth , Fl verify Ar depth | ||
| 5909 | The verify | ||
| 5910 | .Ar depth | ||
| 5911 | to use. | ||
| 5912 | This specifies the maximum length of the client certificate chain | ||
| 5913 | and makes the server request a certificate from the client. | ||
| 5914 | With the | ||
| 5915 | .Fl Verify | ||
| 5916 | option, the client must supply a certificate or an error occurs. | ||
| 5917 | With the | ||
| 5918 | .Fl verify | ||
| 5919 | option, a certificate is requested but the client does not have to send one. | ||
| 5920 | .El | ||
| 5921 | .Sh S_SERVER CONNECTED COMMANDS | ||
| 5922 | If a connection request is established with an SSL client and neither the | ||
| 5923 | .Fl www | ||
| 5924 | nor the | ||
| 5925 | .Fl WWW | ||
| 5926 | option has been used, then normally any data received | ||
| 5927 | from the client is displayed and any key presses will be sent to the client. | ||
| 5928 | .Pp | ||
| 5929 | Certain single letter commands are also recognized which perform special | ||
| 5930 | operations: these are listed below. | ||
| 5931 | .Bl -tag -width "XXXX" | ||
| 5932 | .It Ar P | ||
| 5933 | Send some plain text down the underlying TCP connection: this should | ||
| 5934 | cause the client to disconnect due to a protocol violation. | ||
| 5935 | .It Ar Q | ||
| 5936 | End the current SSL connection and exit. | ||
| 5937 | .It Ar q | ||
| 5938 | End the current SSL connection, but still accept new connections. | ||
| 5939 | .It Ar R | ||
| 5940 | Renegotiate the SSL session and request a client certificate. | ||
| 5941 | .It Ar r | ||
| 5942 | Renegotiate the SSL session. | ||
| 5943 | .It Ar S | ||
| 5944 | Print out some session cache status information. | ||
| 5945 | .El | ||
| 5946 | .Sh S_SERVER NOTES | ||
| 5947 | .Nm s_server | ||
| 5948 | can be used to debug SSL clients. | ||
| 5949 | To accept connections from a web browser the command: | ||
| 5950 | .Pp | ||
| 5951 | .Dl $ openssl s_server -accept 443 -www | ||
| 5952 | .Pp | ||
| 5953 | can be used, for example. | ||
| 5954 | .Pp | ||
| 5955 | Most web browsers | ||
| 5956 | .Pq in particular Netscape and MSIE | ||
| 5957 | only support RSA cipher suites, so they cannot connect to servers | ||
| 5958 | which don't use a certificate carrying an RSA key or a version of | ||
| 5959 | .Nm OpenSSL | ||
| 5960 | with RSA disabled. | ||
| 5961 | .Pp | ||
| 5962 | Although specifying an empty list of CAs when requesting a client certificate | ||
| 5963 | is strictly speaking a protocol violation, some SSL | ||
| 5964 | clients interpret this to mean any CA is acceptable. | ||
| 5965 | This is useful for debugging purposes. | ||
| 5966 | .Pp | ||
| 5967 | The session parameters can printed out using the | ||
| 5968 | .Nm sess_id | ||
| 5969 | program. | ||
| 5970 | .Sh S_SERVER BUGS | ||
| 5971 | Because this program has a lot of options and also because some of | ||
| 5972 | the techniques used are rather old, the C source of | ||
| 5973 | .Nm s_server | ||
| 5974 | is rather hard to read and not a model of how things should be done. | ||
| 5975 | A typical SSL server program would be much simpler. | ||
| 5976 | .Pp | ||
| 5977 | The output of common ciphers is wrong: it just gives the list of ciphers that | ||
| 5978 | .Nm OpenSSL | ||
| 5979 | recognizes and the client supports. | ||
| 5980 | .Pp | ||
| 5981 | There should be a way for the | ||
| 5982 | .Nm s_server | ||
| 5983 | program to print out details of any | ||
| 5984 | unknown cipher suites a client says it supports. | ||
| 5985 | .\" | ||
| 5986 | .\" S_TIME | ||
| 5987 | .\" | ||
| 5988 | .Sh S_TIME | ||
| 5989 | .Nm openssl s_time | ||
| 5990 | .Bk -words | ||
| 5991 | .Op Fl bugs | ||
| 5992 | .Op Fl nbio | ||
| 5993 | .Op Fl new | ||
| 5994 | .Op Fl reuse | ||
| 5995 | .Op Fl ssl2 | ||
| 5996 | .Op Fl ssl3 | ||
| 5997 | .Op Fl CAfile Ar file | ||
| 5998 | .Op Fl CApath Ar directory | ||
| 5999 | .Op Fl cert Ar file | ||
| 6000 | .Op Fl cipher Ar cipherlist | ||
| 6001 | .Op Fl connect Ar host : Ns Ar port | ||
| 6002 | .Op Fl key Ar keyfile | ||
| 6003 | .Op Fl time Ar seconds | ||
| 6004 | .Op Fl verify Ar depth | ||
| 6005 | .Op Fl www Ar page | ||
| 6006 | .Ek | ||
| 6007 | .Pp | ||
| 6008 | The | ||
| 6009 | .Nm s_client | ||
| 6010 | command implements a generic SSL/TLS client which connects to a | ||
| 6011 | remote host using SSL/TLS. | ||
| 6012 | It can request a page from the server and includes | ||
| 6013 | the time to transfer the payload data in its timing measurements. | ||
| 6014 | It measures the number of connections within a given timeframe, | ||
| 6015 | the amount of data transferred | ||
| 6016 | .Pq if any , | ||
| 6017 | and calculates the average time spent for one connection. | ||
| 6018 | .Pp | ||
| 6019 | The options are as follows: | ||
| 6020 | .Bl -tag -width Ds | ||
| 6021 | .It Fl bugs | ||
| 6022 | There are several known bugs in SSL and TLS implementations. | ||
| 6023 | Adding this option enables various workarounds. | ||
| 6024 | .It Fl CAfile Ar file | ||
| 6025 | A file containing trusted certificates to use during server authentication | ||
| 6026 | and to use when attempting to build the client certificate chain. | ||
| 6027 | .It Fl CApath Ar directory | ||
| 6028 | The directory to use for server certificate verification. | ||
| 6029 | This directory must be in | ||
| 6030 | .Qq hash format ; | ||
| 6031 | see | ||
| 6032 | .Nm verify | ||
| 6033 | for more information. | ||
| 6034 | These are also used when building the client certificate chain. | ||
| 6035 | .It Fl cert Ar file | ||
| 6036 | The certificate to use, if one is requested by the server. | ||
| 6037 | The default is not to use a certificate. | ||
| 6038 | The file is in PEM format. | ||
| 6039 | .It Fl cipher Ar cipherlist | ||
| 6040 | This allows the cipher list sent by the client to be modified. | ||
| 6041 | Although the server determines which cipher suite is used, | ||
| 6042 | it should take the first supported cipher in the list sent by the client. | ||
| 6043 | See the | ||
| 6044 | .Nm ciphers | ||
| 6045 | command for more information. | ||
| 6046 | .It Fl connect Ar host : Ns Ar port | ||
| 6047 | This specifies the host and optional port to connect to. | ||
| 6048 | .It Fl key Ar keyfile | ||
| 6049 | The private key to use. | ||
| 6050 | If not specified, the certificate file will be used. | ||
| 6051 | The file is in PEM format. | ||
| 6052 | .It Fl nbio | ||
| 6053 | Turns on non-blocking I/O. | ||
| 6054 | .It Fl new | ||
| 6055 | Performs the timing test using a new session ID for each connection. | ||
| 6056 | If neither | ||
| 6057 | .Fl new | ||
| 6058 | nor | ||
| 6059 | .Fl reuse | ||
| 6060 | are specified, | ||
| 6061 | they are both on by default and executed in sequence. | ||
| 6062 | .It Fl reuse | ||
| 6063 | Performs the timing test using the same session ID; | ||
| 6064 | this can be used as a test that session caching is working. | ||
| 6065 | If neither | ||
| 6066 | .Fl new | ||
| 6067 | nor | ||
| 6068 | .Fl reuse | ||
| 6069 | are specified, | ||
| 6070 | they are both on by default and executed in sequence. | ||
| 6071 | .It Fl ssl2 | ssl3 | ||
| 6072 | These options disable the use of certain SSL or TLS protocols. | ||
| 6073 | By default, the initial handshake uses a method | ||
| 6074 | which should be compatible with all servers and permit them to use | ||
| 6075 | SSL v3, SSL v2, or TLS as appropriate. | ||
| 6076 | The timing program is not as rich in options to turn protocols on and off as | ||
| 6077 | the | ||
| 6078 | .Nm s_client | ||
| 6079 | program and may not connect to all servers. | ||
| 6080 | .Pp | ||
| 6081 | Unfortunately there are a lot of ancient and broken servers in use which | ||
| 6082 | cannot handle this technique and will fail to connect. | ||
| 6083 | Some servers only work if TLS is turned off with the | ||
| 6084 | .Fl ssl3 | ||
| 6085 | option; | ||
| 6086 | others will only support SSL v2 and may need the | ||
| 6087 | .Fl ssl2 | ||
| 6088 | option. | ||
| 6089 | .It Fl time Ar seconds | ||
| 6090 | Specifies how long | ||
| 6091 | .Pq in seconds | ||
| 6092 | .Nm s_time | ||
| 6093 | should establish connections and | ||
| 6094 | optionally transfer payload data from a server. | ||
| 6095 | The default is 30 seconds. | ||
| 6096 | Server and client performance and the link speed | ||
| 6097 | determine how many connections | ||
| 6098 | .Nm s_time | ||
| 6099 | can establish. | ||
| 6100 | .It Fl verify Ar depth | ||
| 6101 | The verify depth to use. | ||
| 6102 | This specifies the maximum length of the server certificate chain | ||
| 6103 | and turns on server certificate verification. | ||
| 6104 | Currently the verify operation continues after errors, so all the problems | ||
| 6105 | with a certificate chain can be seen. | ||
| 6106 | As a side effect, | ||
| 6107 | the connection will never fail due to a server certificate verify failure. | ||
| 6108 | .It Fl www Ar page | ||
| 6109 | This specifies the page to GET from the server. | ||
| 6110 | A value of | ||
| 6111 | .Sq / | ||
| 6112 | gets the index.htm[l] page. | ||
| 6113 | If this parameter is not specified, | ||
| 6114 | .Nm s_time | ||
| 6115 | will only perform the handshake to establish SSL connections | ||
| 6116 | but not transfer any payload data. | ||
| 6117 | .El | ||
| 6118 | .Sh S_TIME NOTES | ||
| 6119 | .Nm s_client | ||
| 6120 | can be used to measure the performance of an SSL connection. | ||
| 6121 | To connect to an SSL HTTP server and get the default page the command | ||
| 6122 | .Bd -literal -offset indent | ||
| 6123 | $ openssl s_time -connect servername:443 -www / -CApath yourdir \e | ||
| 6124 | -CAfile yourfile.pem -cipher commoncipher [-ssl3] | ||
| 6125 | .Ed | ||
| 6126 | .Pp | ||
| 6127 | would typically be used | ||
| 6128 | .Pq HTTPS uses port 443 . | ||
| 6129 | .Dq commoncipher | ||
| 6130 | is a cipher to which both client and server can agree; | ||
| 6131 | see the | ||
| 6132 | .Nm ciphers | ||
| 6133 | command for details. | ||
| 6134 | .Pp | ||
| 6135 | If the handshake fails, there are several possible causes: | ||
| 6136 | if it is nothing obvious like no client certificate, the | ||
| 6137 | .Fl bugs , ssl2 , | ||
| 6138 | and | ||
| 6139 | .Fl ssl3 | ||
| 6140 | options can be tried in case it is a buggy server. | ||
| 6141 | In particular you should play with these options | ||
| 6142 | .Em before | ||
| 6143 | submitting a bug report to an OpenSSL mailing list. | ||
| 6144 | .Pp | ||
| 6145 | A frequent problem when attempting to get client certificates working | ||
| 6146 | is that a web client complains it has no certificates or gives an empty | ||
| 6147 | list to choose from. | ||
| 6148 | This is normally because the server is not sending | ||
| 6149 | the clients certificate authority in its | ||
| 6150 | .Qq acceptable CA list | ||
| 6151 | when it requests a certificate. | ||
| 6152 | By using | ||
| 6153 | .Nm s_client , | ||
| 6154 | the CA list can be viewed and checked. | ||
| 6155 | However some servers only request client authentication | ||
| 6156 | after a specific URL is requested. | ||
| 6157 | To obtain the list in this case, it is necessary to use the | ||
| 6158 | .Fl prexit | ||
| 6159 | option of | ||
| 6160 | .Nm s_client | ||
| 6161 | and send an HTTP request for an appropriate page. | ||
| 6162 | .Pp | ||
| 6163 | If a certificate is specified on the command line using the | ||
| 6164 | .Fl cert | ||
| 6165 | option, | ||
| 6166 | it will not be used unless the server specifically requests | ||
| 6167 | a client certificate. | ||
| 6168 | Therefore merely including a client certificate | ||
| 6169 | on the command line is no guarantee that the certificate works. | ||
| 6170 | .Sh S_TIME BUGS | ||
| 6171 | Because this program does not have all the options of the | ||
| 6172 | .Nm s_client | ||
| 6173 | program to turn protocols on and off, | ||
| 6174 | you may not be able to measure the performance | ||
| 6175 | of all protocols with all servers. | ||
| 6176 | .Pp | ||
| 6177 | The | ||
| 6178 | .Fl verify | ||
| 6179 | option should really exit if the server verification fails. | ||
| 6180 | .\" | ||
| 6181 | .\" SESS_ID | ||
| 6182 | .\" | ||
| 6183 | .Sh SESS_ID | ||
| 6184 | .Nm openssl sess_id | ||
| 6185 | .Bk -words | ||
| 6186 | .Op Fl cert | ||
| 6187 | .Op Fl noout | ||
| 6188 | .Op Fl text | ||
| 6189 | .Op Fl context Ar ID | ||
| 6190 | .Op Fl in Ar file | ||
| 6191 | .Op Fl inform Ar DER | PEM | ||
| 6192 | .Op Fl out Ar file | ||
| 6193 | .Op Fl outform Ar DER | PEM | ||
| 6194 | .Ek | ||
| 6195 | .Pp | ||
| 6196 | The | ||
| 6197 | .Nm sess_id | ||
| 6198 | program processes the encoded version of the SSL session structure and | ||
| 6199 | optionally prints out SSL session details | ||
| 6200 | .Pq for example the SSL session master key | ||
| 6201 | in human readable format. | ||
| 6202 | Since this is a diagnostic tool that needs some knowledge of the SSL | ||
| 6203 | protocol to use properly, most users will not need to use it. | ||
| 6204 | .Pp | ||
| 6205 | The options are as follows: | ||
| 6206 | .Bl -tag -width "XXXX" | ||
| 6207 | .It Fl cert | ||
| 6208 | If a certificate is present in the session, | ||
| 6209 | it will be output using this option; | ||
| 6210 | if the | ||
| 6211 | .Fl text | ||
| 6212 | option is also present, then it will be printed out in text form. | ||
| 6213 | .It Fl context Ar ID | ||
| 6214 | This option can set the session ID so the output session information uses the | ||
| 6215 | supplied | ||
| 6216 | .Ar ID . | ||
| 6217 | The | ||
| 6218 | .Ar ID | ||
| 6219 | can be any string of characters. | ||
| 6220 | This option won't normally be used. | ||
| 6221 | .It Fl in Ar file | ||
| 6222 | This specifies the input | ||
| 6223 | .Ar file | ||
| 6224 | to read session information from, or standard input by default. | ||
| 6225 | .It Fl inform Ar DER | PEM | ||
| 6226 | This specifies the input format. | ||
| 6227 | The | ||
| 6228 | .Ar DER | ||
| 6229 | argument uses an ASN1 DER-encoded | ||
| 6230 | format containing session details. | ||
| 6231 | The precise format can vary from one version to the next. | ||
| 6232 | The | ||
| 6233 | .Ar PEM | ||
| 6234 | form is the default format: it consists of the DER | ||
| 6235 | format base64-encoded with additional header and footer lines. | ||
| 6236 | .It Fl noout | ||
| 6237 | This option prevents output of the encoded version of the session. | ||
| 6238 | .It Fl out Ar file | ||
| 6239 | This specifies the output | ||
| 6240 | .Ar file | ||
| 6241 | to write session information to, or standard | ||
| 6242 | output if this option is not specified. | ||
| 6243 | .It Fl outform Ar DER | PEM | ||
| 6244 | This specifies the output format; the options have the same meaning as the | ||
| 6245 | .Fl inform | ||
| 6246 | option. | ||
| 6247 | .It Fl text | ||
| 6248 | Prints out the various public or private key components in | ||
| 6249 | plain text in addition to the encoded version. | ||
| 6250 | .El | ||
| 6251 | .Sh SESS_ID OUTPUT | ||
| 6252 | Typical output: | ||
| 6253 | .Bd -literal | ||
| 6254 | SSL-Session: | ||
| 6255 | Protocol : TLSv1 | ||
| 6256 | Cipher : 0016 | ||
| 6257 | Session-ID: 871E62626C554CE95488823752CBD5F3673A3EF3DCE9C67BD916C809914B40ED | ||
| 6258 | Session-ID-ctx: 01000000 | ||
| 6259 | Master-Key: A7CEFC571974BE02CAC305269DC59F76EA9F0B180CB6642697A68251F2D2BB57E51DBBB4C7885573192AE9AEE220FACD | ||
| 6260 | Key-Arg : None | ||
| 6261 | Start Time: 948459261 | ||
| 6262 | Timeout : 300 (sec) | ||
| 6263 | Verify return code 0 (ok) | ||
| 6264 | .Ed | ||
| 6265 | .Pp | ||
| 6266 | These are described below in more detail. | ||
| 6267 | .Pp | ||
| 6268 | .Bl -tag -width "Verify return code " -compact | ||
| 6269 | .It Ar Protocol | ||
| 6270 | This is the protocol in use: TLSv1, SSLv3, or SSLv2. | ||
| 6271 | .It Ar Cipher | ||
| 6272 | The cipher used is the actual raw SSL or TLS cipher code; | ||
| 6273 | see the SSL or TLS specifications for more information. | ||
| 6274 | .It Ar Session-ID | ||
| 6275 | The SSL session ID in hex format. | ||
| 6276 | .It Ar Session-ID-ctx | ||
| 6277 | The session ID context in hex format. | ||
| 6278 | .It Ar Master-Key | ||
| 6279 | This is the SSL session master key. | ||
| 6280 | .It Ar Key-Arg | ||
| 6281 | The key argument; this is only used in SSL v2. | ||
| 6282 | .It Ar Start Time | ||
| 6283 | This is the session start time, represented as an integer in standard | ||
| 6284 | .Ux | ||
| 6285 | format. | ||
| 6286 | .It Ar Timeout | ||
| 6287 | The timeout in seconds. | ||
| 6288 | .It Ar Verify return code | ||
| 6289 | This is the return code when an SSL client certificate is verified. | ||
| 6290 | .El | ||
| 6291 | .Sh SESS_ID NOTES | ||
| 6292 | The PEM-encoded session format uses the header and footer lines: | ||
| 6293 | .Bd -unfilled -offset indent | ||
| 6294 | -----BEGIN SSL SESSION PARAMETERS----- | ||
| 6295 | -----END SSL SESSION PARAMETERS----- | ||
| 6296 | .Ed | ||
| 6297 | .Pp | ||
| 6298 | Since the SSL session output contains the master key, it is possible to read | ||
| 6299 | the contents of an encrypted session using this information. | ||
| 6300 | Therefore appropriate security precautions | ||
| 6301 | should be taken if the information is being output by a | ||
| 6302 | .Qq real | ||
| 6303 | application. | ||
| 6304 | This is, however, strongly discouraged and should only be used for | ||
| 6305 | debugging purposes. | ||
| 6306 | .Sh SESS_ID BUGS | ||
| 6307 | The cipher and start time should be printed out in human readable form. | ||
| 6308 | .\" | ||
| 6309 | .\" SMIME | ||
| 6310 | .\" | ||
| 6311 | .Sh SMIME | ||
| 6312 | .Nm openssl smime | ||
| 6313 | .Bk -words | ||
| 6314 | .Oo Xo | ||
| 6315 | .Fl aes128 | aes192 | aes256 | des | | ||
| 6316 | .Fl des3 | rc2-40 | rc2-64 | rc2-128 | ||
| 6317 | .Xc | ||
| 6318 | .Oc | ||
| 6319 | .Op Fl binary | ||
| 6320 | .Op Fl crl_check | ||
| 6321 | .Op Fl crl_check_all | ||
| 6322 | .Op Fl decrypt | ||
| 6323 | .Op Fl encrypt | ||
| 6324 | .Op Fl noattr | ||
| 6325 | .Op Fl nocerts | ||
| 6326 | .Op Fl nochain | ||
| 6327 | .Op Fl nodetach | ||
| 6328 | .Op Fl nointern | ||
| 6329 | .Op Fl nosigs | ||
| 6330 | .Op Fl noverify | ||
| 6331 | .Op Fl pk7out | ||
| 6332 | .Op Fl sign | ||
| 6333 | .Op Fl text | ||
| 6334 | .Op Fl verify | ||
| 6335 | .Op Fl CAfile Ar file | ||
| 6336 | .Op Fl CApath Ar directory | ||
| 6337 | .Op Fl certfile Ar file | ||
| 6338 | .Op Fl content Ar file | ||
| 6339 | .Op Fl engine Ar id | ||
| 6340 | .Op Fl from Ar addr | ||
| 6341 | .Op Fl in Ar file | ||
| 6342 | .Op Fl inform Ar DER | PEM | SMIME | ||
| 6343 | .Op Fl inkey Ar file | ||
| 6344 | .Op Fl keyform Ar ENGINE | PEM | ||
| 6345 | .Op Fl out Ar file | ||
| 6346 | .Op Fl outform Ar DER | PEM | SMIME | ||
| 6347 | .Op Fl passin Ar arg | ||
| 6348 | .Op Fl rand Ar file ... | ||
| 6349 | .Op Fl recip Ar file | ||
| 6350 | .Op Fl signer Ar file | ||
| 6351 | .Op Fl subject Ar s | ||
| 6352 | .Op Fl to Ar addr | ||
| 6353 | .Op Ar cert.pem ... | ||
| 6354 | .Ek | ||
| 6355 | .Pp | ||
| 6356 | The | ||
| 6357 | .Nm smime | ||
| 6358 | command handles | ||
| 6359 | .Em S/MIME | ||
| 6360 | mail. | ||
| 6361 | It can encrypt, decrypt, sign, and verify | ||
| 6362 | .Em S/MIME | ||
| 6363 | messages. | ||
| 6364 | .Pp | ||
| 6365 | There are five operation options that set the type of operation to be performed. | ||
| 6366 | The meaning of the other options varies according to the operation type. | ||
| 6367 | .Pp | ||
| 6368 | The five operation options are as follows: | ||
| 6369 | .Bl -tag -width "XXXX" | ||
| 6370 | .It Fl decrypt | ||
| 6371 | Decrypt mail using the supplied certificate and private key. | ||
| 6372 | Expects an encrypted mail message in | ||
| 6373 | .Em MIME | ||
| 6374 | format for the input file. | ||
| 6375 | The decrypted mail is written to the output file. | ||
| 6376 | .It Fl encrypt | ||
| 6377 | Encrypt mail for the given recipient certificates. | ||
| 6378 | Input file is the message to be encrypted. | ||
| 6379 | The output file is the encrypted mail in | ||
| 6380 | .Em MIME | ||
| 6381 | format. | ||
| 6382 | .It Fl pk7out | ||
| 6383 | Takes an input message and writes out a PEM-encoded PKCS#7 structure. | ||
| 6384 | .It Fl sign | ||
| 6385 | Sign mail using the supplied certificate and private key. | ||
| 6386 | Input file is the message to be signed. | ||
| 6387 | The signed message in | ||
| 6388 | .Em MIME | ||
| 6389 | format is written to the output file. | ||
| 6390 | .It Fl verify | ||
| 6391 | Verify signed mail. | ||
| 6392 | Expects a signed mail message on input and outputs the signed data. | ||
| 6393 | Both clear text and opaque signing is supported. | ||
| 6394 | .El | ||
| 6395 | .Pp | ||
| 6396 | The reamaining options are as follows: | ||
| 6397 | .Bl -tag -width "XXXX" | ||
| 6398 | .It Xo | ||
| 6399 | .Fl aes128 | aes192 | aes256 | des | | ||
| 6400 | .Fl des3 | rc2-40 | rc2-64 | rc2-128 | ||
| 6401 | .Xc | ||
| 6402 | The encryption algorithm to use. | ||
| 6403 | 128-, 192-, or 256-bit AES, | ||
| 6404 | DES | ||
| 6405 | .Pq 56 bits , | ||
| 6406 | triple DES | ||
| 6407 | .Pq 168 bits , | ||
| 6408 | or 40-, 64-, or 128-bit RC2, respectively; | ||
| 6409 | if not specified, 40-bit RC2 is | ||
| 6410 | used. | ||
| 6411 | Only used with | ||
| 6412 | .Fl encrypt . | ||
| 6413 | .It Fl binary | ||
| 6414 | Normally, the input message is converted to | ||
| 6415 | .Qq canonical | ||
| 6416 | format which is effectively using CR and LF as end of line \- | ||
| 6417 | as required by the | ||
| 6418 | .Em S/MIME | ||
| 6419 | specification. | ||
| 6420 | When this option is present no translation occurs. | ||
| 6421 | This is useful when handling binary data which may not be in | ||
| 6422 | .Em MIME | ||
| 6423 | format. | ||
| 6424 | .It Fl CAfile Ar file | ||
| 6425 | A | ||
| 6426 | .Ar file | ||
| 6427 | containing trusted CA certificates; only used with | ||
| 6428 | .Fl verify . | ||
| 6429 | .It Fl CApath Ar directory | ||
| 6430 | A | ||
| 6431 | .Ar directory | ||
| 6432 | containing trusted CA certificates; only used with | ||
| 6433 | .Fl verify . | ||
| 6434 | This directory must be a standard certificate directory: | ||
| 6435 | that is, a hash of each subject name (using | ||
| 6436 | .Nm x509 -hash ) | ||
| 6437 | should be linked to each certificate. | ||
| 6438 | .It Ar cert.pem ... | ||
| 6439 | One or more certificates of message recipients: used when encrypting | ||
| 6440 | a message. | ||
| 6441 | .It Fl certfile Ar file | ||
| 6442 | Allows additional certificates to be specified. | ||
| 6443 | When signing, these will be included with the message. | ||
| 6444 | When verifying, these will be searched for the signers' certificates. | ||
| 6445 | The certificates should be in PEM format. | ||
| 6446 | .It Fl content Ar file | ||
| 6447 | This specifies a file containing the detached content. | ||
| 6448 | This is only useful with the | ||
| 6449 | .Fl verify | ||
| 6450 | command. | ||
| 6451 | This is only usable if the PKCS#7 structure is using the detached | ||
| 6452 | signature form where the content is not included. | ||
| 6453 | This option will override any content if the input format is | ||
| 6454 | .Em S/MIME | ||
| 6455 | and it uses the multipart/signed | ||
| 6456 | .Em MIME | ||
| 6457 | content type. | ||
| 6458 | .It Fl crl_check | ||
| 6459 | Check revocation status of signer's certificate using CRLs. | ||
| 6460 | .It Fl crl_check_all | ||
| 6461 | Check revocation status of signer's certificate chain using CRLs. | ||
| 6462 | .It Fl engine Ar id | ||
| 6463 | Specifying an engine (by it's unique | ||
| 6464 | .Ar id | ||
| 6465 | string) will cause | ||
| 6466 | .Nm smime | ||
| 6467 | to attempt to obtain a functional reference to the specified engine, | ||
| 6468 | thus initialising it if needed. | ||
| 6469 | The engine will then be set as the default | ||
| 6470 | for all available algorithms. | ||
| 6471 | .It Xo | ||
| 6472 | .Fl from Ar addr , | ||
| 6473 | .Fl subject Ar s , | ||
| 6474 | .Fl to Ar addr | ||
| 6475 | .Xc | ||
| 6476 | The relevant mail headers. | ||
| 6477 | These are included outside the signed | ||
| 6478 | portion of a message so they may be included manually. | ||
| 6479 | When signing, many | ||
| 6480 | .Em S/MIME | ||
| 6481 | mail clients check that the signer's certificate email | ||
| 6482 | address matches the From: address. | ||
| 6483 | .It Fl in Ar file | ||
| 6484 | The input message to be encrypted or signed or the | ||
| 6485 | .Em MIME | ||
| 6486 | message to | ||
| 6487 | be decrypted or verified. | ||
| 6488 | .It Fl inform Ar DER | PEM | SMIME | ||
| 6489 | This specifies the input format for the PKCS#7 structure. | ||
| 6490 | The default is | ||
| 6491 | .Em SMIME , | ||
| 6492 | which reads an | ||
| 6493 | .Em S/MIME | ||
| 6494 | format message. | ||
| 6495 | .Ar PEM | ||
| 6496 | and | ||
| 6497 | .Ar DER | ||
| 6498 | format change this to expect PEM and DER format PKCS#7 structures | ||
| 6499 | instead. | ||
| 6500 | This currently only affects the input format of the PKCS#7 | ||
| 6501 | structure; if no PKCS#7 structure is being input (for example with | ||
| 6502 | .Fl encrypt | ||
| 6503 | or | ||
| 6504 | .Fl sign ) , | ||
| 6505 | this option has no effect. | ||
| 6506 | .It Fl inkey Ar file | ||
| 6507 | The private key to use when signing or decrypting. | ||
| 6508 | This must match the corresponding certificate. | ||
| 6509 | If this option is not specified, the private key must be included | ||
| 6510 | in the certificate file specified with | ||
| 6511 | the | ||
| 6512 | .Fl recip | ||
| 6513 | or | ||
| 6514 | .Fl signer | ||
| 6515 | file. | ||
| 6516 | .It Fl keyform Ar ENGINE | PEM | ||
| 6517 | Input private key format. | ||
| 6518 | .It Fl noattr | ||
| 6519 | Normally, when a message is signed a set of attributes are included which | ||
| 6520 | include the signing time and supported symmetric algorithms. | ||
| 6521 | With this option they are not included. | ||
| 6522 | .It Fl nocerts | ||
| 6523 | When signing a message, the signer's certificate is normally included; | ||
| 6524 | with this option it is excluded. | ||
| 6525 | This will reduce the size of the signed message but the verifier must | ||
| 6526 | have a copy of the signer's certificate available locally (passed using the | ||
| 6527 | .Fl certfile | ||
| 6528 | option, for example). | ||
| 6529 | .It Fl nochain | ||
| 6530 | Do not do chain verification of signers' certificates: that is, | ||
| 6531 | don't use the certificates in the signed message as untrusted CAs. | ||
| 6532 | .It Fl nodetach | ||
| 6533 | When signing a message use opaque signing: this form is more resistant | ||
| 6534 | to translation by mail relays but it cannot be read by mail agents that | ||
| 6535 | do not support | ||
| 6536 | .Em S/MIME . | ||
| 6537 | Without this option cleartext signing with the | ||
| 6538 | .Em MIME | ||
| 6539 | type multipart/signed is used. | ||
| 6540 | .It Fl nointern | ||
| 6541 | When verifying a message, normally certificates | ||
| 6542 | .Pq if any | ||
| 6543 | included in the message are searched for the signing certificate. | ||
| 6544 | With this option, only the certificates specified in the | ||
| 6545 | .Fl certfile | ||
| 6546 | option are used. | ||
| 6547 | The supplied certificates can still be used as untrusted CAs however. | ||
| 6548 | .It Fl nosigs | ||
| 6549 | Don't try to verify the signatures on the message. | ||
| 6550 | .It Fl noverify | ||
| 6551 | Do not verify the signer's certificate of a signed message. | ||
| 6552 | .It Fl out Ar file | ||
| 6553 | The message text that has been decrypted or verified, or the output | ||
| 6554 | .Em MIME | ||
| 6555 | format message that has been signed or verified. | ||
| 6556 | .It Fl outform Ar DER | PEM | SMIME | ||
| 6557 | This specifies the output format for the PKCS#7 structure. | ||
| 6558 | The default is | ||
| 6559 | .Em SMIME , | ||
| 6560 | which writes an | ||
| 6561 | .Em S/MIME | ||
| 6562 | format message. | ||
| 6563 | .Ar PEM | ||
| 6564 | and | ||
| 6565 | .Ar DER | ||
| 6566 | format change this to write PEM and DER format PKCS#7 structures | ||
| 6567 | instead. | ||
| 6568 | This currently only affects the output format of the PKCS#7 | ||
| 6569 | structure; if no PKCS#7 structure is being output (for example with | ||
| 6570 | .Fl verify | ||
| 6571 | or | ||
| 6572 | .Fl decrypt ) | ||
| 6573 | this option has no effect. | ||
| 6574 | .It Fl passin Ar arg | ||
| 6575 | The private key password source. | ||
| 6576 | For more information about the format of | ||
| 6577 | .Ar arg , | ||
| 6578 | see the | ||
| 6579 | .Sx PASS PHRASE ARGUMENTS | ||
| 6580 | section above. | ||
| 6581 | .It Fl rand Ar file ... | ||
| 6582 | A file or files | ||
| 6583 | containing random data used to seed the random number generator, | ||
| 6584 | or an EGD socket (see | ||
| 6585 | .Xr RAND_egd 3 ) . | ||
| 6586 | Multiple files can be specified separated by a | ||
| 6587 | .Sq \&: . | ||
| 6588 | .It Fl recip Ar file | ||
| 6589 | The recipients certificate when decrypting a message. | ||
| 6590 | This certificate | ||
| 6591 | must match one of the recipients of the message or an error occurs. | ||
| 6592 | .It Fl signer Ar file | ||
| 6593 | The signer's certificate when signing a message. | ||
| 6594 | If a message is being verified, the signer's certificates will be | ||
| 6595 | written to this file if the verification was successful. | ||
| 6596 | .It Fl text | ||
| 6597 | This option adds plain text | ||
| 6598 | .Pq text/plain | ||
| 6599 | .Em MIME | ||
| 6600 | headers to the supplied message if encrypting or signing. | ||
| 6601 | If decrypting or verifying, it strips off text headers: | ||
| 6602 | if the decrypted or verified message is not of | ||
| 6603 | .Em MIME | ||
| 6604 | type text/plain then an error occurs. | ||
| 6605 | .El | ||
| 6606 | .Sh SMIME NOTES | ||
| 6607 | The | ||
| 6608 | .Em MIME | ||
| 6609 | message must be sent without any blank lines between the | ||
| 6610 | headers and the output. | ||
| 6611 | Some mail programs will automatically add a blank line. | ||
| 6612 | Piping the mail directly to sendmail is one way to | ||
| 6613 | achieve the correct format. | ||
| 6614 | .Pp | ||
| 6615 | The supplied message to be signed or encrypted must include the | ||
| 6616 | necessary | ||
| 6617 | .Em MIME | ||
| 6618 | headers or many | ||
| 6619 | .Em S/MIME | ||
| 6620 | clients won't display it properly | ||
| 6621 | .Pq if at all . | ||
| 6622 | You can use the | ||
| 6623 | .Fl text | ||
| 6624 | option to automatically add plain text headers. | ||
| 6625 | .Pp | ||
| 6626 | A | ||
| 6627 | .Qq signed and encrypted | ||
| 6628 | message is one where a signed message is then encrypted. | ||
| 6629 | This can be produced by encrypting an already signed message: | ||
| 6630 | see the | ||
| 6631 | .Sx SMIME EXAMPLES | ||
| 6632 | section. | ||
| 6633 | .Pp | ||
| 6634 | This version of the program only allows one signer per message, but it | ||
| 6635 | will verify multiple signers on received messages. | ||
| 6636 | Some | ||
| 6637 | .Em S/MIME | ||
| 6638 | clients choke if a message contains multiple signers. | ||
| 6639 | It is possible to sign messages | ||
| 6640 | .Qq in parallel | ||
| 6641 | by signing an already signed message. | ||
| 6642 | .Pp | ||
| 6643 | The options | ||
| 6644 | .Fl encrypt | ||
| 6645 | and | ||
| 6646 | .Fl decrypt | ||
| 6647 | reflect common usage in | ||
| 6648 | .Em S/MIME | ||
| 6649 | clients. | ||
| 6650 | Strictly speaking these process PKCS#7 enveloped data: PKCS#7 | ||
| 6651 | encrypted data is used for other purposes. | ||
| 6652 | .Sh SMIME EXIT CODES | ||
| 6653 | .Bl -tag -width "XXXX" | ||
| 6654 | .It Ar 0 | ||
| 6655 | The operation was completely successful. | ||
| 6656 | .It Ar 1 | ||
| 6657 | An error occurred parsing the command options. | ||
| 6658 | .It Ar 2 | ||
| 6659 | One of the input files could not be read. | ||
| 6660 | .It Ar 3 | ||
| 6661 | An error occurred creating the PKCS#7 file or when reading the | ||
| 6662 | .Em MIME | ||
| 6663 | message. | ||
| 6664 | .It Ar 4 | ||
| 6665 | An error occurred decrypting or verifying the message. | ||
| 6666 | .It Ar 5 | ||
| 6667 | The message was verified correctly, but an error occurred writing out | ||
| 6668 | the signer's certificates. | ||
| 6669 | .El | ||
| 6670 | .Sh SMIME EXAMPLES | ||
| 6671 | Create a cleartext signed message: | ||
| 6672 | .Bd -literal -offset indent | ||
| 6673 | $ openssl smime -sign -in message.txt -text -out mail.msg \e | ||
| 6674 | -signer mycert.pem | ||
| 6675 | .Ed | ||
| 6676 | .Pp | ||
| 6677 | Create an opaque signed message: | ||
| 6678 | .Bd -literal -offset indent | ||
| 6679 | $ openssl smime -sign -in message.txt -text -out mail.msg \e | ||
| 6680 | -nodetach -signer mycert.pem | ||
| 6681 | .Ed | ||
| 6682 | .Pp | ||
| 6683 | Create a signed message, include some additional certificates and | ||
| 6684 | read the private key from another file: | ||
| 6685 | .Bd -literal -offset indent | ||
| 6686 | $ openssl smime -sign -in in.txt -text -out mail.msg \e | ||
| 6687 | -signer mycert.pem -inkey mykey.pem -certfile mycerts.pem | ||
| 6688 | .Ed | ||
| 6689 | .Pp | ||
| 6690 | Send a signed message under | ||
| 6691 | .Ux | ||
| 6692 | directly to | ||
| 6693 | .Xr sendmail 8 , | ||
| 6694 | including headers: | ||
| 6695 | .Bd -literal -offset indent | ||
| 6696 | $ openssl smime -sign -in in.txt -text -signer mycert.pem \e | ||
| 6697 | -from steve@openssl.org -to someone@somewhere \e | ||
| 6698 | -subject "Signed message" | sendmail someone@somewhere | ||
| 6699 | .Ed | ||
| 6700 | .Pp | ||
| 6701 | Verify a message and extract the signer's certificate if successful: | ||
| 6702 | .Bd -literal -offset indent | ||
| 6703 | $ openssl smime -verify -in mail.msg -signer user.pem \e | ||
| 6704 | -out signedtext.txt | ||
| 6705 | .Ed | ||
| 6706 | .Pp | ||
| 6707 | Send encrypted mail using triple DES: | ||
| 6708 | .Bd -literal -offset indent | ||
| 6709 | $ openssl smime -encrypt -in in.txt -from steve@openssl.org \e | ||
| 6710 | -to someone@somewhere -subject "Encrypted message" \e | ||
| 6711 | -des3 -out mail.msg user.pem | ||
| 6712 | .Ed | ||
| 6713 | .Pp | ||
| 6714 | Sign and encrypt mail: | ||
| 6715 | .Bd -literal -offset indent | ||
| 6716 | $ openssl smime -sign -in ml.txt -signer my.pem -text | \e | ||
| 6717 | openssl smime -encrypt -out mail.msg \e | ||
| 6718 | -from steve@openssl.org -to someone@somewhere \e | ||
| 6719 | -subject "Signed and Encrypted message" -des3 user.pem | ||
| 6720 | .Ed | ||
| 6721 | .Pp | ||
| 6722 | .Sy Note : | ||
| 6723 | The encryption command does not include the | ||
| 6724 | .Fl text | ||
| 6725 | option because the message being encrypted already has | ||
| 6726 | .Em MIME | ||
| 6727 | headers. | ||
| 6728 | .Pp | ||
| 6729 | Decrypt mail: | ||
| 6730 | .Bd -literal -offset indent | ||
| 6731 | $ openssl smime -decrypt -in mail.msg -recip mycert.pem \e | ||
| 6732 | -inkey key.pem" | ||
| 6733 | .Ed | ||
| 6734 | .Pp | ||
| 6735 | The output from Netscape form signing is a PKCS#7 structure with the | ||
| 6736 | detached signature format. | ||
| 6737 | You can use this program to verify the signature by line wrapping the | ||
| 6738 | base64-encoded structure and surrounding it with: | ||
| 6739 | .Bd -unfilled -offset indent | ||
| 6740 | -----BEGIN PKCS7----- | ||
| 6741 | -----END PKCS7----- | ||
| 6742 | .Ed | ||
| 6743 | .Pp | ||
| 6744 | and using the command: | ||
| 6745 | .Bd -literal -offset indent | ||
| 6746 | $ openssl smime -verify -inform PEM -in signature.pem \e | ||
| 6747 | -content content.txt | ||
| 6748 | .Ed | ||
| 6749 | .Pp | ||
| 6750 | Alternatively, you can base64 decode the signature and use: | ||
| 6751 | .Bd -literal -offset indent | ||
| 6752 | $ openssl smime -verify -inform DER -in signature.der \e | ||
| 6753 | -content content.txt | ||
| 6754 | .Ed | ||
| 6755 | .Sh SMIME BUGS | ||
| 6756 | The | ||
| 6757 | .Em MIME | ||
| 6758 | parser isn't very clever: it seems to handle most messages that I've thrown | ||
| 6759 | at it, but it may choke on others. | ||
| 6760 | .Pp | ||
| 6761 | The code currently will only write out the signer's certificate to a file: | ||
| 6762 | if the signer has a separate encryption certificate this must be manually | ||
| 6763 | extracted. | ||
| 6764 | There should be some heuristic that determines the correct encryption | ||
| 6765 | certificate. | ||
| 6766 | .Pp | ||
| 6767 | Ideally, a database should be maintained of a certificate for each email | ||
| 6768 | address. | ||
| 6769 | .Pp | ||
| 6770 | The code doesn't currently take note of the permitted symmetric encryption | ||
| 6771 | algorithms as supplied in the | ||
| 6772 | .Em SMIMECapabilities | ||
| 6773 | signed attribute. | ||
| 6774 | This means the user has to manually include the correct encryption algorithm. | ||
| 6775 | It should store the list of permitted ciphers in a database and only use those. | ||
| 6776 | .Pp | ||
| 6777 | No revocation checking is done on the signer's certificate. | ||
| 6778 | .Pp | ||
| 6779 | The current code can only handle | ||
| 6780 | .Em S/MIME | ||
| 6781 | v2 messages; the more complex | ||
| 6782 | .Em S/MIME | ||
| 6783 | v3 structures may cause parsing errors. | ||
| 6784 | .\" | ||
| 6785 | .\" SPEED | ||
| 6786 | .\" | ||
| 6787 | .Sh SPEED | ||
| 6788 | .Nm openssl speed | ||
| 6789 | .Bk -words | ||
| 6790 | .Op Cm aes | ||
| 6791 | .Op Cm aes-128-cbc | ||
| 6792 | .Op Cm aes-192-cbc | ||
| 6793 | .Op Cm aes-256-cbc | ||
| 6794 | .Op Cm blowfish | ||
| 6795 | .Op Cm bf-cbc | ||
| 6796 | .Op Cm cast | ||
| 6797 | .Op Cm cast-cbc | ||
| 6798 | .Op Cm des | ||
| 6799 | .Op Cm des-cbc | ||
| 6800 | .Op Cm des-ede3 | ||
| 6801 | .Op Cm dsa | ||
| 6802 | .Op Cm dsa512 | ||
| 6803 | .Op Cm dsa1024 | ||
| 6804 | .Op Cm dsa2048 | ||
| 6805 | .Op Cm hmac | ||
| 6806 | .Op Cm md2 | ||
| 6807 | .Op Cm md4 | ||
| 6808 | .Op Cm md5 | ||
| 6809 | .Op Cm rc2 | ||
| 6810 | .Op Cm rc2-cbc | ||
| 6811 | .Op Cm rc4 | ||
| 6812 | .Op Cm rmd160 | ||
| 6813 | .Op Cm rsa | ||
| 6814 | .Op Cm rsa512 | ||
| 6815 | .Op Cm rsa1024 | ||
| 6816 | .Op Cm rsa2048 | ||
| 6817 | .Op Cm rsa4096 | ||
| 6818 | .Op Cm sha1 | ||
| 6819 | .Op Fl decrypt | ||
| 6820 | .Op Fl elapsed | ||
| 6821 | .Op Fl mr | ||
| 6822 | .Op Fl engine Ar id | ||
| 6823 | .Op Fl evp Ar e | ||
| 6824 | .Op Fl multi Ar number | ||
| 6825 | .Ek | ||
| 6826 | .Pp | ||
| 6827 | The | ||
| 6828 | .Nm speed | ||
| 6829 | command is used to test the performance of cryptographic algorithms. | ||
| 6830 | .Bl -tag -width "XXXX" | ||
| 6831 | .It Bq Cm zero or more test algorithms | ||
| 6832 | If any options are given, | ||
| 6833 | .Nm speed | ||
| 6834 | tests those algorithms, otherwise all of the above are tested. | ||
| 6835 | .It Fl decrypt | ||
| 6836 | Time decryption instead of encryption | ||
| 6837 | .Pq only EVP . | ||
| 6838 | .It Fl engine Ar id | ||
| 6839 | Specifying an engine (by it's unique | ||
| 6840 | .Ar id | ||
| 6841 | string) will cause | ||
| 6842 | .Nm speed | ||
| 6843 | to attempt to obtain a functional reference to the specified engine, | ||
| 6844 | thus initialising it if needed. | ||
| 6845 | The engine will then be set as the default | ||
| 6846 | for all available algorithms. | ||
| 6847 | .It Fl elapsed | ||
| 6848 | Measure time in real time instead of CPU user time. | ||
| 6849 | .It Fl evp Ar e | ||
| 6850 | Use EVP | ||
| 6851 | .Ar e . | ||
| 6852 | .It Fl mr | ||
| 6853 | Produce machine readable output. | ||
| 6854 | .It Fl multi Ar number | ||
| 6855 | Run | ||
| 6856 | .Ar number | ||
| 6857 | benchmarks in parallel. | ||
| 6858 | .El | ||
| 6859 | .\" | ||
| 6860 | .\" SPKAC | ||
| 6861 | .\" | ||
| 6862 | .Sh SPKAC | ||
| 6863 | .Nm openssl spkac | ||
| 6864 | .Bk -words | ||
| 6865 | .Op Fl noout | ||
| 6866 | .Op Fl pubkey | ||
| 6867 | .Op Fl verify | ||
| 6868 | .Op Fl challenge Ar string | ||
| 6869 | .Op Fl engine Ar id | ||
| 6870 | .Op Fl in Ar file | ||
| 6871 | .Op Fl key Ar keyfile | ||
| 6872 | .Op Fl out Ar file | ||
| 6873 | .Op Fl passin Ar arg | ||
| 6874 | .Op Fl spkac Ar spkacname | ||
| 6875 | .Op Fl spksect Ar section | ||
| 6876 | .Ek | ||
| 6877 | .Pp | ||
| 6878 | The | ||
| 6879 | .Nm spkac | ||
| 6880 | command processes Netscape signed public key and challenge | ||
| 6881 | .Pq SPKAC | ||
| 6882 | files. | ||
| 6883 | It can print out their contents, verify the signature, | ||
| 6884 | and produce its own SPKACs from a supplied private key. | ||
| 6885 | .Pp | ||
| 6886 | The options are as follows: | ||
| 6887 | .Bl -tag -width "XXXX" | ||
| 6888 | .It Fl challenge Ar string | ||
| 6889 | Specifies the challenge string if an SPKAC is being created. | ||
| 6890 | .It Fl engine Ar id | ||
| 6891 | Specifying an engine (by it's unique | ||
| 6892 | .Ar id | ||
| 6893 | string) will cause | ||
| 6894 | .Nm spkac | ||
| 6895 | to attempt to obtain a functional reference to the specified engine, | ||
| 6896 | thus initialising it if needed. | ||
| 6897 | The engine will then be set as the default for all available algorithms. | ||
| 6898 | .It Fl in Ar file | ||
| 6899 | This specifies the input | ||
| 6900 | .Ar file | ||
| 6901 | to read from, or standard input if this option is not specified. | ||
| 6902 | Ignored if the | ||
| 6903 | .Fl key | ||
| 6904 | option is used. | ||
| 6905 | .It Fl key Ar keyfile | ||
| 6906 | Create an SPKAC file using the private key in | ||
| 6907 | .Ar keyfile . | ||
| 6908 | The | ||
| 6909 | .Fl in , noout , spksect , | ||
| 6910 | and | ||
| 6911 | .Fl verify | ||
| 6912 | options are ignored if present. | ||
| 6913 | .It Fl noout | ||
| 6914 | Don't output the text version of the SPKAC | ||
| 6915 | .Pq not used if an SPKAC is being created . | ||
| 6916 | .It Fl out Ar file | ||
| 6917 | Specifies the output | ||
| 6918 | .Ar file | ||
| 6919 | to write to, or standard output by default. | ||
| 6920 | .It Fl passin Ar arg | ||
| 6921 | The input file password source. | ||
| 6922 | For more information about the format of | ||
| 6923 | .Ar arg , | ||
| 6924 | see the | ||
| 6925 | .Sx PASS PHRASE ARGUMENTS | ||
| 6926 | section above. | ||
| 6927 | .It Fl pubkey | ||
| 6928 | Output the public key of an SPKAC | ||
| 6929 | .Pq not used if an SPKAC is being created . | ||
| 6930 | .It Fl spkac Ar spkacname | ||
| 6931 | Allows an alternative name for the variable containing the SPKAC. | ||
| 6932 | The default is "SPKAC". | ||
| 6933 | This option affects both generated and input SPKAC files. | ||
| 6934 | .It Fl spksect Ar section | ||
| 6935 | Allows an alternative name for the | ||
| 6936 | .Ar section | ||
| 6937 | containing the SPKAC. | ||
| 6938 | The default is the default section. | ||
| 6939 | .It Fl verify | ||
| 6940 | Verifies the digital signature on the supplied SPKAC. | ||
| 6941 | .El | ||
| 6942 | .Sh SPKAC EXAMPLES | ||
| 6943 | Print out the contents of an SPKAC: | ||
| 6944 | .Pp | ||
| 6945 | .Dl $ openssl spkac -in spkac.cnf | ||
| 6946 | .Pp | ||
| 6947 | Verify the signature of an SPKAC: | ||
| 6948 | .Pp | ||
| 6949 | .Dl $ openssl spkac -in spkac.cnf -noout -verify | ||
| 6950 | .Pp | ||
| 6951 | Create an SPKAC using the challenge string | ||
| 6952 | .Qq hello : | ||
| 6953 | .Pp | ||
| 6954 | .Dl $ openssl spkac -key key.pem -challenge hello -out spkac.cnf | ||
| 6955 | .Pp | ||
| 6956 | Example of an SPKAC, | ||
| 6957 | .Pq long lines split up for clarity : | ||
| 6958 | .Bd -unfilled -offset indent | ||
| 6959 | SPKAC=MIG5MGUwXDANBgkqhkiG9w0BAQEFAANLADBIAkEA1cCoq2Wa3Ixs47uI7F\e | ||
| 6960 | PVwHVIPDx5yso105Y6zpozam135a8R0CpoRvkkigIyXfcCjiVi5oWk+6FfPaD03u\e | ||
| 6961 | PFoQIDAQABFgVoZWxsbzANBgkqhkiG9w0BAQQFAANBAFpQtY/FojdwkJh1bEIYuc\e | ||
| 6962 | 2EeM2KHTWPEepWYeawvHD0gQ3DngSC75YCWnnDdq+NQ3F+X4deMx9AaEglZtULwV\e | ||
| 6963 | 4= | ||
| 6964 | .Ed | ||
| 6965 | .Sh SPKAC NOTES | ||
| 6966 | A created SPKAC with suitable DN components appended can be fed into | ||
| 6967 | the | ||
| 6968 | .Nm ca | ||
| 6969 | utility. | ||
| 6970 | .Pp | ||
| 6971 | SPKACs are typically generated by Netscape when a form is submitted | ||
| 6972 | containing the | ||
| 6973 | .Em KEYGEN | ||
| 6974 | tag as part of the certificate enrollment process. | ||
| 6975 | .Pp | ||
| 6976 | The challenge string permits a primitive form of proof of possession | ||
| 6977 | of private key. | ||
| 6978 | By checking the SPKAC signature and a random challenge | ||
| 6979 | string, some guarantee is given that the user knows the private key | ||
| 6980 | corresponding to the public key being certified. | ||
| 6981 | This is important in some applications. | ||
| 6982 | Without this it is possible for a previous SPKAC | ||
| 6983 | to be used in a | ||
| 6984 | .Qq replay attack . | ||
| 6985 | .\" | ||
| 6986 | .\" VERIFY | ||
| 6987 | .\" | ||
| 6988 | .Sh VERIFY | ||
| 6989 | .Nm openssl verify | ||
| 6990 | .Bk -words | ||
| 6991 | .Op Fl crl_check | ||
| 6992 | .Op Fl help | ||
| 6993 | .Op Fl issuer_checks | ||
| 6994 | .Op Fl verbose | ||
| 6995 | .Op Fl CAfile Ar file | ||
| 6996 | .Op Fl CApath Ar directory | ||
| 6997 | .Op Fl engine Ar id | ||
| 6998 | .Op Fl purpose Ar purpose | ||
| 6999 | .Op Fl untrusted Ar file | ||
| 7000 | .Op Fl | ||
| 7001 | .Op Ar certificates | ||
| 7002 | .Ek | ||
| 7003 | .Pp | ||
| 7004 | The | ||
| 7005 | .Nm verify | ||
| 7006 | command verifies certificate chains. | ||
| 7007 | .Pp | ||
| 7008 | The options are as follows: | ||
| 7009 | .Bl -tag -width "XXXX" | ||
| 7010 | .It Fl CApath Ar directory | ||
| 7011 | A | ||
| 7012 | .Ar directory | ||
| 7013 | of trusted certificates. | ||
| 7014 | The certificates should have names of the form | ||
| 7015 | .Em hash.0 , | ||
| 7016 | or have symbolic links to them of this form | ||
| 7017 | ("hash" is the hashed certificate subject name: see the | ||
| 7018 | .Fl hash | ||
| 7019 | option of the | ||
| 7020 | .Nm x509 | ||
| 7021 | utility). | ||
| 7022 | Under | ||
| 7023 | .Ux , | ||
| 7024 | the | ||
| 7025 | .Nm c_rehash | ||
| 7026 | script will automatically create symbolic links to a directory of certificates. | ||
| 7027 | .It Fl CAfile Ar file | ||
| 7028 | A | ||
| 7029 | .Ar file | ||
| 7030 | of trusted certificates. | ||
| 7031 | The | ||
| 7032 | .Ar file | ||
| 7033 | should contain multiple certificates in PEM format, concatenated together. | ||
| 7034 | .It Fl untrusted Ar file | ||
| 7035 | A | ||
| 7036 | .Ar file | ||
| 7037 | of untrusted certificates. | ||
| 7038 | The | ||
| 7039 | .Ar file | ||
| 7040 | should contain multiple certificates. | ||
| 7041 | .It Fl purpose Ar purpose | ||
| 7042 | The intended use for the certificate. | ||
| 7043 | Without this option no chain verification will be done. | ||
| 7044 | Currently accepted uses are | ||
| 7045 | .Ar sslclient , sslserver , | ||
| 7046 | .Ar nssslserver , smimesign , | ||
| 7047 | .Ar smimeencrypt , crlsign , | ||
| 7048 | .Ar any , | ||
| 7049 | and | ||
| 7050 | .Ar ocsphelper . | ||
| 7051 | See the | ||
| 7052 | .Sx VERIFY OPERATION | ||
| 7053 | section for more information. | ||
| 7054 | .It Fl help | ||
| 7055 | Prints out a usage message. | ||
| 7056 | .It Fl verbose | ||
| 7057 | Print extra information about the operations being performed. | ||
| 7058 | .It Fl issuer_checks | ||
| 7059 | Print out diagnostics relating to searches for the issuer certificate | ||
| 7060 | of the current certificate. | ||
| 7061 | This shows why each candidate issuer certificate was rejected. | ||
| 7062 | However the presence of rejection messages | ||
| 7063 | does not itself imply that anything is wrong: during the normal | ||
| 7064 | verify process several rejections may take place. | ||
| 7065 | .It Fl crl_check | ||
| 7066 | Check revocation status of signer's certificate using CRLs. | ||
| 7067 | .It Fl engine Ar id | ||
| 7068 | Specifying an engine (by it's unique | ||
| 7069 | .Ar id | ||
| 7070 | string) will cause | ||
| 7071 | .Nm verify | ||
| 7072 | to attempt to obtain a functional reference to the specified engine, | ||
| 7073 | thus initialising it if needed. | ||
| 7074 | The engine will then be set as the default for all available algorithms. | ||
| 7075 | .It Fl | ||
| 7076 | Marks the last option. | ||
| 7077 | All arguments following this are assumed to be certificate files. | ||
| 7078 | This is useful if the first certificate filename begins with a | ||
| 7079 | .Sq - . | ||
| 7080 | .It Ar certificates | ||
| 7081 | One or more | ||
| 7082 | .Ar certificates | ||
| 7083 | to verify. | ||
| 7084 | If no certificate files are included, an attempt is made to read | ||
| 7085 | a certificate from standard input. | ||
| 7086 | They should all be in PEM format. | ||
| 7087 | .El | ||
| 7088 | .Sh VERIFY OPERATION | ||
| 7089 | The | ||
| 7090 | .Nm verify | ||
| 7091 | program uses the same functions as the internal SSL and S/MIME verification, | ||
| 7092 | therefore this description applies to these verify operations too. | ||
| 7093 | .Pp | ||
| 7094 | There is one crucial difference between the verify operations performed | ||
| 7095 | by the | ||
| 7096 | .Nm verify | ||
| 7097 | program: wherever possible an attempt is made to continue | ||
| 7098 | after an error, whereas normally the verify operation would halt on the | ||
| 7099 | first error. | ||
| 7100 | This allows all the problems with a certificate chain to be determined. | ||
| 7101 | .Pp | ||
| 7102 | The verify operation consists of a number of separate steps: | ||
| 7103 | .Pp | ||
| 7104 | Firstly a certificate chain is built up starting from the supplied certificate | ||
| 7105 | and ending in the root CA. | ||
| 7106 | It is an error if the whole chain cannot be built up. | ||
| 7107 | The chain is built up by looking up the issuer's certificate of the current | ||
| 7108 | certificate. | ||
| 7109 | If a certificate is found which is its own issuer, it is assumed | ||
| 7110 | to be the root CA. | ||
| 7111 | .Pp | ||
| 7112 | The process of | ||
| 7113 | .Qq looking up the issuer's certificate | ||
| 7114 | itself involves a number of steps. | ||
| 7115 | In versions of | ||
| 7116 | .Nm OpenSSL | ||
| 7117 | before 0.9.5a the first certificate whose subject name matched the issuer | ||
| 7118 | of the current certificate was assumed to be the issuer's certificate. | ||
| 7119 | In | ||
| 7120 | .Nm OpenSSL | ||
| 7121 | 0.9.6 and later all certificates whose subject name matches the issuer name | ||
| 7122 | of the current certificate are subject to further tests. | ||
| 7123 | The relevant authority key identifier components of the current certificate | ||
| 7124 | .Pq if present | ||
| 7125 | must match the subject key identifier | ||
| 7126 | .Pq if present | ||
| 7127 | and issuer and serial number of the candidate issuer; in addition the | ||
| 7128 | .Em keyUsage | ||
| 7129 | extension of the candidate issuer | ||
| 7130 | .Pq if present | ||
| 7131 | must permit certificate signing. | ||
| 7132 | .Pp | ||
| 7133 | The lookup first looks in the list of untrusted certificates and if no match | ||
| 7134 | is found the remaining lookups are from the trusted certificates. | ||
| 7135 | The root CA is always looked up in the trusted certificate list: if the | ||
| 7136 | certificate to verify is a root certificate, then an exact match must be | ||
| 7137 | found in the trusted list. | ||
| 7138 | .Pp | ||
| 7139 | The second operation is to check every untrusted certificate's extensions for | ||
| 7140 | consistency with the supplied purpose. | ||
| 7141 | If the | ||
| 7142 | .Fl purpose | ||
| 7143 | option is not included, then no checks are done. | ||
| 7144 | The supplied or | ||
| 7145 | .Qq leaf | ||
| 7146 | certificate must have extensions compatible with the supplied purpose | ||
| 7147 | and all other certificates must also be valid CA certificates. | ||
| 7148 | The precise extensions required are described in more detail in | ||
| 7149 | the | ||
| 7150 | .Sx X509 CERTIFICATE EXTENSIONS | ||
| 7151 | section below. | ||
| 7152 | .Pp | ||
| 7153 | The third operation is to check the trust settings on the root CA. | ||
| 7154 | The root CA should be trusted for the supplied purpose. | ||
| 7155 | For compatibility with previous versions of | ||
| 7156 | .Nm SSLeay | ||
| 7157 | and | ||
| 7158 | .Nm OpenSSL , | ||
| 7159 | a certificate with no trust settings is considered to be valid for | ||
| 7160 | all purposes. | ||
| 7161 | .Pp | ||
| 7162 | The final operation is to check the validity of the certificate chain. | ||
| 7163 | The validity period is checked against the current system time and the | ||
| 7164 | .Em notBefore | ||
| 7165 | and | ||
| 7166 | .Em notAfter | ||
| 7167 | dates in the certificate. | ||
| 7168 | The certificate signatures are also checked at this point. | ||
| 7169 | .Pp | ||
| 7170 | If all operations complete successfully, the certificate is considered | ||
| 7171 | valid. | ||
| 7172 | If any operation fails then the certificate is not valid. | ||
| 7173 | .Sh VERIFY DIAGNOSTICS | ||
| 7174 | When a verify operation fails, the output messages can be somewhat cryptic. | ||
| 7175 | The general form of the error message is: | ||
| 7176 | .Bd -unfilled | ||
| 7177 | \& server.pem: /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test CA (1024-bit) | ||
| 7178 | \& error 24 at 1 depth lookup:invalid CA certificate | ||
| 7179 | .Ed | ||
| 7180 | .Pp | ||
| 7181 | The first line contains the name of the certificate being verified, followed by | ||
| 7182 | the subject name of the certificate. | ||
| 7183 | The second line contains the error number and the depth. | ||
| 7184 | The depth is the number of the certificate being verified when a | ||
| 7185 | problem was detected starting with zero for the certificate being verified | ||
| 7186 | itself, then 1 for the CA that signed the certificate and so on. | ||
| 7187 | Finally a text version of the error number is presented. | ||
| 7188 | .Pp | ||
| 7189 | An exhaustive list of the error codes and messages is shown below; this also | ||
| 7190 | includes the name of the error code as defined in the header file | ||
| 7191 | .Aq Pa openssl/x509_vfy.h . | ||
| 7192 | Some of the error codes are defined but never returned: these are described | ||
| 7193 | as | ||
| 7194 | .Qq unused . | ||
| 7195 | .Bl -tag -width "XXXX" | ||
| 7196 | .It Ar "0 X509_V_OK: ok" | ||
| 7197 | The operation was successful. | ||
| 7198 | .It Ar 2 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: unable to get issuer certificate | ||
| 7199 | The issuer certificate could not be found: this occurs if the issuer certificate | ||
| 7200 | of an untrusted certificate cannot be found. | ||
| 7201 | .It Ar 3 X509_V_ERR_UNABLE_TO_GET_CRL: unable to get certificate CRL | ||
| 7202 | The CRL of a certificate could not be found. | ||
| 7203 | Unused. | ||
| 7204 | .It Ar 4 X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE: unable to decrypt certificate's signature | ||
| 7205 | The certificate signature could not be decrypted. | ||
| 7206 | This means that the actual signature value could not be determined rather | ||
| 7207 | than it not matching the expected value. | ||
| 7208 | This is only meaningful for RSA keys. | ||
| 7209 | .It Ar 5 X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE: unable to decrypt CRL's signature | ||
| 7210 | The CRL signature could not be decrypted: this means that the actual | ||
| 7211 | signature value could not be determined rather than it not matching the | ||
| 7212 | expected value. | ||
| 7213 | Unused. | ||
| 7214 | .It Ar 6 X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY: unable to decode issuer public key | ||
| 7215 | The public key in the certificate | ||
| 7216 | .Em SubjectPublicKeyInfo | ||
| 7217 | could not be read. | ||
| 7218 | .It Ar 7 X509_V_ERR_CERT_SIGNATURE_FAILURE: certificate signature failure | ||
| 7219 | The signature of the certificate is invalid. | ||
| 7220 | .It Ar 8 X509_V_ERR_CRL_SIGNATURE_FAILURE: CRL signature failure | ||
| 7221 | The signature of the certificate is invalid. | ||
| 7222 | Unused. | ||
| 7223 | .It Ar 9 X509_V_ERR_CERT_NOT_YET_VALID: certificate is not yet valid | ||
| 7224 | The certificate is not yet valid: the | ||
| 7225 | .Em notBefore | ||
| 7226 | date is after the current time. | ||
| 7227 | .It Ar 10 X509_V_ERR_CERT_HAS_EXPIRED: certificate has expired | ||
| 7228 | The certificate has expired; that is, the | ||
| 7229 | .Em notAfter | ||
| 7230 | date is before the current time. | ||
| 7231 | .It Ar 11 X509_V_ERR_CRL_NOT_YET_VALID: CRL is not yet valid | ||
| 7232 | The CRL is not yet valid. | ||
| 7233 | Unused. | ||
| 7234 | .It Ar 12 X509_V_ERR_CRL_HAS_EXPIRED: CRL has expired | ||
| 7235 | The CRL has expired. | ||
| 7236 | Unused. | ||
| 7237 | .It Ar 13 X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: format error in certificate's notBefore field | ||
| 7238 | The certificate | ||
| 7239 | .Em notBefore | ||
| 7240 | field contains an invalid time. | ||
| 7241 | .It Ar 14 X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: format error in certificate's notAfter field | ||
| 7242 | The certificate | ||
| 7243 | .Em notAfter | ||
| 7244 | field contains an invalid time. | ||
| 7245 | .It Ar 15 X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD: format error in CRL's lastUpdate field | ||
| 7246 | The CRL | ||
| 7247 | .Em lastUpdate | ||
| 7248 | field contains an invalid time. | ||
| 7249 | Unused. | ||
| 7250 | .It Ar 16 X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD: format error in CRL's nextUpdate field | ||
| 7251 | The CRL | ||
| 7252 | .Em nextUpdate | ||
| 7253 | field contains an invalid time. | ||
| 7254 | Unused. | ||
| 7255 | .It Ar 17 X509_V_ERR_OUT_OF_MEM: out of memory | ||
| 7256 | An error occurred trying to allocate memory. | ||
| 7257 | This should never happen. | ||
| 7258 | .It Ar 18 X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: self signed certificate | ||
| 7259 | The passed certificate is self-signed and the same certificate cannot be | ||
| 7260 | found in the list of trusted certificates. | ||
| 7261 | .It Ar 19 X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN: self signed certificate in certificate chain | ||
| 7262 | The certificate chain could be built up using the untrusted certificates but | ||
| 7263 | the root could not be found locally. | ||
| 7264 | .It Ar 20 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY: unable to get local issuer certificate | ||
| 7265 | The issuer certificate of a locally looked up certificate could not be found. | ||
| 7266 | This normally means the list of trusted certificates is not complete. | ||
| 7267 | .It Ar 21 X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE: unable to verify the first certificate | ||
| 7268 | No signatures could be verified because the chain contains only one | ||
| 7269 | certificate and it is not self-signed. | ||
| 7270 | .It Ar 22 X509_V_ERR_CERT_CHAIN_TOO_LONG: certificate chain too long | ||
| 7271 | The certificate chain length is greater than the supplied maximum depth. | ||
| 7272 | Unused. | ||
| 7273 | .It Ar 23 X509_V_ERR_CERT_REVOKED: certificate revoked | ||
| 7274 | The certificate has been revoked. | ||
| 7275 | Unused. | ||
| 7276 | .It Ar 24 X509_V_ERR_INVALID_CA: invalid CA certificate | ||
| 7277 | A CA certificate is invalid. | ||
| 7278 | Either it is not a CA or its extensions are not consistent | ||
| 7279 | with the supplied purpose. | ||
| 7280 | .It Ar 25 X509_V_ERR_PATH_LENGTH_EXCEEDED: path length constraint exceeded | ||
| 7281 | The | ||
| 7282 | .Em basicConstraints | ||
| 7283 | pathlength parameter has been exceeded. | ||
| 7284 | .It Ar 26 X509_V_ERR_INVALID_PURPOSE: unsupported certificate purpose | ||
| 7285 | The supplied certificate cannot be used for the specified purpose. | ||
| 7286 | .It Ar 27 X509_V_ERR_CERT_UNTRUSTED: certificate not trusted | ||
| 7287 | The root CA is not marked as trusted for the specified purpose. | ||
| 7288 | .It Ar 28 X509_V_ERR_CERT_REJECTED: certificate rejected | ||
| 7289 | The root CA is marked to reject the specified purpose. | ||
| 7290 | .It Ar 29 X509_V_ERR_SUBJECT_ISSUER_MISMATCH: subject issuer mismatch | ||
| 7291 | The current candidate issuer certificate was rejected because its subject name | ||
| 7292 | did not match the issuer name of the current certificate. | ||
| 7293 | Only displayed when the | ||
| 7294 | .Fl issuer_checks | ||
| 7295 | option is set. | ||
| 7296 | .It Ar 30 X509_V_ERR_AKID_SKID_MISMATCH: authority and subject key identifier mismatch | ||
| 7297 | The current candidate issuer certificate was rejected because its subject key | ||
| 7298 | identifier was present and did not match the authority key identifier current | ||
| 7299 | certificate. | ||
| 7300 | Only displayed when the | ||
| 7301 | .Fl issuer_checks | ||
| 7302 | option is set. | ||
| 7303 | .It Ar 31 X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH: authority and issuer serial number mismatch | ||
| 7304 | The current candidate issuer certificate was rejected because its issuer name | ||
| 7305 | and serial number were present and did not match the authority key identifier | ||
| 7306 | of the current certificate. | ||
| 7307 | Only displayed when the | ||
| 7308 | .Fl issuer_checks | ||
| 7309 | option is set. | ||
| 7310 | .It Ar 32 X509_V_ERR_KEYUSAGE_NO_CERTSIGN:key usage does not include certificate signing | ||
| 7311 | The current candidate issuer certificate was rejected because its | ||
| 7312 | .Em keyUsage | ||
| 7313 | extension does not permit certificate signing. | ||
| 7314 | .It Ar 50 X509_V_ERR_APPLICATION_VERIFICATION: application verification failure | ||
| 7315 | An application specific error. | ||
| 7316 | Unused. | ||
| 7317 | .El | ||
| 7318 | .Sh VERIFY BUGS | ||
| 7319 | Although the issuer checks are a considerable improvement over the old | ||
| 7320 | technique, they still suffer from limitations in the underlying | ||
| 7321 | X509_LOOKUP API. | ||
| 7322 | One consequence of this is that trusted certificates with matching subject | ||
| 7323 | name must either appear in a file (as specified by the | ||
| 7324 | .Fl CAfile | ||
| 7325 | option) or a directory (as specified by | ||
| 7326 | .Fl CApath ) . | ||
| 7327 | If they occur in both, only the certificates in the file will | ||
| 7328 | be recognised. | ||
| 7329 | .Pp | ||
| 7330 | Previous versions of | ||
| 7331 | .Nm OpenSSL | ||
| 7332 | assumed certificates with matching subject name were identical and | ||
| 7333 | mishandled them. | ||
| 7334 | .\" | ||
| 7335 | .\" VERSION | ||
| 7336 | .\" | ||
| 7337 | .Sh VERSION | ||
| 7338 | .Nm openssl version | ||
| 7339 | .Op Fl abdfopv | ||
| 7340 | .Pp | ||
| 7341 | The | ||
| 7342 | .Nm version | ||
| 7343 | command is used to print out version information about | ||
| 7344 | .Nm OpenSSL . | ||
| 7345 | .Pp | ||
| 7346 | The options are as follows: | ||
| 7347 | .Bl -tag -width "XXXX" | ||
| 7348 | .It Fl a | ||
| 7349 | All information: this is the same as setting all the other flags. | ||
| 7350 | .It Fl b | ||
| 7351 | The date the current version of | ||
| 7352 | .Nm OpenSSL | ||
| 7353 | was built. | ||
| 7354 | .It Fl d | ||
| 7355 | .Ev OPENSSLDIR | ||
| 7356 | setting. | ||
| 7357 | .It Fl f | ||
| 7358 | Compilation flags. | ||
| 7359 | .It Fl o | ||
| 7360 | Option information: various options set when the library was built. | ||
| 7361 | .It Fl p | ||
| 7362 | Platform setting. | ||
| 7363 | .It Fl v | ||
| 7364 | The current | ||
| 7365 | .Nm OpenSSL | ||
| 7366 | version. | ||
| 7367 | .El | ||
| 7368 | .Sh VERSION NOTES | ||
| 7369 | The output of | ||
| 7370 | .Nm openssl version -a | ||
| 7371 | would typically be used when sending in a bug report. | ||
| 7372 | .Sh VERSION HISTORY | ||
| 7373 | The | ||
| 7374 | .Fl d | ||
| 7375 | option was added in | ||
| 7376 | .Nm OpenSSL | ||
| 7377 | 0.9.7. | ||
| 7378 | .\" | ||
| 7379 | .\" X509 | ||
| 7380 | .\" | ||
| 7381 | .Sh X509 | ||
| 7382 | .Nm openssl x509 | ||
| 7383 | .Bk -words | ||
| 7384 | .Op Fl alias | ||
| 7385 | .Op Fl C | ||
| 7386 | .Op Fl CAcreateserial | ||
| 7387 | .Op Fl clrext | ||
| 7388 | .Op Fl clrreject | ||
| 7389 | .Op Fl clrtrust | ||
| 7390 | .Op Fl dates | ||
| 7391 | .Op Fl email | ||
| 7392 | .Op Fl enddate | ||
| 7393 | .Op Fl fingerprint | ||
| 7394 | .Op Fl hash | ||
| 7395 | .Op Fl issuer | ||
| 7396 | .Op Fl md2 | md5 | sha1 | ||
| 7397 | .Op Fl modulus | ||
| 7398 | .Op Fl noout | ||
| 7399 | .Op Fl ocspid | ||
| 7400 | .Op Fl pubkey | ||
| 7401 | .Op Fl purpose | ||
| 7402 | .Op Fl req | ||
| 7403 | .Op Fl serial | ||
| 7404 | .Op Fl startdate | ||
| 7405 | .Op Fl subject | ||
| 7406 | .Op Fl text | ||
| 7407 | .Op Fl trustout | ||
| 7408 | .Op Fl x509toreq | ||
| 7409 | .Op Fl addreject Ar arg | ||
| 7410 | .Op Fl addtrust Ar arg | ||
| 7411 | .Op Fl CA Ar file | ||
| 7412 | .Op Fl CAform Ar DER | PEM | ||
| 7413 | .Op Fl CAkey Ar file | ||
| 7414 | .Op Fl CAkeyform Ar DER | PEM | ||
| 7415 | .Op Fl CAserial Ar file | ||
| 7416 | .Op Fl certopt Ar option | ||
| 7417 | .Op Fl checkend Ar arg | ||
| 7418 | .Op Fl days Ar arg | ||
| 7419 | .Op Fl engine Ar id | ||
| 7420 | .Op Fl extensions Ar section | ||
| 7421 | .Op Fl extfile Ar file | ||
| 7422 | .Op Fl in Ar file | ||
| 7423 | .Op Fl inform Ar DER | NET | PEM | ||
| 7424 | .Op Fl keyform Ar DER | PEM | ||
| 7425 | .Op Fl nameopt Ar option | ||
| 7426 | .Op Fl out Ar file | ||
| 7427 | .Op Fl outform Ar DER | NET | PEM | ||
| 7428 | .Op Fl passin Ar arg | ||
| 7429 | .Op Fl set_serial Ar n | ||
| 7430 | .Op Fl setalias Ar arg | ||
| 7431 | .Op Fl signkey Ar file | ||
| 7432 | .Ek | ||
| 7433 | .Pp | ||
| 7434 | The | ||
| 7435 | .Nm x509 | ||
| 7436 | command is a multi-purpose certificate utility. | ||
| 7437 | It can be used to display certificate information, convert certificates to | ||
| 7438 | various forms, sign certificate requests like a | ||
| 7439 | .Qq mini CA , | ||
| 7440 | or edit certificate trust settings. | ||
| 7441 | .Pp | ||
| 7442 | Since there are a large number of options, they are split up into | ||
| 7443 | various sections. | ||
| 7444 | .Sh X509 INPUT, OUTPUT, AND GENERAL PURPOSE OPTIONS | ||
| 7445 | .Bl -tag -width "XXXX" | ||
| 7446 | .It Fl engine Ar id | ||
| 7447 | Specifying an engine (by it's unique | ||
| 7448 | .Ar id | ||
| 7449 | string) will cause | ||
| 7450 | .Nm x509 | ||
| 7451 | to attempt to obtain a functional reference to the specified engine, | ||
| 7452 | thus initialising it if needed. | ||
| 7453 | The engine will then be set as the default for all available algorithms. | ||
| 7454 | .It Fl in Ar file | ||
| 7455 | This specifies the input | ||
| 7456 | .Ar file | ||
| 7457 | to read a certificate from, or standard input if this option is not specified. | ||
| 7458 | .It Fl inform Ar DER | NET | PEM | ||
| 7459 | This specifies the input format. | ||
| 7460 | Normally, the command will expect an X509 certificate, | ||
| 7461 | but this can change if other options such as | ||
| 7462 | .Fl req | ||
| 7463 | are present. | ||
| 7464 | The | ||
| 7465 | .Ar DER | ||
| 7466 | format is the DER encoding of the certificate and | ||
| 7467 | .Ar PEM | ||
| 7468 | is the base64 encoding of the DER encoding with header and footer lines added. | ||
| 7469 | The | ||
| 7470 | .Ar NET | ||
| 7471 | option is an obscure Netscape server format that is now | ||
| 7472 | obsolete. | ||
| 7473 | .It Fl md2 | md5 | sha1 | ||
| 7474 | The digest to use. | ||
| 7475 | This affects any signing or display option that uses a message digest, | ||
| 7476 | such as the | ||
| 7477 | .Fl fingerprint , signkey , | ||
| 7478 | and | ||
| 7479 | .Fl CA | ||
| 7480 | options. | ||
| 7481 | If not specified, MD5 is used. | ||
| 7482 | If the key being used to sign with is a DSA key, | ||
| 7483 | this option has no effect: SHA1 is always used with DSA keys. | ||
| 7484 | .It Fl out Ar file | ||
| 7485 | This specifies the output | ||
| 7486 | .Ar file | ||
| 7487 | to write to, or standard output by default. | ||
| 7488 | .It Fl outform Ar DER | NET | PEM | ||
| 7489 | This specifies the output format; the options have the same meaning as the | ||
| 7490 | .Fl inform | ||
| 7491 | option. | ||
| 7492 | .It Fl passin Ar arg | ||
| 7493 | The key password source. | ||
| 7494 | For more information about the format of | ||
| 7495 | .Ar arg , | ||
| 7496 | see the | ||
| 7497 | .Sx PASS PHRASE ARGUMENTS | ||
| 7498 | section above. | ||
| 7499 | .El | ||
| 7500 | .Sh X509 DISPLAY OPTIONS | ||
| 7501 | .Sy Note : | ||
| 7502 | The | ||
| 7503 | .Fl alias | ||
| 7504 | and | ||
| 7505 | .Fl purpose | ||
| 7506 | options are also display options but are described in the | ||
| 7507 | .Sx X509 TRUST SETTINGS | ||
| 7508 | section. | ||
| 7509 | .Bl -tag -width "XXXX" | ||
| 7510 | .It Fl C | ||
| 7511 | This outputs the certificate in the form of a C source file. | ||
| 7512 | .It Fl certopt Ar option | ||
| 7513 | Customise the output format used with | ||
| 7514 | .Fl text . | ||
| 7515 | The | ||
| 7516 | .Ar option | ||
| 7517 | argument can be a single option or multiple options separated by commas. | ||
| 7518 | The | ||
| 7519 | .Fl certopt | ||
| 7520 | switch may also be used more than once to set multiple options. | ||
| 7521 | See the | ||
| 7522 | .Sx X509 TEXT OPTIONS | ||
| 7523 | section for more information. | ||
| 7524 | .It Fl dates | ||
| 7525 | Prints out the start and expiry dates of a certificate. | ||
| 7526 | .It Fl email | ||
| 7527 | Outputs the email address(es), if any. | ||
| 7528 | .It Fl enddate | ||
| 7529 | Prints out the expiry date of the certificate; that is, the | ||
| 7530 | .Em notAfter | ||
| 7531 | date. | ||
| 7532 | .It Fl fingerprint | ||
| 7533 | Prints out the digest of the DER-encoded version of the whole certificate | ||
| 7534 | (see | ||
| 7535 | .Sx DIGEST OPTIONS ) . | ||
| 7536 | .It Fl hash | ||
| 7537 | Outputs the | ||
| 7538 | .Qq hash | ||
| 7539 | of the certificate subject name. | ||
| 7540 | This is used in | ||
| 7541 | .Nm OpenSSL | ||
| 7542 | to form an index to allow certificates in a directory to be looked up | ||
| 7543 | by subject name. | ||
| 7544 | .It Fl issuer | ||
| 7545 | Outputs the issuer name. | ||
| 7546 | .It Fl modulus | ||
| 7547 | This option prints out the value of the modulus of the public key | ||
| 7548 | contained in the certificate. | ||
| 7549 | .It Fl nameopt Ar option | ||
| 7550 | Option which determines how the subject or issuer names are displayed. | ||
| 7551 | The | ||
| 7552 | .Ar option | ||
| 7553 | argument can be a single option or multiple options separated by commas. | ||
| 7554 | Alternatively, the | ||
| 7555 | .Fl nameopt | ||
| 7556 | switch may be used more than once to set multiple options. | ||
| 7557 | See the | ||
| 7558 | .Sx X509 NAME OPTIONS | ||
| 7559 | section for more information. | ||
| 7560 | .It Fl noout | ||
| 7561 | This option prevents output of the encoded version of the request. | ||
| 7562 | .It Fl ocspid | ||
| 7563 | Print OCSP hash values for the subject name and public key. | ||
| 7564 | .It Fl pubkey | ||
| 7565 | Output the public key. | ||
| 7566 | .It Fl serial | ||
| 7567 | Outputs the certificate serial number. | ||
| 7568 | .It Fl startdate | ||
| 7569 | Prints out the start date of the certificate; that is, the | ||
| 7570 | .Em notBefore | ||
| 7571 | date. | ||
| 7572 | .It Fl subject | ||
| 7573 | Outputs the subject name. | ||
| 7574 | .It Fl text | ||
| 7575 | Prints out the certificate in text form. | ||
| 7576 | Full details are output including the public key, signature algorithms, | ||
| 7577 | issuer and subject names, serial number, any extensions present, | ||
| 7578 | and any trust settings. | ||
| 7579 | .El | ||
| 7580 | .Sh X509 TRUST SETTINGS | ||
| 7581 | Please note these options are currently experimental and may well change. | ||
| 7582 | .Pp | ||
| 7583 | A | ||
| 7584 | .Em trusted certificate | ||
| 7585 | is an ordinary certificate which has several | ||
| 7586 | additional pieces of information attached to it such as the permitted | ||
| 7587 | and prohibited uses of the certificate and an | ||
| 7588 | .Qq alias . | ||
| 7589 | .Pp | ||
| 7590 | Normally, when a certificate is being verified at least one certificate | ||
| 7591 | must be | ||
| 7592 | .Qq trusted . | ||
| 7593 | By default, a trusted certificate must be stored | ||
| 7594 | locally and must be a root CA: any certificate chain ending in this CA | ||
| 7595 | is then usable for any purpose. | ||
| 7596 | .Pp | ||
| 7597 | Trust settings currently are only used with a root CA. | ||
| 7598 | They allow a finer control over the purposes the root CA can be used for. | ||
| 7599 | For example, a CA may be trusted for an SSL client but not for | ||
| 7600 | SSL server use. | ||
| 7601 | .Pp | ||
| 7602 | See the description of the | ||
| 7603 | .Nm verify | ||
| 7604 | utility for more information on the meaning of trust settings. | ||
| 7605 | .Pp | ||
| 7606 | Future versions of | ||
| 7607 | .Nm OpenSSL | ||
| 7608 | will recognize trust settings on any certificate: not just root CAs. | ||
| 7609 | .Bl -tag -width "XXXX" | ||
| 7610 | .It Fl addreject Ar arg | ||
| 7611 | Adds a prohibited use. | ||
| 7612 | It accepts the same values as the | ||
| 7613 | .Fl addtrust | ||
| 7614 | option. | ||
| 7615 | .It Fl addtrust Ar arg | ||
| 7616 | Adds a trusted certificate use. | ||
| 7617 | Any object name can be used here, but currently only | ||
| 7618 | .Ar clientAuth | ||
| 7619 | .Pq SSL client use , | ||
| 7620 | .Ar serverAuth | ||
| 7621 | .Pq SSL server use , | ||
| 7622 | and | ||
| 7623 | .Ar emailProtection | ||
| 7624 | .Pq S/MIME email | ||
| 7625 | are used. | ||
| 7626 | Other | ||
| 7627 | .Nm OpenSSL | ||
| 7628 | applications may define additional uses. | ||
| 7629 | .It Fl alias | ||
| 7630 | Outputs the certificate alias, if any. | ||
| 7631 | .It Fl clrreject | ||
| 7632 | Clears all the prohibited or rejected uses of the certificate. | ||
| 7633 | .It Fl clrtrust | ||
| 7634 | Clears all the permitted or trusted uses of the certificate. | ||
| 7635 | .It Fl purpose | ||
| 7636 | This option performs tests on the certificate extensions and outputs | ||
| 7637 | the results. | ||
| 7638 | For a more complete description, see the | ||
| 7639 | .Sx X509 CERTIFICATE EXTENSIONS | ||
| 7640 | section. | ||
| 7641 | .It Fl setalias Ar arg | ||
| 7642 | Sets the alias of the certificate. | ||
| 7643 | This will allow the certificate to be referred to using a nickname, | ||
| 7644 | for example | ||
| 7645 | .Qq Steve's Certificate . | ||
| 7646 | .It Fl trustout | ||
| 7647 | This causes | ||
| 7648 | .Nm x509 | ||
| 7649 | to output a | ||
| 7650 | .Em trusted certificate . | ||
| 7651 | An ordinary or trusted certificate can be input, but by default an ordinary | ||
| 7652 | certificate is output and any trust settings are discarded. | ||
| 7653 | With the | ||
| 7654 | .Fl trustout | ||
| 7655 | option a trusted certificate is output. | ||
| 7656 | A trusted certificate is automatically output if any trust settings | ||
| 7657 | are modified. | ||
| 7658 | .El | ||
| 7659 | .Sh X509 SIGNING OPTIONS | ||
| 7660 | The | ||
| 7661 | .Nm x509 | ||
| 7662 | utility can be used to sign certificates and requests: it | ||
| 7663 | can thus behave like a | ||
| 7664 | .Qq mini CA . | ||
| 7665 | .Bl -tag -width "XXXX" | ||
| 7666 | .It Fl CA Ar file | ||
| 7667 | Specifies the CA certificate to be used for signing. | ||
| 7668 | When this option is present, | ||
| 7669 | .Nm x509 | ||
| 7670 | behaves like a | ||
| 7671 | .Qq mini CA . | ||
| 7672 | The input file is signed by the CA using this option; | ||
| 7673 | that is, its issuer name is set to the subject name of the CA and it is | ||
| 7674 | digitally signed using the CA's private key. | ||
| 7675 | .Pp | ||
| 7676 | This option is normally combined with the | ||
| 7677 | .Fl req | ||
| 7678 | option. | ||
| 7679 | Without the | ||
| 7680 | .Fl req | ||
| 7681 | option, the input is a certificate which must be self-signed. | ||
| 7682 | .It Fl CAcreateserial | ||
| 7683 | With this option the CA serial number file is created if it does not exist: | ||
| 7684 | it will contain the serial number | ||
| 7685 | .Sq 02 | ||
| 7686 | and the certificate being signed will have | ||
| 7687 | .Sq 1 | ||
| 7688 | as its serial number. | ||
| 7689 | Normally, if the | ||
| 7690 | .Fl CA | ||
| 7691 | option is specified and the serial number file does not exist, it is an error. | ||
| 7692 | .It Fl CAform Ar DER | PEM | ||
| 7693 | The format of the CA certificate file. | ||
| 7694 | The default is | ||
| 7695 | .Ar PEM . | ||
| 7696 | .It Fl CAkey Ar file | ||
| 7697 | Sets the CA private key to sign a certificate with. | ||
| 7698 | If this option is not specified, it is assumed that the CA private key | ||
| 7699 | is present in the CA certificate file. | ||
| 7700 | .It Fl CAkeyform Ar DER | PEM | ||
| 7701 | The format of the CA private key. | ||
| 7702 | The default is | ||
| 7703 | .Ar PEM . | ||
| 7704 | .It Fl CAserial Ar file | ||
| 7705 | Sets the CA serial number file to use. | ||
| 7706 | .Pp | ||
| 7707 | When the | ||
| 7708 | .Fl CA | ||
| 7709 | option is used to sign a certificate, | ||
| 7710 | it uses a serial number specified in a file. | ||
| 7711 | This file consists of one line containing an even number of hex digits | ||
| 7712 | with the serial number to use. | ||
| 7713 | After each use the serial number is incremented and written out | ||
| 7714 | to the file again. | ||
| 7715 | .Pp | ||
| 7716 | The default filename consists of the CA certificate file base name with | ||
| 7717 | .Pa .srl | ||
| 7718 | appended. | ||
| 7719 | For example, if the CA certificate file is called | ||
| 7720 | .Pa mycacert.pem , | ||
| 7721 | it expects to find a serial number file called | ||
| 7722 | .Pa mycacert.srl . | ||
| 7723 | .It Fl checkend Ar arg | ||
| 7724 | Check whether the certificate expires in the next | ||
| 7725 | .Ar arg | ||
| 7726 | seconds. | ||
| 7727 | If so, exit with return value 1; | ||
| 7728 | otherwise exit with return value 0. | ||
| 7729 | .It Fl clrext | ||
| 7730 | Delete any extensions from a certificate. | ||
| 7731 | This option is used when a certificate is being created from another | ||
| 7732 | certificate (for example with the | ||
| 7733 | .Fl signkey | ||
| 7734 | or the | ||
| 7735 | .Fl CA | ||
| 7736 | options). | ||
| 7737 | Normally, all extensions are retained. | ||
| 7738 | .It Fl days Ar arg | ||
| 7739 | Specifies the number of days to make a certificate valid for. | ||
| 7740 | The default is 30 days. | ||
| 7741 | .It Fl extensions Ar section | ||
| 7742 | The section to add certificate extensions from. | ||
| 7743 | If this option is not specified, the extensions should either be | ||
| 7744 | contained in the unnamed | ||
| 7745 | .Pq default | ||
| 7746 | section or the default section should contain a variable called | ||
| 7747 | .Qq extensions | ||
| 7748 | which contains the section to use. | ||
| 7749 | .It Fl extfile Ar file | ||
| 7750 | File containing certificate extensions to use. | ||
| 7751 | If not specified, no extensions are added to the certificate. | ||
| 7752 | .It Fl keyform Ar DER | PEM | ||
| 7753 | Specifies the format | ||
| 7754 | .Pq DER or PEM | ||
| 7755 | of the private key file used in the | ||
| 7756 | .Fl signkey | ||
| 7757 | option. | ||
| 7758 | .It Fl req | ||
| 7759 | By default, a certificate is expected on input. | ||
| 7760 | With this option a certificate request is expected instead. | ||
| 7761 | .It Fl set_serial Ar n | ||
| 7762 | Specifies the serial number to use. | ||
| 7763 | This option can be used with either the | ||
| 7764 | .Fl signkey | ||
| 7765 | or | ||
| 7766 | .Fl CA | ||
| 7767 | options. | ||
| 7768 | If used in conjunction with the | ||
| 7769 | .Fl CA | ||
| 7770 | option, the serial number file (as specified by the | ||
| 7771 | .Fl CAserial | ||
| 7772 | or | ||
| 7773 | .Fl CAcreateserial | ||
| 7774 | options) is not used. | ||
| 7775 | .Pp | ||
| 7776 | The serial number can be decimal or hex (if preceded by | ||
| 7777 | .Sq 0x ) . | ||
| 7778 | Negative serial numbers can also be specified but their use is not recommended. | ||
| 7779 | .It Fl signkey Ar file | ||
| 7780 | This option causes the input file to be self-signed using the supplied | ||
| 7781 | private key. | ||
| 7782 | .Pp | ||
| 7783 | If the input file is a certificate, it sets the issuer name to the | ||
| 7784 | subject name | ||
| 7785 | .Pq i.e. makes it self-signed , | ||
| 7786 | changes the public key to the supplied value, | ||
| 7787 | and changes the start and end dates. | ||
| 7788 | The start date is set to the current time and the end date is set to | ||
| 7789 | a value determined by the | ||
| 7790 | .Fl days | ||
| 7791 | option. | ||
| 7792 | Any certificate extensions are retained unless the | ||
| 7793 | .Fl clrext | ||
| 7794 | option is supplied. | ||
| 7795 | .Pp | ||
| 7796 | If the input is a certificate request, a self-signed certificate | ||
| 7797 | is created using the supplied private key using the subject name in | ||
| 7798 | the request. | ||
| 7799 | .It Fl x509toreq | ||
| 7800 | Converts a certificate into a certificate request. | ||
| 7801 | The | ||
| 7802 | .Fl signkey | ||
| 7803 | option is used to pass the required private key. | ||
| 7804 | .El | ||
| 7805 | .Sh X509 NAME OPTIONS | ||
| 7806 | The | ||
| 7807 | .Fl nameopt | ||
| 7808 | command line switch determines how the subject and issuer | ||
| 7809 | names are displayed. | ||
| 7810 | If no | ||
| 7811 | .Fl nameopt | ||
| 7812 | switch is present, the default | ||
| 7813 | .Qq oneline | ||
| 7814 | format is used which is compatible with previous versions of | ||
| 7815 | .Nm OpenSSL . | ||
| 7816 | Each option is described in detail below; all options can be preceded by a | ||
| 7817 | .Sq - | ||
| 7818 | to turn the option off. | ||
| 7819 | Only | ||
| 7820 | .Ar compat , | ||
| 7821 | .Ar RFC2253 , | ||
| 7822 | .Ar oneline , | ||
| 7823 | and | ||
| 7824 | .Ar multiline | ||
| 7825 | will normally be used. | ||
| 7826 | .Bl -tag -width "XXXX" | ||
| 7827 | .It Ar align | ||
| 7828 | Align field values for a more readable output. | ||
| 7829 | Only usable with | ||
| 7830 | .Ar sep_multiline . | ||
| 7831 | .It Ar compat | ||
| 7832 | Use the old format. | ||
| 7833 | This is equivalent to specifying no name options at all. | ||
| 7834 | .It Ar dn_rev | ||
| 7835 | Reverse the fields of the DN. | ||
| 7836 | This is required by RFC 2253. | ||
| 7837 | As a side effect, this also reverses the order of multiple AVAs but this is | ||
| 7838 | permissible. | ||
| 7839 | .It Ar dump_all | ||
| 7840 | Dump all fields. | ||
| 7841 | This option, when used with | ||
| 7842 | .Ar dump_der , | ||
| 7843 | allows the DER encoding of the structure to be unambiguously determined. | ||
| 7844 | .It Ar dump_der | ||
| 7845 | When this option is set, any fields that need to be hexdumped will | ||
| 7846 | be dumped using the DER encoding of the field. | ||
| 7847 | Otherwise just the content octets will be displayed. | ||
| 7848 | Both options use the RFC 2253 #XXXX... format. | ||
| 7849 | .It Ar dump_nostr | ||
| 7850 | Dump non-character string types | ||
| 7851 | .Pq for example OCTET STRING ; | ||
| 7852 | if this option is not set, non-character string types will be displayed | ||
| 7853 | as though each content octet represents a single character. | ||
| 7854 | .It Ar dump_unknown | ||
| 7855 | Dump any field whose OID is not recognised by | ||
| 7856 | .Nm OpenSSL . | ||
| 7857 | .It Ar esc_2253 | ||
| 7858 | Escape the | ||
| 7859 | .Qq special | ||
| 7860 | characters required by RFC 2253 in a field that is | ||
| 7861 | .Dq \& ,+"\*(Lt\*(Gt; . | ||
| 7862 | Additionally, | ||
| 7863 | .Sq # | ||
| 7864 | is escaped at the beginning of a string | ||
| 7865 | and a space character at the beginning or end of a string. | ||
| 7866 | .It Ar esc_ctrl | ||
| 7867 | Escape control characters. | ||
| 7868 | That is, those with ASCII values less than 0x20 | ||
| 7869 | .Pq space | ||
| 7870 | and the delete | ||
| 7871 | .Pq 0x7f | ||
| 7872 | character. | ||
| 7873 | They are escaped using the RFC 2253 \eXX notation (where XX are two hex | ||
| 7874 | digits representing the character value). | ||
| 7875 | .It Ar esc_msb | ||
| 7876 | Escape characters with the MSB set; that is, with ASCII values larger than | ||
| 7877 | 127. | ||
| 7878 | .It Ar multiline | ||
| 7879 | A multiline format. | ||
| 7880 | It is equivalent to | ||
| 7881 | .Ar esc_ctrl , esc_msb , sep_multiline , | ||
| 7882 | .Ar space_eq , lname , | ||
| 7883 | and | ||
| 7884 | .Ar align . | ||
| 7885 | .It Ar no_type | ||
| 7886 | This option does not attempt to interpret multibyte characters in any | ||
| 7887 | way. | ||
| 7888 | That is, their content octets are merely dumped as though one octet | ||
| 7889 | represents each character. | ||
| 7890 | This is useful for diagnostic purposes but will result in rather odd | ||
| 7891 | looking output. | ||
| 7892 | .It Ar nofname , sname , lname , oid | ||
| 7893 | These options alter how the field name is displayed. | ||
| 7894 | .Ar nofname | ||
| 7895 | does not display the field at all. | ||
| 7896 | .Ar sname | ||
| 7897 | uses the | ||
| 7898 | .Qq short name | ||
| 7899 | form (CN for | ||
| 7900 | .Ar commonName , | ||
| 7901 | for example). | ||
| 7902 | .Ar lname | ||
| 7903 | uses the long form. | ||
| 7904 | .Ar oid | ||
| 7905 | represents the OID in numerical form and is useful for diagnostic purpose. | ||
| 7906 | .It Ar oneline | ||
| 7907 | A oneline format which is more readable than | ||
| 7908 | .Ar RFC2253 . | ||
| 7909 | It is equivalent to specifying the | ||
| 7910 | .Ar esc_2253 , esc_ctrl , esc_msb , utf8 , | ||
| 7911 | .Ar dump_nostr , dump_der , use_quote , sep_comma_plus_spc , | ||
| 7912 | .Ar space_eq , | ||
| 7913 | and | ||
| 7914 | .Ar sname | ||
| 7915 | options. | ||
| 7916 | .It Ar RFC2253 | ||
| 7917 | Displays names compatible with RFC 2253; equivalent to | ||
| 7918 | .Ar esc_2253 , esc_ctrl , | ||
| 7919 | .Ar esc_msb , utf8 , dump_nostr , dump_unknown , | ||
| 7920 | .Ar dump_der , sep_comma_plus , dn_rev , | ||
| 7921 | and | ||
| 7922 | .Ar sname . | ||
| 7923 | .It Ar sep_comma_plus , sep_comma_plus_space , sep_semi_plus_space , sep_multiline | ||
| 7924 | These options determine the field separators. | ||
| 7925 | The first character is between RDNs and the second between multiple AVAs | ||
| 7926 | (multiple AVAs are very rare and their use is discouraged). | ||
| 7927 | The options ending in | ||
| 7928 | .Qq space | ||
| 7929 | additionally place a space after the separator to make it more readable. | ||
| 7930 | The | ||
| 7931 | .Ar sep_multiline | ||
| 7932 | uses a linefeed character for the RDN separator and a spaced | ||
| 7933 | .Sq + | ||
| 7934 | for the AVA separator. | ||
| 7935 | It also indents the fields by four characters. | ||
| 7936 | .It Ar show_type | ||
| 7937 | Show the type of the ASN1 character string. | ||
| 7938 | The type precedes the field contents. | ||
| 7939 | For example | ||
| 7940 | .Qq BMPSTRING: Hello World . | ||
| 7941 | .It Ar space_eq | ||
| 7942 | Places spaces round the | ||
| 7943 | .Sq = | ||
| 7944 | character which follows the field name. | ||
| 7945 | .It Ar use_quote | ||
| 7946 | Escapes some characters by surrounding the whole string with | ||
| 7947 | .Sq \&" | ||
| 7948 | characters. | ||
| 7949 | Without the option, all escaping is done with the | ||
| 7950 | .Sq \e | ||
| 7951 | character. | ||
| 7952 | .It Ar utf8 | ||
| 7953 | Convert all strings to UTF8 format first. | ||
| 7954 | This is required by RFC 2253. | ||
| 7955 | If you are lucky enough to have a UTF8 compatible terminal, | ||
| 7956 | the use of this option (and | ||
| 7957 | .Em not | ||
| 7958 | setting | ||
| 7959 | .Ar esc_msb ) | ||
| 7960 | may result in the correct display of multibyte | ||
| 7961 | .Pq international | ||
| 7962 | characters. | ||
| 7963 | If this option is not present, multibyte characters larger than 0xff | ||
| 7964 | will be represented using the format \eUXXXX for 16 bits and \eWXXXXXXXX | ||
| 7965 | for 32 bits. | ||
| 7966 | Also, if this option is off, any UTF8Strings will be converted to their | ||
| 7967 | character form first. | ||
| 7968 | .El | ||
| 7969 | .Sh X509 TEXT OPTIONS | ||
| 7970 | As well as customising the name output format, it is also possible to | ||
| 7971 | customise the actual fields printed using the | ||
| 7972 | .Fl certopt | ||
| 7973 | options when the | ||
| 7974 | .Fl text | ||
| 7975 | option is present. | ||
| 7976 | The default behaviour is to print all fields. | ||
| 7977 | .Bl -tag -width "XXXX" | ||
| 7978 | .It Ar ca_default | ||
| 7979 | The value used by the | ||
| 7980 | .Nm ca | ||
| 7981 | utility; equivalent to | ||
| 7982 | .Ar no_issuer , no_pubkey , no_header , | ||
| 7983 | .Ar no_version , no_sigdump , | ||
| 7984 | and | ||
| 7985 | .Ar no_signame . | ||
| 7986 | .It Ar compatible | ||
| 7987 | Use the old format. | ||
| 7988 | This is equivalent to specifying no output options at all. | ||
| 7989 | .It Ar ext_default | ||
| 7990 | Retain default extension behaviour: attempt to print out unsupported | ||
| 7991 | certificate extensions. | ||
| 7992 | .It Ar ext_dump | ||
| 7993 | Hex dump unsupported extensions. | ||
| 7994 | .It Ar ext_error | ||
| 7995 | Print an error message for unsupported certificate extensions. | ||
| 7996 | .It Ar ext_parse | ||
| 7997 | ASN1 parse unsupported extensions. | ||
| 7998 | .It Ar no_aux | ||
| 7999 | Don't print out certificate trust information. | ||
| 8000 | .It Ar no_extensions | ||
| 8001 | Don't print out any X509V3 extensions. | ||
| 8002 | .It Ar no_header | ||
| 8003 | Don't print header information: that is, the lines saying | ||
| 8004 | .Qq Certificate | ||
| 8005 | and | ||
| 8006 | .Qq Data . | ||
| 8007 | .It Ar no_issuer | ||
| 8008 | Don't print out the issuer name. | ||
| 8009 | .It Ar no_pubkey | ||
| 8010 | Don't print out the public key. | ||
| 8011 | .It Ar no_serial | ||
| 8012 | Don't print out the serial number. | ||
| 8013 | .It Ar no_sigdump | ||
| 8014 | Don't give a hexadecimal dump of the certificate signature. | ||
| 8015 | .It Ar no_signame | ||
| 8016 | Don't print out the signature algorithm used. | ||
| 8017 | .It Ar no_subject | ||
| 8018 | Don't print out the subject name. | ||
| 8019 | .It Ar no_validity | ||
| 8020 | Don't print the validity; that is, the | ||
| 8021 | .Em notBefore | ||
| 8022 | and | ||
| 8023 | .Em notAfter | ||
| 8024 | fields. | ||
| 8025 | .It Ar no_version | ||
| 8026 | Don't print out the version number. | ||
| 8027 | .El | ||
| 8028 | .Sh X509 EXAMPLES | ||
| 8029 | Display the contents of a certificate: | ||
| 8030 | .Pp | ||
| 8031 | .Dl $ openssl x509 -in cert.pem -noout -text | ||
| 8032 | .Pp | ||
| 8033 | Display the certificate serial number: | ||
| 8034 | .Pp | ||
| 8035 | .Dl $ openssl x509 -in cert.pem -noout -serial | ||
| 8036 | .Pp | ||
| 8037 | Display the certificate subject name: | ||
| 8038 | .Pp | ||
| 8039 | .Dl $ openssl x509 -in cert.pem -noout -subject | ||
| 8040 | .Pp | ||
| 8041 | Display the certificate subject name in RFC 2253 form: | ||
| 8042 | .Pp | ||
| 8043 | .Dl $ openssl x509 -in cert.pem -noout -subject -nameopt RFC2253 | ||
| 8044 | .Pp | ||
| 8045 | Display the certificate subject name in oneline form on a terminal | ||
| 8046 | supporting UTF8: | ||
| 8047 | .Bd -literal -offset indent | ||
| 8048 | $ openssl x509 -in cert.pem -noout -subject \e | ||
| 8049 | -nameopt oneline,-esc_msb | ||
| 8050 | .Ed | ||
| 8051 | .Pp | ||
| 8052 | Display the certificate MD5 fingerprint: | ||
| 8053 | .Pp | ||
| 8054 | .Dl $ openssl x509 -in cert.pem -noout -fingerprint | ||
| 8055 | .Pp | ||
| 8056 | Display the certificate SHA1 fingerprint: | ||
| 8057 | .Pp | ||
| 8058 | .Dl $ openssl x509 -sha1 -in cert.pem -noout -fingerprint | ||
| 8059 | .Pp | ||
| 8060 | Convert a certificate from PEM to DER format: | ||
| 8061 | .Pp | ||
| 8062 | .Dl "$ openssl x509 -in cert.pem -inform PEM -out cert.der -outform DER" | ||
| 8063 | .Pp | ||
| 8064 | Convert a certificate to a certificate request: | ||
| 8065 | .Bd -literal -offset indent | ||
| 8066 | $ openssl x509 -x509toreq -in cert.pem -out req.pem \e | ||
| 8067 | -signkey key.pem | ||
| 8068 | .Ed | ||
| 8069 | .Pp | ||
| 8070 | Convert a certificate request into a self-signed certificate using | ||
| 8071 | extensions for a CA: | ||
| 8072 | .Bd -literal -offset indent | ||
| 8073 | $ openssl x509 -req -in careq.pem -extfile openssl.cnf -extensions \e | ||
| 8074 | v3_ca -signkey key.pem -out cacert.pem | ||
| 8075 | .Ed | ||
| 8076 | .Pp | ||
| 8077 | Sign a certificate request using the CA certificate above and add user | ||
| 8078 | certificate extensions: | ||
| 8079 | .Bd -literal -offset indent | ||
| 8080 | $ openssl x509 -req -in req.pem -extfile openssl.cnf -extensions \e | ||
| 8081 | v3_usr -CA cacert.pem -CAkey key.pem -CAcreateserial | ||
| 8082 | .Ed | ||
| 8083 | .Pp | ||
| 8084 | Set a certificate to be trusted for SSL | ||
| 8085 | client use and set its alias to | ||
| 8086 | .Qq Steve's Class 1 CA : | ||
| 8087 | .Bd -literal -offset indent | ||
| 8088 | $ openssl x509 -in cert.pem -addtrust clientAuth \e | ||
| 8089 | -setalias "Steve's Class 1 CA" -out trust.pem | ||
| 8090 | .Ed | ||
| 8091 | .Sh X509 NOTES | ||
| 8092 | The PEM format uses the header and footer lines: | ||
| 8093 | .Bd -unfilled -offset indent | ||
| 8094 | -----BEGIN CERTIFICATE----- | ||
| 8095 | -----END CERTIFICATE----- | ||
| 8096 | .Ed | ||
| 8097 | .Pp | ||
| 8098 | It will also handle files containing: | ||
| 8099 | .Bd -unfilled -offset indent | ||
| 8100 | -----BEGIN X509 CERTIFICATE----- | ||
| 8101 | -----END X509 CERTIFICATE----- | ||
| 8102 | .Ed | ||
| 8103 | .Pp | ||
| 8104 | Trusted certificates have the lines: | ||
| 8105 | .Bd -unfilled -offset indent | ||
| 8106 | -----BEGIN TRUSTED CERTIFICATE----- | ||
| 8107 | -----END TRUSTED CERTIFICATE----- | ||
| 8108 | .Ed | ||
| 8109 | .Pp | ||
| 8110 | The conversion to UTF8 format used with the name options assumes that | ||
| 8111 | T61Strings use the ISO 8859-1 character set. | ||
| 8112 | This is wrong, but Netscape and MSIE do this, as do many certificates. | ||
| 8113 | So although this is incorrect | ||
| 8114 | it is more likely to display the majority of certificates correctly. | ||
| 8115 | .Pp | ||
| 8116 | The | ||
| 8117 | .Fl fingerprint | ||
| 8118 | option takes the digest of the DER-encoded certificate. | ||
| 8119 | This is commonly called a | ||
| 8120 | .Qq fingerprint . | ||
| 8121 | Because of the nature of message digests, the fingerprint of a certificate | ||
| 8122 | is unique to that certificate and two certificates with the same fingerprint | ||
| 8123 | can be considered to be the same. | ||
| 8124 | .Pp | ||
| 8125 | The Netscape fingerprint uses MD5, whereas MSIE uses SHA1. | ||
| 8126 | .Pp | ||
| 8127 | The | ||
| 8128 | .Fl email | ||
| 8129 | option searches the subject name and the subject alternative | ||
| 8130 | name extension. | ||
| 8131 | Only unique email addresses will be printed out: it will | ||
| 8132 | not print the same address more than once. | ||
| 8133 | .Sh X509 CERTIFICATE EXTENSIONS | ||
| 8134 | The | ||
| 8135 | .Fl purpose | ||
| 8136 | option checks the certificate extensions and determines | ||
| 8137 | what the certificate can be used for. | ||
| 8138 | The actual checks done are rather | ||
| 8139 | complex and include various hacks and workarounds to handle broken | ||
| 8140 | certificates and software. | ||
| 8141 | .Pp | ||
| 8142 | The same code is used when verifying untrusted certificates in chains, | ||
| 8143 | so this section is useful if a chain is rejected by the verify code. | ||
| 8144 | .Pp | ||
| 8145 | The | ||
| 8146 | .Em basicConstraints | ||
| 8147 | extension CA flag is used to determine whether the | ||
| 8148 | certificate can be used as a CA. | ||
| 8149 | If the CA flag is true, it is a CA; | ||
| 8150 | if the CA flag is false, it is not a CA. | ||
| 8151 | .Em All | ||
| 8152 | CAs should have the CA flag set to true. | ||
| 8153 | .Pp | ||
| 8154 | If the | ||
| 8155 | .Em basicConstraints | ||
| 8156 | extension is absent, then the certificate is | ||
| 8157 | considered to be a | ||
| 8158 | .Qq possible CA ; | ||
| 8159 | other extensions are checked according to the intended use of the certificate. | ||
| 8160 | A warning is given in this case because the certificate should really not | ||
| 8161 | be regarded as a CA: however, | ||
| 8162 | it is allowed to be a CA to work around some broken software. | ||
| 8163 | .Pp | ||
| 8164 | If the certificate is a V1 certificate | ||
| 8165 | .Pq and thus has no extensions | ||
| 8166 | and it is self-signed, it is also assumed to be a CA but a warning is again | ||
| 8167 | given: this is to work around the problem of Verisign roots which are V1 | ||
| 8168 | self-signed certificates. | ||
| 8169 | .Pp | ||
| 8170 | If the | ||
| 8171 | .Em keyUsage | ||
| 8172 | extension is present, then additional restraints are | ||
| 8173 | made on the uses of the certificate. | ||
| 8174 | A CA certificate | ||
| 8175 | .Em must | ||
| 8176 | have the | ||
| 8177 | .Em keyCertSign | ||
| 8178 | bit set if the | ||
| 8179 | .Em keyUsage | ||
| 8180 | extension is present. | ||
| 8181 | .Pp | ||
| 8182 | The extended key usage extension places additional restrictions on the | ||
| 8183 | certificate uses. | ||
| 8184 | If this extension is present | ||
| 8185 | .Pq whether critical or not , | ||
| 8186 | the key can only be used for the purposes specified. | ||
| 8187 | .Pp | ||
| 8188 | A complete description of each test is given below. | ||
| 8189 | The comments about | ||
| 8190 | .Em basicConstraints | ||
| 8191 | and | ||
| 8192 | .Em keyUsage | ||
| 8193 | and V1 certificates above apply to | ||
| 8194 | .Em all | ||
| 8195 | CA certificates. | ||
| 8196 | .Bl -tag -width "XXXX" | ||
| 8197 | .It Ar SSL Client | ||
| 8198 | The extended key usage extension must be absent or include the | ||
| 8199 | .Qq web client authentication | ||
| 8200 | OID. | ||
| 8201 | .Ar keyUsage | ||
| 8202 | must be absent or it must have the | ||
| 8203 | .Em digitalSignature | ||
| 8204 | bit set. | ||
| 8205 | Netscape certificate type must be absent or it must have the SSL | ||
| 8206 | client bit set. | ||
| 8207 | .It Ar SSL Client CA | ||
| 8208 | The extended key usage extension must be absent or include the | ||
| 8209 | .Qq web client authentication | ||
| 8210 | OID. | ||
| 8211 | Netscape certificate type must be absent or it must have the SSL CA | ||
| 8212 | bit set: this is used as a work around if the | ||
| 8213 | .Em basicConstraints | ||
| 8214 | extension is absent. | ||
| 8215 | .It Ar SSL Server | ||
| 8216 | The extended key usage extension must be absent or include the | ||
| 8217 | .Qq web server authentication | ||
| 8218 | and/or one of the SGC OIDs. | ||
| 8219 | .Em keyUsage | ||
| 8220 | must be absent or it must have the | ||
| 8221 | .Em digitalSignature | ||
| 8222 | set, the | ||
| 8223 | .Em keyEncipherment | ||
| 8224 | set, or both bits set. | ||
| 8225 | Netscape certificate type must be absent or have the SSL server bit set. | ||
| 8226 | .It Ar SSL Server CA | ||
| 8227 | The extended key usage extension must be absent or include the | ||
| 8228 | .Qq web server authentication | ||
| 8229 | and/or one of the SGC OIDs. | ||
| 8230 | Netscape certificate type must be absent or the SSL CA | ||
| 8231 | bit must be set: this is used as a work around if the | ||
| 8232 | .Em basicConstraints | ||
| 8233 | extension is absent. | ||
| 8234 | .It Ar Netscape SSL Server | ||
| 8235 | For Netscape SSL clients to connect to an SSL server; it must have the | ||
| 8236 | .Em keyEncipherment | ||
| 8237 | bit set if the | ||
| 8238 | .Em keyUsage | ||
| 8239 | extension is present. | ||
| 8240 | This isn't always valid because some cipher suites use the key for | ||
| 8241 | digital signing. | ||
| 8242 | Otherwise it is the same as a normal SSL server. | ||
| 8243 | .It Ar Common S/MIME Client Tests | ||
| 8244 | The extended key usage extension must be absent or include the | ||
| 8245 | .Qq email protection | ||
| 8246 | OID. | ||
| 8247 | Netscape certificate type must be absent or should have the | ||
| 8248 | .Em S/MIME | ||
| 8249 | bit set. | ||
| 8250 | If the | ||
| 8251 | .Em S/MIME | ||
| 8252 | bit is not set in Netscape certificate type, then the SSL | ||
| 8253 | client bit is tolerated as an alternative but a warning is shown: | ||
| 8254 | this is because some Verisign certificates don't set the | ||
| 8255 | .Em S/MIME | ||
| 8256 | bit. | ||
| 8257 | .It Ar S/MIME Signing | ||
| 8258 | In addition to the common | ||
| 8259 | .Em S/MIME | ||
| 8260 | client tests, the | ||
| 8261 | .Em digitalSignature | ||
| 8262 | bit must be set if the | ||
| 8263 | .Em keyUsage | ||
| 8264 | extension is present. | ||
| 8265 | .It Ar S/MIME Encryption | ||
| 8266 | In addition to the common | ||
| 8267 | .Em S/MIME | ||
| 8268 | tests, the | ||
| 8269 | .Em keyEncipherment | ||
| 8270 | bit must be set if the | ||
| 8271 | .Em keyUsage | ||
| 8272 | extension is present. | ||
| 8273 | .It Ar S/MIME CA | ||
| 8274 | The extended key usage extension must be absent or include the | ||
| 8275 | .Qq email protection | ||
| 8276 | OID. | ||
| 8277 | Netscape certificate type must be absent or must have the | ||
| 8278 | .Em S/MIME CA | ||
| 8279 | bit set: this is used as a work around if the | ||
| 8280 | .Em basicConstraints | ||
| 8281 | extension is absent. | ||
| 8282 | .It Ar CRL Signing | ||
| 8283 | The | ||
| 8284 | .Em keyUsage | ||
| 8285 | extension must be absent or it must have the | ||
| 8286 | .Em CRL | ||
| 8287 | signing bit set. | ||
| 8288 | .It Ar CRL Signing CA | ||
| 8289 | The normal CA tests apply. | ||
| 8290 | Except in this case the | ||
| 8291 | .Em basicConstraints | ||
| 8292 | extension must be present. | ||
| 8293 | .El | ||
| 8294 | .Sh X509 BUGS | ||
| 8295 | Extensions in certificates are not transferred to certificate requests and | ||
| 8296 | vice versa. | ||
| 8297 | .Pp | ||
| 8298 | It is possible to produce invalid certificates or requests by specifying the | ||
| 8299 | wrong private key or using inconsistent options in some cases: these should | ||
| 8300 | be checked. | ||
| 8301 | .Pp | ||
| 8302 | There should be options to explicitly set such things as start and end dates, | ||
| 8303 | rather than an offset from the current time. | ||
| 8304 | .Pp | ||
| 8305 | The code to implement the verify behaviour described in the | ||
| 8306 | .Sx X509 TRUST SETTINGS | ||
| 8307 | is currently being developed. | ||
| 8308 | It thus describes the intended behaviour rather than the current behaviour. | ||
| 8309 | It is hoped that it will represent reality in | ||
| 8310 | .Nm OpenSSL | ||
| 8311 | 0.9.5 and later. | ||
| 8312 | .\" | ||
| 8313 | .\" FILES | ||
| 8314 | .\" | ||
| 8315 | .Sh FILES | ||
| 8316 | .Bl -tag -width "/etc/ssl/openssl.cnf" -compact | ||
| 8317 | .It /etc/ssl/ | ||
| 8318 | Default config directory for | ||
| 8319 | .Nm openssl . | ||
| 8320 | .It /etc/ssl/lib/ | ||
| 8321 | Unused. | ||
| 8322 | .It /etc/ssl/private/ | ||
| 8323 | Default private key directory. | ||
| 8324 | .It /etc/ssl/openssl.cnf | ||
| 8325 | Default configuration file for | ||
| 8326 | .Nm openssl . | ||
| 8327 | .It /etc/ssl/x509v3.cnf | ||
| 8328 | Default configuration file for | ||
| 8329 | .Nm x509 | ||
| 8330 | certificates. | ||
| 8331 | .El | ||
| 8332 | .\" | ||
| 8333 | .\" SEE ALSO | ||
| 8334 | .\" | ||
| 8335 | .Sh SEE ALSO | ||
| 8336 | .Xr httpd 8 , | ||
| 8337 | .Xr sendmail 8 , | ||
| 8338 | .Xr ssl 8 , | ||
| 8339 | .Xr starttls 8 | ||
| 8340 | .Pp | ||
| 8341 | .Rs | ||
| 8342 | .%T The SSL Protocol | ||
| 8343 | .%Q Netscape Communications Corp. | ||
| 8344 | .%D February 9 1995 | ||
| 8345 | .Re | ||
| 8346 | .Rs | ||
| 8347 | .%T The SSL 3.0 Protocol | ||
| 8348 | .%Q Netscape Communications Corp. | ||
| 8349 | .%D November 18 1996 | ||
| 8350 | .Re | ||
| 8351 | .Rs | ||
| 8352 | .%R RFC 2246 | ||
| 8353 | .%T The TLS Protocol Version 1.0 | ||
| 8354 | .%D January 1999 | ||
| 8355 | .Re | ||
| 8356 | .Rs | ||
| 8357 | .%R RFC 2253 | ||
| 8358 | .%T "LDAPv3 Distinguished Names" | ||
| 8359 | .%D December 1997 | ||
| 8360 | .Re | ||
| 8361 | .Rs | ||
| 8362 | .%R RFC 2315 | ||
| 8363 | .%T "PKCS #7: Cryptographic Message Syntax" | ||
| 8364 | .%D March 1998 | ||
| 8365 | .Re | ||
| 8366 | .Rs | ||
| 8367 | .%R RFC 2459 | ||
| 8368 | .%T "X.509 Certificate and CRL Profile" | ||
| 8369 | .%D January 1999 | ||
| 8370 | .Re | ||
| 8371 | .Rs | ||
| 8372 | .%R RFC 2560 | ||
| 8373 | .%T "Online Certificate Status Protocol \- OCSP" | ||
| 8374 | .%D June 1999 | ||
| 8375 | .Re | ||
| 8376 | .Rs | ||
| 8377 | .%R RFC 2630 | ||
| 8378 | .%T "Cryptographic Message Syntax" | ||
| 8379 | .%D June 1999 | ||
| 8380 | .Re | ||
| 8381 | .Rs | ||
| 8382 | .%R RFC 3268 | ||
| 8383 | .%T "Advanced Encryption Standard (AES) Ciphersuites for Transport Layer Security(TLS)" | ||
| 8384 | .%D June 2002 | ||
| 8385 | .Re | ||
| 8386 | .\" | ||
| 8387 | .\" OPENSSL HISTORY | ||
| 8388 | .\" | ||
| 8389 | .Sh HISTORY | ||
| 8390 | The | ||
| 8391 | .Xr openssl 1 | ||
| 8392 | document appeared in | ||
| 8393 | .Nm OpenSSL | ||
| 8394 | 0.9.2. | ||
| 8395 | The | ||
| 8396 | .Cm list- Ns Ar XXX Ns Cm -commands | ||
| 8397 | pseudo-commands were added in | ||
| 8398 | .Nm OpenSSL | ||
| 8399 | 0.9.3; | ||
| 8400 | the | ||
| 8401 | .Cm no- Ns Ar XXX | ||
| 8402 | pseudo-commands were added in | ||
| 8403 | .Nm OpenSSL | ||
| 8404 | 0.9.5a. | ||
