1 .\" Automatically generated by Pod::Man version 1.15
2 .\" Wed Feb 19 16:49:36 2003
5 .\" ======================================================================
6 .de Sh \" Subsection heading
14 .de Sp \" Vertical space (when we can't use .PP)
20 .ie \\n(.$>=3 .ne \\$3
24 .de Vb \" Begin verbatim text
29 .de Ve \" End verbatim text
34 .\" Set up some character translations and predefined strings. \*(-- will
35 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
36 .\" double quote, and \*(R" will give a right double quote. | will give a
37 .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used
38 .\" to do unbreakable dashes and therefore won't be available. \*(C` and
39 .\" \*(C' expand to `' in nroff, nothing in troff, for use with C<>
41 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
45 . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
46 . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
59 .\" If the F register is turned on, we'll generate index entries on stderr
60 .\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and
61 .\" index entries marked with X<> in POD. Of course, you'll have to process
62 .\" the output yourself in some meaningful fashion.
65 . tm Index:\\$1\t\\n%\t"\\$2"
71 .\" For nroff, turn off justification. Always turn off hyphenation; it
72 .\" makes way too many mistakes in technical documents.
76 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
77 .\" Fear. Run. Save yourself. No user-serviceable parts.
79 . \" fudge factors for nroff and troff
88 . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
94 . \" simple accents for nroff and troff
104 . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
105 . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
106 . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
107 . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
108 . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
109 . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
111 . \" troff and (daisy-wheel) nroff accents
112 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
113 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
114 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
115 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
116 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
117 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
118 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
119 .ds ae a\h'-(\w'a'u*4/10)'e
120 .ds Ae A\h'-(\w'A'u*4/10)'E
121 . \" corrections for vroff
122 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
123 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
124 . \" for low resolution devices (crt and lpr)
125 .if \n(.H>23 .if \n(.V>19 \
138 .\" ======================================================================
141 .TH RSAUTL 1 "0.9.7a" "2003-02-19" "OpenSSL"
144 rsautl \- \s-1RSA\s0 utility
146 .IX Header "SYNOPSIS"
147 \&\fBopenssl\fR \fBrsautl\fR
163 .IX Header "DESCRIPTION"
164 The \fBrsautl\fR command can be used to sign, verify, encrypt and decrypt
165 data using the \s-1RSA\s0 algorithm.
166 .SH "COMMAND OPTIONS"
167 .IX Header "COMMAND OPTIONS"
168 .Ip "\fB\-in filename\fR" 4
169 .IX Item "-in filename"
170 This specifies the input filename to read data from or standard input
171 if this option is not specified.
172 .Ip "\fB\-out filename\fR" 4
173 .IX Item "-out filename"
174 specifies the output filename to write to or standard output by
176 .Ip "\fB\-inkey file\fR" 4
177 .IX Item "-inkey file"
178 the input key file, by default it should be an \s-1RSA\s0 private key.
179 .Ip "\fB\-pubin\fR" 4
181 the input file is an \s-1RSA\s0 public key.
182 .Ip "\fB\-certin\fR" 4
184 the input is a certificate containing an \s-1RSA\s0 public key.
187 sign the input data and output the signed result. This requires
188 and \s-1RSA\s0 private key.
189 .Ip "\fB\-verify\fR" 4
191 verify the input data and output the recovered data.
192 .Ip "\fB\-encrypt\fR" 4
194 encrypt the input data using an \s-1RSA\s0 public key.
195 .Ip "\fB\-decrypt\fR" 4
197 decrypt the input data using an \s-1RSA\s0 private key.
198 .Ip "\fB\-pkcs, \-oaep, \-ssl, \-raw\fR" 4
199 .IX Item "-pkcs, -oaep, -ssl, -raw"
200 the padding to use: PKCS#1 v1.5 (the default), PKCS#1 \s-1OAEP\s0,
201 special padding used in \s-1SSL\s0 v2 backwards compatible handshakes,
202 or no padding, respectively.
203 For signatures, only \fB\-pkcs\fR and \fB\-raw\fR can be used.
204 .Ip "\fB\-hexdump\fR" 4
206 hex dump the output data.
207 .Ip "\fB\-asn1parse\fR" 4
208 .IX Item "-asn1parse"
209 asn1parse the output data, this is useful when combined with the
210 \&\fB\-verify\fR option.
213 \&\fBrsautl\fR because it uses the \s-1RSA\s0 algorithm directly can only be
214 used to sign or verify small pieces of data.
216 .IX Header "EXAMPLES"
217 Sign some data using a private key:
220 \& openssl rsautl -sign -in file -inkey key.pem -out sig
222 Recover the signed data
225 \& openssl rsautl -verify -in sig -inkey key.pem
227 Examine the raw signed data:
230 \& openssl rsautl -verify -in file -inkey key.pem -raw -hexdump
233 \& 0000 - 00 01 ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................
234 \& 0010 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................
235 \& 0020 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................
236 \& 0030 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................
237 \& 0040 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................
238 \& 0050 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................
239 \& 0060 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................
240 \& 0070 - ff ff ff ff 00 68 65 6c-6c 6f 20 77 6f 72 6c 64 .....hello world
242 The PKCS#1 block formatting is evident from this. If this was done using
243 encrypt and decrypt the block would have been of type 2 (the second byte)
244 and random padding data visible instead of the 0xff bytes.
246 It is possible to analyse the signature of certificates using this
247 utility in conjunction with \fBasn1parse\fR. Consider the self signed
248 example in certs/pca-cert.pem . Running \fBasn1parse\fR as follows yields:
251 \& openssl asn1parse -in pca-cert.pem
254 \& 0:d=0 hl=4 l= 742 cons: SEQUENCE
255 \& 4:d=1 hl=4 l= 591 cons: SEQUENCE
256 \& 8:d=2 hl=2 l= 3 cons: cont [ 0 ]
257 \& 10:d=3 hl=2 l= 1 prim: INTEGER :02
258 \& 13:d=2 hl=2 l= 1 prim: INTEGER :00
259 \& 16:d=2 hl=2 l= 13 cons: SEQUENCE
260 \& 18:d=3 hl=2 l= 9 prim: OBJECT :md5WithRSAEncryption
261 \& 29:d=3 hl=2 l= 0 prim: NULL
262 \& 31:d=2 hl=2 l= 92 cons: SEQUENCE
263 \& 33:d=3 hl=2 l= 11 cons: SET
264 \& 35:d=4 hl=2 l= 9 cons: SEQUENCE
265 \& 37:d=5 hl=2 l= 3 prim: OBJECT :countryName
266 \& 42:d=5 hl=2 l= 2 prim: PRINTABLESTRING :AU
268 \& 599:d=1 hl=2 l= 13 cons: SEQUENCE
269 \& 601:d=2 hl=2 l= 9 prim: OBJECT :md5WithRSAEncryption
270 \& 612:d=2 hl=2 l= 0 prim: NULL
271 \& 614:d=1 hl=3 l= 129 prim: BIT STRING
273 The final \s-1BIT\s0 \s-1STRING\s0 contains the actual signature. It can be extracted with:
276 \& openssl asn1parse -in pca-cert.pem -out sig -noout -strparse 614
278 The certificate public key can be extracted with:
281 \& openssl x509 -in test/testx509.pem -pubout -noout >pubkey.pem
283 The signature can be analysed with:
286 \& openssl rsautl -in sig -verify -asn1parse -inkey pubkey.pem -pubin
289 \& 0:d=0 hl=2 l= 32 cons: SEQUENCE
290 \& 2:d=1 hl=2 l= 12 cons: SEQUENCE
291 \& 4:d=2 hl=2 l= 8 prim: OBJECT :md5
292 \& 14:d=2 hl=2 l= 0 prim: NULL
293 \& 16:d=1 hl=2 l= 16 prim: OCTET STRING
294 \& 0000 - f3 46 9e aa 1a 4a 73 c9-37 ea 93 00 48 25 08 b5 .F...Js.7...H%..
296 This is the parsed version of an \s-1ASN1\s0 DigestInfo structure. It can be seen that
297 the digest used was md5. The actual part of the certificate that was signed can
301 \& openssl asn1parse -in pca-cert.pem -out tbs -noout -strparse 4
303 and its digest computed with:
306 \& openssl md5 -c tbs
307 \& MD5(tbs)= f3:46:9e:aa:1a:4a:73:c9:37:ea:93:00:48:25:08:b5
309 which it can be seen agrees with the recovered value above.
311 .IX Header "SEE ALSO"
312 dgst(1), rsa(1), genrsa(1)