CA.pl.1 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. .\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35)
  2. .\"
  3. .\" Standard preamble:
  4. .\" ========================================================================
  5. .de Sp \" Vertical space (when we can't use .PP)
  6. .if t .sp .5v
  7. .if n .sp
  8. ..
  9. .de Vb \" Begin verbatim text
  10. .ft CW
  11. .nf
  12. .ne \\$1
  13. ..
  14. .de Ve \" End verbatim text
  15. .ft R
  16. .fi
  17. ..
  18. .\" Set up some character translations and predefined strings. \*(-- will
  19. .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
  20. .\" double quote, and \*(R" will give a right double quote. \*(C+ will
  21. .\" give a nicer C++. Capital omega is used to do unbreakable dashes and
  22. .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
  23. .\" nothing in troff, for use with C<>.
  24. .tr \(*W-
  25. .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
  26. .ie n \{\
  27. . ds -- \(*W-
  28. . ds PI pi
  29. . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
  30. . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
  31. . ds L" ""
  32. . ds R" ""
  33. . ds C` ""
  34. . ds C' ""
  35. 'br\}
  36. .el\{\
  37. . ds -- \|\(em\|
  38. . ds PI \(*p
  39. . ds L" ``
  40. . ds R" ''
  41. . ds C`
  42. . ds C'
  43. 'br\}
  44. .\"
  45. .\" Escape single quotes in literal strings from groff's Unicode transform.
  46. .ie \n(.g .ds Aq \(aq
  47. .el .ds Aq '
  48. .\"
  49. .\" If the F register is >0, we'll generate index entries on stderr for
  50. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  51. .\" entries marked with X<> in POD. Of course, you'll have to process the
  52. .\" output yourself in some meaningful fashion.
  53. .\"
  54. .\" Avoid warning from groff about undefined register 'F'.
  55. .de IX
  56. ..
  57. .if !\nF .nr F 0
  58. .if \nF>0 \{\
  59. . de IX
  60. . tm Index:\\$1\t\\n%\t"\\$2"
  61. ..
  62. . if !\nF==2 \{\
  63. . nr % 0
  64. . nr F 2
  65. . \}
  66. .\}
  67. .\"
  68. .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
  69. .\" Fear. Run. Save yourself. No user-serviceable parts.
  70. . \" fudge factors for nroff and troff
  71. .if n \{\
  72. . ds #H 0
  73. . ds #V .8m
  74. . ds #F .3m
  75. . ds #[ \f1
  76. . ds #] \fP
  77. .\}
  78. .if t \{\
  79. . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
  80. . ds #V .6m
  81. . ds #F 0
  82. . ds #[ \&
  83. . ds #] \&
  84. .\}
  85. . \" simple accents for nroff and troff
  86. .if n \{\
  87. . ds ' \&
  88. . ds ` \&
  89. . ds ^ \&
  90. . ds , \&
  91. . ds ~ ~
  92. . ds /
  93. .\}
  94. .if t \{\
  95. . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
  96. . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
  97. . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
  98. . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
  99. . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
  100. . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
  101. .\}
  102. . \" troff and (daisy-wheel) nroff accents
  103. .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  104. .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  105. .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  106. .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  107. .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  108. .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  109. .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  110. .ds ae a\h'-(\w'a'u*4/10)'e
  111. .ds Ae A\h'-(\w'A'u*4/10)'E
  112. . \" corrections for vroff
  113. .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  114. .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  115. . \" for low resolution devices (crt and lpr)
  116. .if \n(.H>23 .if \n(.V>19 \
  117. \{\
  118. . ds : e
  119. . ds 8 ss
  120. . ds o a
  121. . ds d- d\h'-1'\(ga
  122. . ds D- D\h'-1'\(hy
  123. . ds th \o'bp'
  124. . ds Th \o'LP'
  125. . ds ae ae
  126. . ds Ae AE
  127. .\}
  128. .rm #[ #] #H #V #F C
  129. .\" ========================================================================
  130. .\"
  131. .IX Title "CA.PL 1"
  132. .TH CA.PL 1 "2019-09-12" "1.0.2g" "OpenSSL"
  133. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  134. .\" way too many mistakes in technical documents.
  135. .if n .ad l
  136. .nh
  137. .SH "NAME"
  138. CA.pl \- friendlier interface for OpenSSL certificate programs
  139. .SH "SYNOPSIS"
  140. .IX Header "SYNOPSIS"
  141. \&\fB\s-1CA\s0.pl\fR
  142. [\fB\-?\fR]
  143. [\fB\-h\fR]
  144. [\fB\-help\fR]
  145. [\fB\-newcert\fR]
  146. [\fB\-newreq\fR]
  147. [\fB\-newreq\-nodes\fR]
  148. [\fB\-newca\fR]
  149. [\fB\-xsign\fR]
  150. [\fB\-sign\fR]
  151. [\fB\-signreq\fR]
  152. [\fB\-signcert\fR]
  153. [\fB\-verify\fR]
  154. [\fBfiles\fR]
  155. .SH "DESCRIPTION"
  156. .IX Header "DESCRIPTION"
  157. The \fB\s-1CA\s0.pl\fR script is a perl script that supplies the relevant command line
  158. arguments to the \fBopenssl\fR command for some common certificate operations.
  159. It is intended to simplify the process of certificate creation and management
  160. by the use of some simple options.
  161. .SH "COMMAND OPTIONS"
  162. .IX Header "COMMAND OPTIONS"
  163. .IP "\fB?\fR, \fB\-h\fR, \fB\-help\fR" 4
  164. .IX Item "?, -h, -help"
  165. prints a usage message.
  166. .IP "\fB\-newcert\fR" 4
  167. .IX Item "-newcert"
  168. creates a new self signed certificate. The private key is written to the file
  169. \&\*(L"newkey.pem\*(R" and the request written to the file \*(L"newreq.pem\*(R".
  170. .IP "\fB\-newreq\fR" 4
  171. .IX Item "-newreq"
  172. creates a new certificate request. The private key is written to the file
  173. \&\*(L"newkey.pem\*(R" and the request written to the file \*(L"newreq.pem\*(R".
  174. .IP "\fB\-newreq\-nodes\fR" 4
  175. .IX Item "-newreq-nodes"
  176. is like \fB\-newreq\fR except that the private key will not be encrypted.
  177. .IP "\fB\-newca\fR" 4
  178. .IX Item "-newca"
  179. creates a new \s-1CA\s0 hierarchy for use with the \fBca\fR program (or the \fB\-signcert\fR
  180. and \fB\-xsign\fR options). The user is prompted to enter the filename of the \s-1CA\s0
  181. certificates (which should also contain the private key) or by hitting \s-1ENTER\s0
  182. details of the \s-1CA\s0 will be prompted for. The relevant files and directories
  183. are created in a directory called \*(L"demoCA\*(R" in the current directory.
  184. .IP "\fB\-pkcs12\fR" 4
  185. .IX Item "-pkcs12"
  186. create a PKCS#12 file containing the user certificate, private key and \s-1CA\s0
  187. certificate. It expects the user certificate and private key to be in the
  188. file \*(L"newcert.pem\*(R" and the \s-1CA\s0 certificate to be in the file demoCA/cacert.pem,
  189. it creates a file \*(L"newcert.p12\*(R". This command can thus be called after the
  190. \&\fB\-sign\fR option. The PKCS#12 file can be imported directly into a browser.
  191. If there is an additional argument on the command line it will be used as the
  192. \&\*(L"friendly name\*(R" for the certificate (which is typically displayed in the browser
  193. list box), otherwise the name \*(L"My Certificate\*(R" is used.
  194. .IP "\fB\-sign\fR, \fB\-signreq\fR, \fB\-xsign\fR" 4
  195. .IX Item "-sign, -signreq, -xsign"
  196. calls the \fBca\fR program to sign a certificate request. It expects the request
  197. to be in the file \*(L"newreq.pem\*(R". The new certificate is written to the file
  198. \&\*(L"newcert.pem\*(R" except in the case of the \fB\-xsign\fR option when it is written
  199. to standard output.
  200. .IP "\fB\-signCA\fR" 4
  201. .IX Item "-signCA"
  202. this option is the same as the \fB\-signreq\fR option except it uses the configuration
  203. file section \fBv3_ca\fR and so makes the signed request a valid \s-1CA\s0 certificate. This
  204. is useful when creating intermediate \s-1CA\s0 from a root \s-1CA.\s0
  205. .IP "\fB\-signcert\fR" 4
  206. .IX Item "-signcert"
  207. this option is the same as \fB\-sign\fR except it expects a self signed certificate
  208. to be present in the file \*(L"newreq.pem\*(R".
  209. .IP "\fB\-verify\fR" 4
  210. .IX Item "-verify"
  211. verifies certificates against the \s-1CA\s0 certificate for \*(L"demoCA\*(R". If no certificates
  212. are specified on the command line it tries to verify the file \*(L"newcert.pem\*(R".
  213. .IP "\fBfiles\fR" 4
  214. .IX Item "files"
  215. one or more optional certificate file names for use with the \fB\-verify\fR command.
  216. .SH "EXAMPLES"
  217. .IX Header "EXAMPLES"
  218. Create a \s-1CA\s0 hierarchy:
  219. .PP
  220. .Vb 1
  221. \& CA.pl \-newca
  222. .Ve
  223. .PP
  224. Complete certificate creation example: create a \s-1CA,\s0 create a request, sign
  225. the request and finally create a PKCS#12 file containing it.
  226. .PP
  227. .Vb 4
  228. \& CA.pl \-newca
  229. \& CA.pl \-newreq
  230. \& CA.pl \-signreq
  231. \& CA.pl \-pkcs12 "My Test Certificate"
  232. .Ve
  233. .SH "DSA CERTIFICATES"
  234. .IX Header "DSA CERTIFICATES"
  235. Although the \fB\s-1CA\s0.pl\fR creates \s-1RSA\s0 CAs and requests it is still possible to
  236. use it with \s-1DSA\s0 certificates and requests using the \fIreq\fR\|(1) command
  237. directly. The following example shows the steps that would typically be taken.
  238. .PP
  239. Create some \s-1DSA\s0 parameters:
  240. .PP
  241. .Vb 1
  242. \& openssl dsaparam \-out dsap.pem 1024
  243. .Ve
  244. .PP
  245. Create a \s-1DSA CA\s0 certificate and private key:
  246. .PP
  247. .Vb 1
  248. \& openssl req \-x509 \-newkey dsa:dsap.pem \-keyout cacert.pem \-out cacert.pem
  249. .Ve
  250. .PP
  251. Create the \s-1CA\s0 directories and files:
  252. .PP
  253. .Vb 1
  254. \& CA.pl \-newca
  255. .Ve
  256. .PP
  257. enter cacert.pem when prompted for the \s-1CA\s0 file name.
  258. .PP
  259. Create a \s-1DSA\s0 certificate request and private key (a different set of parameters
  260. can optionally be created first):
  261. .PP
  262. .Vb 1
  263. \& openssl req \-out newreq.pem \-newkey dsa:dsap.pem
  264. .Ve
  265. .PP
  266. Sign the request:
  267. .PP
  268. .Vb 1
  269. \& CA.pl \-signreq
  270. .Ve
  271. .SH "NOTES"
  272. .IX Header "NOTES"
  273. Most of the filenames mentioned can be modified by editing the \fB\s-1CA\s0.pl\fR script.
  274. .PP
  275. If the demoCA directory already exists then the \fB\-newca\fR command will not
  276. overwrite it and will do nothing. This can happen if a previous call using
  277. the \fB\-newca\fR option terminated abnormally. To get the correct behaviour
  278. delete the demoCA directory if it already exists.
  279. .PP
  280. Under some environments it may not be possible to run the \fB\s-1CA\s0.pl\fR script
  281. directly (for example Win32) and the default configuration file location may
  282. be wrong. In this case the command:
  283. .PP
  284. .Vb 1
  285. \& perl \-S CA.pl
  286. .Ve
  287. .PP
  288. can be used and the \fB\s-1OPENSSL_CONF\s0\fR environment variable changed to point to
  289. the correct path of the configuration file \*(L"openssl.cnf\*(R".
  290. .PP
  291. The script is intended as a simple front end for the \fBopenssl\fR program for use
  292. by a beginner. Its behaviour isn't always what is wanted. For more control over the
  293. behaviour of the certificate commands call the \fBopenssl\fR command directly.
  294. .SH "ENVIRONMENT VARIABLES"
  295. .IX Header "ENVIRONMENT VARIABLES"
  296. The variable \fB\s-1OPENSSL_CONF\s0\fR if defined allows an alternative configuration
  297. file location to be specified, it should contain the full path to the
  298. configuration file, not just its directory.
  299. .SH "SEE ALSO"
  300. .IX Header "SEE ALSO"
  301. \&\fIx509\fR\|(1), \fIca\fR\|(1), \fIreq\fR\|(1), \fIpkcs12\fR\|(1),
  302. \&\fIconfig\fR\|(5)