CA.pl.1ossl 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. .\" -*- mode: troff; coding: utf-8 -*-
  2. .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
  3. .\"
  4. .\" Standard preamble:
  5. .\" ========================================================================
  6. .de Sp \" Vertical space (when we can't use .PP)
  7. .if t .sp .5v
  8. .if n .sp
  9. ..
  10. .de Vb \" Begin verbatim text
  11. .ft CW
  12. .nf
  13. .ne \\$1
  14. ..
  15. .de Ve \" End verbatim text
  16. .ft R
  17. .fi
  18. ..
  19. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
  20. .ie n \{\
  21. . ds C` ""
  22. . ds C' ""
  23. 'br\}
  24. .el\{\
  25. . ds C`
  26. . ds C'
  27. 'br\}
  28. .\"
  29. .\" Escape single quotes in literal strings from groff's Unicode transform.
  30. .ie \n(.g .ds Aq \(aq
  31. .el .ds Aq '
  32. .\"
  33. .\" If the F register is >0, we'll generate index entries on stderr for
  34. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  35. .\" entries marked with X<> in POD. Of course, you'll have to process the
  36. .\" output yourself in some meaningful fashion.
  37. .\"
  38. .\" Avoid warning from groff about undefined register 'F'.
  39. .de IX
  40. ..
  41. .nr rF 0
  42. .if \n(.g .if rF .nr rF 1
  43. .if (\n(rF:(\n(.g==0)) \{\
  44. . if \nF \{\
  45. . de IX
  46. . tm Index:\\$1\t\\n%\t"\\$2"
  47. ..
  48. . if !\nF==2 \{\
  49. . nr % 0
  50. . nr F 2
  51. . \}
  52. . \}
  53. .\}
  54. .rr rF
  55. .\" ========================================================================
  56. .\"
  57. .IX Title "CA.PL 1ossl"
  58. .TH CA.PL 1ossl 2025-01-17 3.4.0 OpenSSL
  59. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  60. .\" way too many mistakes in technical documents.
  61. .if n .ad l
  62. .nh
  63. .SH NAME
  64. CA.pl \- friendlier interface for OpenSSL certificate programs
  65. .SH SYNOPSIS
  66. .IX Header "SYNOPSIS"
  67. \&\fBCA.pl\fR
  68. \&\fB\-?\fR |
  69. \&\fB\-h\fR |
  70. \&\fB\-help\fR
  71. .PP
  72. \&\fBCA.pl\fR
  73. \&\fB\-newcert\fR |
  74. \&\fB\-newreq\fR |
  75. \&\fB\-newreq\-nodes\fR |
  76. \&\fB\-xsign\fR |
  77. \&\fB\-sign\fR |
  78. \&\fB\-signCA\fR |
  79. \&\fB\-signcert\fR |
  80. \&\fB\-crl\fR |
  81. \&\fB\-newca\fR
  82. [\fB\-extra\-\fR\f(BIcmd\fR \fIparameter\fR]
  83. .PP
  84. \&\fBCA.pl\fR \fB\-pkcs12\fR [\fIcertname\fR]
  85. .PP
  86. \&\fBCA.pl\fR \fB\-verify\fR \fIcertfile\fR ...
  87. .PP
  88. \&\fBCA.pl\fR \fB\-revoke\fR \fIcertfile\fR [\fIreason\fR]
  89. .SH DESCRIPTION
  90. .IX Header "DESCRIPTION"
  91. The \fBCA.pl\fR script is a perl script that supplies the relevant command line
  92. arguments to the \fBopenssl\fR\|(1) command for some common certificate operations.
  93. It is intended to simplify the process of certificate creation and management
  94. by the use of some simple options.
  95. .PP
  96. The script is intended as a simple front end for the \fBopenssl\fR\|(1) program for
  97. use by a beginner. Its behaviour isn't always what is wanted. For more control
  98. over the behaviour of the certificate commands call the \fBopenssl\fR\|(1) command
  99. directly.
  100. .PP
  101. Most of the filenames mentioned below can be modified by editing the
  102. \&\fBCA.pl\fR script.
  103. .PP
  104. Under some environments it may not be possible to run the \fBCA.pl\fR script
  105. directly (for example Win32) and the default configuration file location may
  106. be wrong. In this case the command:
  107. .PP
  108. .Vb 1
  109. \& perl \-S CA.pl
  110. .Ve
  111. .PP
  112. can be used and the \fBOPENSSL_CONF\fR environment variable can be set to point to
  113. the correct path of the configuration file.
  114. .SH OPTIONS
  115. .IX Header "OPTIONS"
  116. .IP "\fB\-?\fR, \fB\-h\fR, \fB\-help\fR" 4
  117. .IX Item "-?, -h, -help"
  118. Prints a usage message.
  119. .IP \fB\-newcert\fR 4
  120. .IX Item "-newcert"
  121. Creates a new self signed certificate. The private key is written to the file
  122. \&\fInewkey.pem\fR and the request written to the file \fInewreq.pem\fR.
  123. Invokes \fBopenssl\-req\fR\|(1).
  124. .IP \fB\-newreq\fR 4
  125. .IX Item "-newreq"
  126. Creates a new certificate request. The private key is written to the file
  127. \&\fInewkey.pem\fR and the request written to the file \fInewreq.pem\fR.
  128. Executes \fBopenssl\-req\fR\|(1) under the hood.
  129. .IP \fB\-newreq\-nodes\fR 4
  130. .IX Item "-newreq-nodes"
  131. Is like \fB\-newreq\fR except that the private key will not be encrypted.
  132. Uses \fBopenssl\-req\fR\|(1).
  133. .IP \fB\-newca\fR 4
  134. .IX Item "-newca"
  135. Creates a new CA hierarchy for use with the \fBca\fR program (or the \fB\-signcert\fR
  136. and \fB\-xsign\fR options). The user is prompted to enter the filename of the CA
  137. certificates (which should also contain the private key) or by hitting ENTER
  138. details of the CA will be prompted for. The relevant files and directories
  139. are created in a directory called \fIdemoCA\fR in the current directory.
  140. Uses \fBopenssl\-req\fR\|(1) and \fBopenssl\-ca\fR\|(1).
  141. .Sp
  142. If the \fIdemoCA\fR directory already exists then the \fB\-newca\fR command will not
  143. overwrite it and will do nothing. This can happen if a previous call using
  144. the \fB\-newca\fR option terminated abnormally. To get the correct behaviour
  145. delete the directory if it already exists.
  146. .IP \fB\-pkcs12\fR 4
  147. .IX Item "-pkcs12"
  148. Create a PKCS#12 file containing the user certificate, private key and CA
  149. certificate. It expects the user certificate and private key to be in the
  150. file \fInewcert.pem\fR and the CA certificate to be in the file \fIdemoCA/cacert.pem\fR,
  151. it creates a file \fInewcert.p12\fR. This command can thus be called after the
  152. \&\fB\-sign\fR option. The PKCS#12 file can be imported directly into a browser.
  153. If there is an additional argument on the command line it will be used as the
  154. "friendly name" for the certificate (which is typically displayed in the browser
  155. list box), otherwise the name "My Certificate" is used.
  156. Delegates work to \fBopenssl\-pkcs12\fR\|(1).
  157. .IP "\fB\-sign\fR, \fB\-signcert\fR, \fB\-xsign\fR" 4
  158. .IX Item "-sign, -signcert, -xsign"
  159. Calls the \fBopenssl\-ca\fR\|(1) command to sign a certificate request. It expects the
  160. request to be in the file \fInewreq.pem\fR. The new certificate is written to the
  161. file \fInewcert.pem\fR except in the case of the \fB\-xsign\fR option when it is
  162. written to standard output.
  163. .IP \fB\-signCA\fR 4
  164. .IX Item "-signCA"
  165. This option is the same as the \fB\-sign\fR option except it uses the
  166. configuration file section \fBv3_ca\fR and so makes the signed request a
  167. valid CA certificate. This is useful when creating intermediate CA from
  168. a root CA. Extra params are passed to \fBopenssl\-ca\fR\|(1).
  169. .IP \fB\-signcert\fR 4
  170. .IX Item "-signcert"
  171. This option is the same as \fB\-sign\fR except it expects a self signed certificate
  172. to be present in the file \fInewreq.pem\fR.
  173. Extra params are passed to \fBopenssl\-x509\fR\|(1) and \fBopenssl\-ca\fR\|(1).
  174. .IP \fB\-crl\fR 4
  175. .IX Item "-crl"
  176. Generate a CRL. Executes \fBopenssl\-ca\fR\|(1).
  177. .IP "\fB\-revoke\fR \fIcertfile\fR [\fIreason\fR]" 4
  178. .IX Item "-revoke certfile [reason]"
  179. Revoke the certificate contained in the specified \fBcertfile\fR. An optional
  180. reason may be specified, and must be one of: \fBunspecified\fR,
  181. \&\fBkeyCompromise\fR, \fBCACompromise\fR, \fBaffiliationChanged\fR, \fBsuperseded\fR,
  182. \&\fBcessationOfOperation\fR, \fBcertificateHold\fR, or \fBremoveFromCRL\fR.
  183. Leverages \fBopenssl\-ca\fR\|(1).
  184. .IP \fB\-verify\fR 4
  185. .IX Item "-verify"
  186. Verifies certificates against the CA certificate for \fIdemoCA\fR. If no
  187. certificates are specified on the command line it tries to verify the file
  188. \&\fInewcert.pem\fR. Invokes \fBopenssl\-verify\fR\|(1).
  189. .IP "\fB\-extra\-\fR\f(BIcmd\fR \fIparameter\fR" 4
  190. .IX Item "-extra-cmd parameter"
  191. For each option \fBextra\-\fR\f(BIcmd\fR, pass \fIparameter\fR to the \fBopenssl\fR\|(1)
  192. sub-command with the same name as \fIcmd\fR, if that sub-command is invoked.
  193. For example, if \fBopenssl\-req\fR\|(1) is invoked, the \fIparameter\fR given with
  194. \&\fB\-extra\-req\fR will be passed to it.
  195. For multi-word parameters, either repeat the option or quote the \fIparameters\fR
  196. so it looks like one word to your shell.
  197. See the individual command documentation for more information.
  198. .SH EXAMPLES
  199. .IX Header "EXAMPLES"
  200. Create a CA hierarchy:
  201. .PP
  202. .Vb 1
  203. \& CA.pl \-newca
  204. .Ve
  205. .PP
  206. Complete certificate creation example: create a CA, create a request, sign
  207. the request and finally create a PKCS#12 file containing it.
  208. .PP
  209. .Vb 4
  210. \& CA.pl \-newca
  211. \& CA.pl \-newreq
  212. \& CA.pl \-sign
  213. \& CA.pl \-pkcs12 "My Test Certificate"
  214. .Ve
  215. .SH ENVIRONMENT
  216. .IX Header "ENVIRONMENT"
  217. The environment variable \fBOPENSSL\fR may be used to specify the name of
  218. the OpenSSL program. It can be a full pathname, or a relative one.
  219. .PP
  220. The environment variable \fBOPENSSL_CONFIG\fR may be used to specify a
  221. configuration option and value to the \fBreq\fR and \fBca\fR commands invoked by
  222. this script. It's value should be the option and pathname, as in
  223. \&\f(CW\*(C`\-config /path/to/conf\-file\*(C'\fR.
  224. .SH "SEE ALSO"
  225. .IX Header "SEE ALSO"
  226. \&\fBopenssl\fR\|(1),
  227. \&\fBopenssl\-x509\fR\|(1),
  228. \&\fBopenssl\-ca\fR\|(1),
  229. \&\fBopenssl\-req\fR\|(1),
  230. \&\fBopenssl\-pkcs12\fR\|(1),
  231. \&\fBconfig\fR\|(5)
  232. .SH COPYRIGHT
  233. .IX Header "COPYRIGHT"
  234. Copyright 2000\-2021 The OpenSSL Project Authors. All Rights Reserved.
  235. .PP
  236. Licensed under the Apache License 2.0 (the "License"). You may not use
  237. this file except in compliance with the License. You can obtain a copy
  238. in the file LICENSE in the source distribution or at
  239. <https://www.openssl.org/source/license.html>.