openssl.pod 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. =pod
  2. =head1 NAME
  3. openssl - OpenSSL command line tool
  4. =head1 SYNOPSIS
  5. B<openssl>
  6. I<command>
  7. [ I<command_opts> ]
  8. [ I<command_args> ]
  9. B<openssl> B<list> [ B<standard-commands> | B<digest-commands> | B<cipher-commands> | B<cipher-algorithms> | B<digest-algorithms> | B<mac-algorithms> | B<public-key-algorithms>]
  10. B<openssl> B<no->I<XXX> [ I<arbitrary options> ]
  11. =head1 DESCRIPTION
  12. OpenSSL is a cryptography toolkit implementing the Secure Sockets Layer (SSL
  13. v2/v3) and Transport Layer Security (TLS v1) network protocols and related
  14. cryptography standards required by them.
  15. The B<openssl> program is a command line tool for using the various
  16. cryptography functions of OpenSSL's B<crypto> library from the shell.
  17. It can be used for
  18. o Creation and management of private keys, public keys and parameters
  19. o Public key cryptographic operations
  20. o Creation of X.509 certificates, CSRs and CRLs
  21. o Calculation of Message Digests and Message Authentication Codes
  22. o Encryption and Decryption with Ciphers
  23. o SSL/TLS Client and Server Tests
  24. o Handling of S/MIME signed or encrypted mail
  25. o Time Stamp requests, generation and verification
  26. =head1 COMMAND SUMMARY
  27. The B<openssl> program provides a rich variety of commands (I<command> in the
  28. SYNOPSIS above), each of which often has a wealth of options and arguments
  29. (I<command_opts> and I<command_args> in the SYNOPSIS).
  30. Detailed documentation and use cases for most standard subcommands are available
  31. (e.g., L<x509(1)> or L<openssl-x509(1)>).
  32. Many commands use an external configuration file for some or all of their
  33. arguments and have a B<-config> option to specify that file.
  34. The environment variable B<OPENSSL_CONF> can be used to specify
  35. the location of the file.
  36. If the environment variable is not specified, then the file is named
  37. B<openssl.cnf> in the default certificate storage area, whose value
  38. depends on the configuration flags specified when the OpenSSL
  39. was built.
  40. The list parameters B<standard-commands>, B<digest-commands>,
  41. and B<cipher-commands> output a list (one entry per line) of the names
  42. of all standard commands, message digest commands, or cipher commands,
  43. respectively, that are available in the present B<openssl> utility.
  44. The list parameters B<cipher-algorithms>, B<digest-algorithms>,
  45. and B<mac-algorithms> list all cipher, message digest, and message
  46. authentication code names, one entry per line. Aliases are listed as:
  47. from => to
  48. The list parameter B<public-key-algorithms> lists all supported public
  49. key algorithms.
  50. The command B<no->I<XXX> tests whether a command of the
  51. specified name is available. If no command named I<XXX> exists, it
  52. returns 0 (success) and prints B<no->I<XXX>; otherwise it returns 1
  53. and prints I<XXX>. In both cases, the output goes to B<stdout> and
  54. nothing is printed to B<stderr>. Additional command line arguments
  55. are always ignored. Since for each cipher there is a command of the
  56. same name, this provides an easy way for shell scripts to test for the
  57. availability of ciphers in the B<openssl> program. (B<no->I<XXX> is
  58. not able to detect pseudo-commands such as B<quit>,
  59. B<list>, or B<no->I<XXX> itself.)
  60. =head2 Standard Commands
  61. =over 4
  62. =item B<asn1parse>
  63. Parse an ASN.1 sequence.
  64. =item B<ca>
  65. Certificate Authority (CA) Management.
  66. =item B<ciphers>
  67. Cipher Suite Description Determination.
  68. =item B<cms>
  69. CMS (Cryptographic Message Syntax) utility.
  70. =item B<crl>
  71. Certificate Revocation List (CRL) Management.
  72. =item B<crl2pkcs7>
  73. CRL to PKCS#7 Conversion.
  74. =item B<dgst>
  75. Message Digest calculation. MAC calculations are superseded by
  76. L<mac(1)>.
  77. =item B<dh>
  78. Diffie-Hellman Parameter Management.
  79. Obsoleted by L<dhparam(1)>.
  80. =item B<dhparam>
  81. Generation and Management of Diffie-Hellman Parameters. Superseded by
  82. L<genpkey(1)> and L<pkeyparam(1)>.
  83. =item B<dsa>
  84. DSA Data Management.
  85. =item B<dsaparam>
  86. DSA Parameter Generation and Management. Superseded by
  87. L<genpkey(1)> and L<pkeyparam(1)>.
  88. =item B<ec>
  89. EC (Elliptic curve) key processing.
  90. =item B<ecparam>
  91. EC parameter manipulation and generation.
  92. =item B<enc>
  93. Encoding with Ciphers.
  94. =item B<engine>
  95. Engine (loadable module) information and manipulation.
  96. =item B<errstr>
  97. Error Number to Error String Conversion.
  98. =item B<gendh>
  99. Generation of Diffie-Hellman Parameters.
  100. Obsoleted by L<dhparam(1)>.
  101. =item B<gendsa>
  102. Generation of DSA Private Key from Parameters. Superseded by
  103. L<genpkey(1)> and L<pkey(1)>.
  104. =item B<genpkey>
  105. Generation of Private Key or Parameters.
  106. =item B<genrsa>
  107. Generation of RSA Private Key. Superseded by L<genpkey(1)>.
  108. =item B<info>
  109. Display diverse information built into the OpenSSL libraries.
  110. =item B<kdf>
  111. Key Derivation Functions.
  112. =item B<mac>
  113. Message Authentication Code Calculation.
  114. =item B<nseq>
  115. Create or examine a Netscape certificate sequence.
  116. =item B<ocsp>
  117. Online Certificate Status Protocol utility.
  118. =item B<passwd>
  119. Generation of hashed passwords.
  120. =item B<pkcs12>
  121. PKCS#12 Data Management.
  122. =item B<pkcs7>
  123. PKCS#7 Data Management.
  124. =item B<pkcs8>
  125. PKCS#8 format private key conversion tool.
  126. =item B<pkey>
  127. Public and private key management.
  128. =item B<pkeyparam>
  129. Public key algorithm parameter management.
  130. =item B<pkeyutl>
  131. Public key algorithm cryptographic operation utility.
  132. =item B<prime>
  133. Compute prime numbers.
  134. =item B<rand>
  135. Generate pseudo-random bytes.
  136. =item B<rehash>
  137. Create symbolic links to certificate and CRL files named by the hash values.
  138. =item B<req>
  139. PKCS#10 X.509 Certificate Signing Request (CSR) Management.
  140. =item B<rsa>
  141. RSA key management.
  142. =item B<rsautl>
  143. RSA utility for signing, verification, encryption, and decryption. Superseded
  144. by L<pkeyutl(1)>.
  145. =item B<s_client>
  146. This implements a generic SSL/TLS client which can establish a transparent
  147. connection to a remote server speaking SSL/TLS. It's intended for testing
  148. purposes only and provides only rudimentary interface functionality but
  149. internally uses mostly all functionality of the OpenSSL B<ssl> library.
  150. =item B<s_server>
  151. This implements a generic SSL/TLS server which accepts connections from remote
  152. clients speaking SSL/TLS. It's intended for testing purposes only and provides
  153. only rudimentary interface functionality but internally uses mostly all
  154. functionality of the OpenSSL B<ssl> library. It provides both an own command
  155. line oriented protocol for testing SSL functions and a simple HTTP response
  156. facility to emulate an SSL/TLS-aware webserver.
  157. =item B<s_time>
  158. SSL Connection Timer.
  159. =item B<sess_id>
  160. SSL Session Data Management.
  161. =item B<smime>
  162. S/MIME mail processing.
  163. =item B<speed>
  164. Algorithm Speed Measurement.
  165. =item B<spkac>
  166. SPKAC printing and generating utility.
  167. =item B<srp>
  168. Maintain SRP password file.
  169. =item B<storeutl>
  170. Utility to list and display certificates, keys, CRLs, etc.
  171. =item B<ts>
  172. Time Stamping Authority tool (client/server).
  173. =item B<verify>
  174. X.509 Certificate Verification.
  175. =item B<version>
  176. OpenSSL Version Information.
  177. =item B<x509>
  178. X.509 Certificate Data Management.
  179. =back
  180. =head2 Message Digest Commands
  181. =over 4
  182. =item B<blake2b512>
  183. BLAKE2b-512 Digest
  184. =item B<blake2s256>
  185. BLAKE2s-256 Digest
  186. =item B<md2>
  187. MD2 Digest
  188. =item B<md4>
  189. MD4 Digest
  190. =item B<md5>
  191. MD5 Digest
  192. =item B<mdc2>
  193. MDC2 Digest
  194. =item B<rmd160>
  195. RMD-160 Digest
  196. =item B<sha1>
  197. SHA-1 Digest
  198. =item B<sha224>
  199. SHA-2 224 Digest
  200. =item B<sha256>
  201. SHA-2 256 Digest
  202. =item B<sha384>
  203. SHA-2 384 Digest
  204. =item B<sha512>
  205. SHA-2 512 Digest
  206. =item B<sha3-224>
  207. SHA-3 224 Digest
  208. =item B<sha3-256>
  209. SHA-3 256 Digest
  210. =item B<sha3-384>
  211. SHA-3 384 Digest
  212. =item B<sha3-512>
  213. SHA-3 512 Digest
  214. =item B<shake128>
  215. SHA-3 SHAKE128 Digest
  216. =item B<shake256>
  217. SHA-3 SHAKE256 Digest
  218. =item B<sm3>
  219. SM3 Digest
  220. =back
  221. =head2 Encoding and Cipher Commands
  222. The following aliases provide convenient access to the most used encodings
  223. and ciphers.
  224. Depending on how OpenSSL was configured and built, not all ciphers listed
  225. here may be present. See L<enc(1)> for more information and command usage.
  226. =over 4
  227. =item B<aes128>, B<aes-128-cbc>, B<aes-128-cfb>, B<aes-128-ctr>, B<aes-128-ecb>, B<aes-128-ofb>
  228. AES-128 Cipher
  229. =item B<aes192>, B<aes-192-cbc>, B<aes-192-cfb>, B<aes-192-ctr>, B<aes-192-ecb>, B<aes-192-ofb>
  230. AES-192 Cipher
  231. =item B<aes256>, B<aes-256-cbc>, B<aes-256-cfb>, B<aes-256-ctr>, B<aes-256-ecb>, B<aes-256-ofb>
  232. AES-256 Cipher
  233. =item B<aria128>, B<aria-128-cbc>, B<aria-128-cfb>, B<aria-128-ctr>, B<aria-128-ecb>, B<aria-128-ofb>
  234. Aria-128 Cipher
  235. =item B<aria192>, B<aria-192-cbc>, B<aria-192-cfb>, B<aria-192-ctr>, B<aria-192-ecb>, B<aria-192-ofb>
  236. Aria-192 Cipher
  237. =item B<aria256>, B<aria-256-cbc>, B<aria-256-cfb>, B<aria-256-ctr>, B<aria-256-ecb>, B<aria-256-ofb>
  238. Aria-256 Cipher
  239. =item B<base64>
  240. Base64 Encoding
  241. =item B<bf>, B<bf-cbc>, B<bf-cfb>, B<bf-ecb>, B<bf-ofb>
  242. Blowfish Cipher
  243. =item B<camellia128>, B<camellia-128-cbc>, B<camellia-128-cfb>, B<camellia-128-ctr>, B<camellia-128-ecb>, B<camellia-128-ofb>
  244. Camellia-128 Cipher
  245. =item B<camellia192>, B<camellia-192-cbc>, B<camellia-192-cfb>, B<camellia-192-ctr>, B<camellia-192-ecb>, B<camellia-192-ofb>
  246. Camellia-192 Cipher
  247. =item B<camellia256>, B<camellia-256-cbc>, B<camellia-256-cfb>, B<camellia-256-ctr>, B<camellia-256-ecb>, B<camellia-256-ofb>
  248. Camellia-256 Cipher
  249. =item B<cast>, B<cast-cbc>
  250. CAST Cipher
  251. =item B<cast5-cbc>, B<cast5-cfb>, B<cast5-ecb>, B<cast5-ofb>
  252. CAST5 Cipher
  253. =item B<chacha20>
  254. Chacha20 Cipher
  255. =item B<des>, B<des-cbc>, B<des-cfb>, B<des-ecb>, B<des-ede>, B<des-ede-cbc>, B<des-ede-cfb>, B<des-ede-ofb>, B<des-ofb>
  256. DES Cipher
  257. =item B<des3>, B<desx>, B<des-ede3>, B<des-ede3-cbc>, B<des-ede3-cfb>, B<des-ede3-ofb>
  258. Triple-DES Cipher
  259. =item B<idea>, B<idea-cbc>, B<idea-cfb>, B<idea-ecb>, B<idea-ofb>
  260. IDEA Cipher
  261. =item B<rc2>, B<rc2-cbc>, B<rc2-cfb>, B<rc2-ecb>, B<rc2-ofb>
  262. RC2 Cipher
  263. =item B<rc4>
  264. RC4 Cipher
  265. =item B<rc5>, B<rc5-cbc>, B<rc5-cfb>, B<rc5-ecb>, B<rc5-ofb>
  266. RC5 Cipher
  267. =item B<seed>, B<seed-cbc>, B<seed-cfb>, B<seed-ecb>, B<seed-ofb>
  268. SEED Cipher
  269. =item B<sm4>, B<sm4-cbc>, B<sm4-cfb>, B<sm4-ctr>, B<sm4-ecb>, B<sm4-ofb>
  270. SM4 Cipher
  271. =back
  272. =head1 OPTIONS
  273. Details of which options are available depend on the specific command.
  274. This section describes some common options with common behavior.
  275. =head2 Common Options
  276. =over 4
  277. =item B<-help>
  278. Provides a terse summary of all options.
  279. =back
  280. =head2 Pass Phrase Options
  281. Several commands accept password arguments, typically using B<-passin>
  282. and B<-passout> for input and output passwords respectively. These allow
  283. the password to be obtained from a variety of sources. Both of these
  284. options take a single argument whose format is described below. If no
  285. password argument is given and a password is required then the user is
  286. prompted to enter one: this will typically be read from the current
  287. terminal with echoing turned off.
  288. Note that character encoding may be relevant, please see
  289. L<passphrase-encoding(7)>.
  290. =over 4
  291. =item B<pass:password>
  292. The actual password is B<password>. Since the password is visible
  293. to utilities (like 'ps' under Unix) this form should only be used
  294. where security is not important.
  295. =item B<env:var>
  296. Obtain the password from the environment variable B<var>. Since
  297. the environment of other processes is visible on certain platforms
  298. (e.g. ps under certain Unix OSes) this option should be used with caution.
  299. =item B<file:pathname>
  300. The first line of B<pathname> is the password. If the same B<pathname>
  301. argument is supplied to B<-passin> and B<-passout> arguments then the first
  302. line will be used for the input password and the next line for the output
  303. password. B<pathname> need not refer to a regular file: it could for example
  304. refer to a device or named pipe.
  305. =item B<fd:number>
  306. Read the password from the file descriptor B<number>. This can be used to
  307. send the data via a pipe for example.
  308. =item B<stdin>
  309. Read the password from standard input.
  310. =back
  311. =head1 ENVIRONMENT
  312. =over 4
  313. =item B<OPENSSL_TRACE=>I<name,...>
  314. Enable tracing output of OpenSSL library, by name.
  315. This output will only make sense if you know OpenSSL internals well.
  316. Also, it might not give you any output at all, depending on how
  317. OpenSSL was built.
  318. The value is a comma separated list of names, with the following
  319. available:
  320. =over 4
  321. =item B<TRACE>
  322. The tracing functionality.
  323. =item B<TLS>
  324. General SSL/TLS.
  325. =item B<TLS_CIPHER>
  326. SSL/TLS cipher.
  327. =item B<ENGINE_CONF>
  328. ENGINE configuration.
  329. =item B<ENGINE_TABLE>
  330. The function that is used by RSA, DSA (etc) code to select registered
  331. ENGINEs, cache defaults and functional references (etc), will generate
  332. debugging summaries.
  333. =item B<ENGINE_REF_COUNT>
  334. Reference counts in the ENGINE structure will be monitored with a line
  335. of generated for each change.
  336. =item B<PKCS5V2>
  337. PKCS#5 v2 keygen.
  338. =item B<PKCS12_KEYGEN>
  339. PKCS#12 key generation.
  340. =item B<PKCS12_DECRYPT>
  341. PKCS#12 decryption.
  342. =item B<X509V3_POLICY>
  343. Generates the complete policy tree at various point during X.509 v3
  344. policy evaluation.
  345. =item B<BN_CTX>
  346. BIGNUM context.
  347. =back
  348. =back
  349. =head1 SEE ALSO
  350. L<asn1parse(1)>, L<ca(1)>, L<ciphers(1)>, L<cms(1)>, L<config(5)>,
  351. L<crl(1)>, L<crl2pkcs7(1)>, L<dgst(1)>,
  352. L<dhparam(1)>, L<dsa(1)>, L<dsaparam(1)>,
  353. L<ec(1)>, L<ecparam(1)>,
  354. L<enc(1)>, L<engine(1)>, L<errstr(1)>, L<gendsa(1)>, L<genpkey(1)>,
  355. L<genrsa(1)>, L<kdf(1)>, L<mac(1)>, L<nseq(1)>, L<ocsp(1)>,
  356. L<passwd(1)>,
  357. L<pkcs12(1)>, L<pkcs7(1)>, L<pkcs8(1)>,
  358. L<pkey(1)>, L<pkeyparam(1)>, L<pkeyutl(1)>, L<prime(1)>,
  359. L<rand(1)>, L<rehash(1)>, L<req(1)>, L<rsa(1)>,
  360. L<rsautl(1)>, L<s_client(1)>,
  361. L<s_server(1)>, L<s_time(1)>, L<sess_id(1)>,
  362. L<smime(1)>, L<speed(1)>, L<spkac(1)>, L<srp(1)>, L<storeutl(1)>,
  363. L<ts(1)>,
  364. L<verify(1)>, L<version(1)>, L<x509(1)>,
  365. L<crypto(7)>, L<ssl(7)>, L<x509v3_config(5)>
  366. =head1 HISTORY
  367. The B<list->I<XXX>B<-algorithms> pseudo-commands were added in OpenSSL 1.0.0;
  368. For notes on the availability of other commands, see their individual
  369. manual pages.
  370. =head1 COPYRIGHT
  371. Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
  372. Licensed under the Apache License 2.0 (the "License"). You may not use
  373. this file except in compliance with the License. You can obtain a copy
  374. in the file LICENSE in the source distribution or at
  375. L<https://www.openssl.org/source/license.html>.
  376. =cut