1 .\" $NetBSD: libcrypto.pl,v 1.3 2007/11/27 22:16:03 christos Exp $
3 .\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05)
6 .\" ========================================================================
7 .de Sh \" Subsection heading
15 .de Sp \" Vertical space (when we can't use .PP)
19 .de Vb \" Begin verbatim text
24 .de Ve \" End verbatim text
28 .\" Set up some character translations and predefined strings. \*(-- will
29 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
30 .\" double quote, and \*(R" will give a right double quote. \*(C+ will
31 .\" give a nicer C++. Capital omega is used to do unbreakable dashes and
32 .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
33 .\" nothing in troff, for use with C<>.
35 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
39 . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
40 . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
53 .\" Escape single quotes in literal strings from groff's Unicode transform.
57 .\" If the F register is turned on, we'll generate index entries on stderr for
58 .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
59 .\" entries marked with X<> in POD. Of course, you'll have to process the
60 .\" output yourself in some meaningful fashion.
63 . tm Index:\\$1\t\\n%\t"\\$2"
73 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
74 .\" Fear. Run. Save yourself. No user-serviceable parts.
75 . \" fudge factors for nroff and troff
84 . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
90 . \" simple accents for nroff and troff
100 . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
101 . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
102 . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
103 . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
104 . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
105 . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
107 . \" troff and (daisy-wheel) nroff accents
108 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
109 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
110 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
111 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
112 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
113 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
114 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
115 .ds ae a\h'-(\w'a'u*4/10)'e
116 .ds Ae A\h'-(\w'A'u*4/10)'E
117 . \" corrections for vroff
118 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
119 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
120 . \" for low resolution devices (crt and lpr)
121 .if \n(.H>23 .if \n(.V>19 \
134 .\" ========================================================================
136 .IX Title "S_CLIENT 1"
137 .TH S_CLIENT 1 "2009-06-26" "1.1.0-dev" "OpenSSL"
138 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
139 .\" way too many mistakes in technical documents.
143 s_client \- SSL/TLS client program
147 .IX Header "SYNOPSIS"
148 \&\fBopenssl\fR \fBs_client\fR
149 [\fB\-connect host:port\fR]
150 [\fB\-verify depth\fR]
151 [\fB\-cert filename\fR]
152 [\fB\-certform DER|PEM\fR]
153 [\fB\-key filename\fR]
154 [\fB\-keyform DER|PEM\fR]
156 [\fB\-CApath directory\fR]
157 [\fB\-CAfile filename\fR]
176 [\fB\-cipher cipherlist\fR]
177 [\fB\-starttls protocol\fR]
179 [\fB\-tlsextdebug\fR]
181 [\fB\-sess_out filename\fR]
182 [\fB\-sess_in filename\fR]
183 [\fB\-rand file(s)\fR]
185 .IX Header "DESCRIPTION"
186 The \fBs_client\fR command implements a generic \s-1SSL/TLS\s0 client which connects
187 to a remote host using \s-1SSL/TLS\s0. It is a \fIvery\fR useful diagnostic tool for
188 \&\s-1SSL\s0 servers.
191 .IP "\fB\-connect host:port\fR" 4
192 .IX Item "-connect host:port"
193 This specifies the host and optional port to connect to. If not specified
194 then an attempt is made to connect to the local host on port 4433.
195 .IP "\fB\-cert certname\fR" 4
196 .IX Item "-cert certname"
197 The certificate to use, if one is requested by the server. The default is
198 not to use a certificate.
199 .IP "\fB\-certform format\fR" 4
200 .IX Item "-certform format"
201 The certificate format to use: \s-1DER\s0 or \s-1PEM\s0. \s-1PEM\s0 is the default.
202 .IP "\fB\-key keyfile\fR" 4
203 .IX Item "-key keyfile"
204 The private key to use. If not specified then the certificate file will
206 .IP "\fB\-keyform format\fR" 4
207 .IX Item "-keyform format"
208 The private format to use: \s-1DER\s0 or \s-1PEM\s0. \s-1PEM\s0 is the default.
209 .IP "\fB\-pass arg\fR" 4
211 the private key password source. For more information about the format of \fBarg\fR
212 see the \fB\s-1PASS\s0 \s-1PHRASE\s0 \s-1ARGUMENTS\s0\fR section in \fIopenssl\fR\|(1).
213 .IP "\fB\-verify depth\fR" 4
214 .IX Item "-verify depth"
215 The verify depth to use. This specifies the maximum length of the
216 server certificate chain and turns on server certificate verification.
217 Currently the verify operation continues after errors so all the problems
218 with a certificate chain can be seen. As a side effect the connection
219 will never fail due to a server certificate verify failure.
220 .IP "\fB\-CApath directory\fR" 4
221 .IX Item "-CApath directory"
222 The directory to use for server certificate verification. This directory
223 must be in \*(L"hash format\*(R", see \fBverify\fR for more information. These are
224 also used when building the client certificate chain.
225 .IP "\fB\-CAfile file\fR" 4
226 .IX Item "-CAfile file"
227 A file containing trusted certificates to use during server authentication
228 and to use when attempting to build the client certificate chain.
229 .IP "\fB\-purpose, \-ignore_critical, \-issuer_checks, \-crl_check, \-crl_check_all, \-policy_check, \-extended_crl, \-x509_strict, \-policy \-check_ss_sig\fR" 4
230 .IX Item "-purpose, -ignore_critical, -issuer_checks, -crl_check, -crl_check_all, -policy_check, -extended_crl, -x509_strict, -policy -check_ss_sig"
231 Set various certificate chain valiadition option. See the
232 \&\fBverify\fR manual page for details.
233 .IP "\fB\-reconnect\fR" 4
234 .IX Item "-reconnect"
235 reconnects to the same server 5 times using the same session \s-1ID\s0, this can
236 be used as a test that session caching is working.
237 .IP "\fB\-pause\fR" 4
239 pauses 1 second between each read and write call.
240 .IP "\fB\-showcerts\fR" 4
241 .IX Item "-showcerts"
242 display the whole server certificate chain: normally only the server
243 certificate itself is displayed.
244 .IP "\fB\-prexit\fR" 4
246 print session information when the program exits. This will always attempt
247 to print out information even if the connection fails. Normally information
248 will only be printed out once if the connection succeeds. This option is useful
249 because the cipher in use may be renegotiated or the connection may fail
250 because a client certificate is required or is requested only after an
251 attempt is made to access a certain \s-1URL\s0. Note: the output produced by this
252 option is not always accurate because a connection might never have been
254 .IP "\fB\-state\fR" 4
256 prints out the \s-1SSL\s0 session states.
257 .IP "\fB\-debug\fR" 4
259 print extensive debugging information including a hex dump of all traffic.
262 show all protocol messages with hex dump.
263 .IP "\fB\-nbio_test\fR" 4
264 .IX Item "-nbio_test"
265 tests non-blocking I/O
268 turns on non-blocking I/O
271 this option translated a line feed from the terminal into \s-1CR+LF\s0 as required
273 .IP "\fB\-ign_eof\fR" 4
275 inhibit shutting down the connection when end of file is reached in the
277 .IP "\fB\-quiet\fR" 4
279 inhibit printing of session and certificate information. This implicitly
280 turns on \fB\-ign_eof\fR as well.
281 .IP "\fB\-psk_identity identity\fR" 4
282 .IX Item "-psk_identity identity"
283 Use the \s-1PSK\s0 identity \fBidentity\fR when using a \s-1PSK\s0 cipher suite.
284 .IP "\fB\-psk key\fR" 4
286 Use the \s-1PSK\s0 key \fBkey\fR when using a \s-1PSK\s0 cipher suite. The key is
287 given as a hexadecimal number without leading 0x, for example \-psk
289 .IP "\fB\-ssl2\fR, \fB\-ssl3\fR, \fB\-tls1\fR, \fB\-no_ssl2\fR, \fB\-no_ssl3\fR, \fB\-no_tls1\fR" 4
290 .IX Item "-ssl2, -ssl3, -tls1, -no_ssl2, -no_ssl3, -no_tls1"
291 these options disable the use of certain \s-1SSL\s0 or \s-1TLS\s0 protocols. By default
292 the initial handshake uses a method which should be compatible with all
293 servers and permit them to use \s-1SSL\s0 v3, \s-1SSL\s0 v2 or \s-1TLS\s0 as appropriate.
295 Unfortunately there are a lot of ancient and broken servers in use which
296 cannot handle this technique and will fail to connect. Some servers only
297 work if \s-1TLS\s0 is turned off with the \fB\-no_tls\fR option others will only
298 support \s-1SSL\s0 v2 and may need the \fB\-ssl2\fR option.
301 there are several known bug in \s-1SSL\s0 and \s-1TLS\s0 implementations. Adding this
302 option enables various workarounds.
303 .IP "\fB\-cipher cipherlist\fR" 4
304 .IX Item "-cipher cipherlist"
305 this allows the cipher list sent by the client to be modified. Although
306 the server determines which cipher suite is used it should take the first
307 supported cipher in the list sent by the client. See the \fBciphers\fR
308 command for more information.
309 .IP "\fB\-starttls protocol\fR" 4
310 .IX Item "-starttls protocol"
311 send the protocol-specific message(s) to switch to \s-1TLS\s0 for communication.
312 \&\fBprotocol\fR is a keyword for the intended protocol. Currently, the only
313 supported keywords are \*(L"smtp\*(R", \*(L"pop3\*(R", \*(L"imap\*(R", and \*(L"ftp\*(R".
314 .IP "\fB\-tlsextdebug\fR" 4
315 .IX Item "-tlsextdebug"
316 print out a hex dump of any \s-1TLS\s0 extensions received from the server.
317 .IP "\fB\-no_ticket\fR" 4
318 .IX Item "-no_ticket"
319 disable RFC4507bis session ticket support.
320 .IP "\fB\-sess_out filename\fR" 4
321 .IX Item "-sess_out filename"
322 output \s-1SSL\s0 session to \fBfilename\fR
323 .IP "\fB\-sess_in sess.pem\fR" 4
324 .IX Item "-sess_in sess.pem"
325 load \s-1SSL\s0 session from \fBfilename\fR. The client will attempt to resume a
326 connection from this session.
327 .IP "\fB\-engine id\fR" 4
328 .IX Item "-engine id"
329 specifying an engine (by its unique \fBid\fR string) will cause \fBs_client\fR
330 to attempt to obtain a functional reference to the specified engine,
331 thus initialising it if needed. The engine will then be set as the default
332 for all available algorithms.
333 .IP "\fB\-rand file(s)\fR" 4
334 .IX Item "-rand file(s)"
335 a file or files containing random data used to seed the random number
336 generator, or an \s-1EGD\s0 socket (see \fIRAND_egd\fR\|(3)).
337 Multiple files can be specified separated by a OS-dependent character.
338 The separator is \fB;\fR for MS-Windows, \fB,\fR for OpenVMS, and \fB:\fR for
340 .SH "CONNECTED COMMANDS"
341 .IX Header "CONNECTED COMMANDS"
342 If a connection is established with an \s-1SSL\s0 server then any data received
343 from the server is displayed and any key presses will be sent to the
344 server. When used interactively (which means neither \fB\-quiet\fR nor \fB\-ign_eof\fR
345 have been given), the session will be renegotiated if the line begins with an
346 \&\fBR\fR, and if the line begins with a \fBQ\fR or if end of file is reached, the
347 connection will be closed down.
350 \&\fBs_client\fR can be used to debug \s-1SSL\s0 servers. To connect to an \s-1SSL\s0 \s-1HTTP\s0
354 \& openssl s_client \-connect servername:443
357 would typically be used (https uses port 443). If the connection succeeds
358 then an \s-1HTTP\s0 command can be given such as \*(L"\s-1GET\s0 /\*(R" to retrieve a web page.
360 If the handshake fails then there are several possible causes, if it is
361 nothing obvious like no client certificate then the \fB\-bugs\fR, \fB\-ssl2\fR,
362 \&\fB\-ssl3\fR, \fB\-tls1\fR, \fB\-no_ssl2\fR, \fB\-no_ssl3\fR, \fB\-no_tls1\fR options can be tried
363 in case it is a buggy server. In particular you should play with these
364 options \fBbefore\fR submitting a bug report to an OpenSSL mailing list.
366 A frequent problem when attempting to get client certificates working
367 is that a web client complains it has no certificates or gives an empty
368 list to choose from. This is normally because the server is not sending
369 the clients certificate authority in its \*(L"acceptable \s-1CA\s0 list\*(R" when it
370 requests a certificate. By using \fBs_client\fR the \s-1CA\s0 list can be viewed
371 and checked. However some servers only request client authentication
372 after a specific \s-1URL\s0 is requested. To obtain the list in this case it
373 is necessary to use the \fB\-prexit\fR option and send an \s-1HTTP\s0 request
374 for an appropriate page.
376 If a certificate is specified on the command line using the \fB\-cert\fR
377 option it will not be used unless the server specifically requests
378 a client certificate. Therefor merely including a client certificate
379 on the command line is no guarantee that the certificate works.
381 If there are problems verifying a server certificate then the
382 \&\fB\-showcerts\fR option can be used to show the whole chain.
384 Since the SSLv23 client hello cannot include compression methods or extensions
385 these will only be supported if its use is disabled, for example by using the
386 \&\fB\-no_sslv2\fR option.
389 Because this program has a lot of options and also because some of
390 the techniques used are rather old, the C source of s_client is rather
391 hard to read and not a model of how things should be done. A typical
392 \&\s-1SSL\s0 client program would be much simpler.
394 The \fB\-verify\fR option should really exit if the server verification
397 The \fB\-prexit\fR option is a bit of a hack. We should really report
398 information whenever a session is renegotiated.
400 .IX Header "SEE ALSO"
401 \&\fIopenssl_sess_id\fR\|(1), \fIopenssl_s_server\fR\|(1), \fIopenssl_ciphers\fR\|(1)