The programs do have some flexibility, but I tried to keep the examples small, and so the run-time options you have are limited. As much as possible, the way you specify these options is the same for Java and C. The things you can choose at run-time are:
There are some examples at the end of this page.
There are three "classes" of cipher suites that the progams know about, which you specify by using a series of characters in the "ciphers" argument. These are:
There are different SSL protocols available depending on whether you're using OpenSSL or JSSE. The programs expect you to use a number, where appropriate, to indicate what protocol you're interested in:
For JSSE, 1 and 3 are available; OpenSSL lets you specify any of the four. See the documentation for SSL_CTX_new(3) for more info.
If you're using non-anonymous cipher suites, then the server program will want to send a certificate to the client, and you have to tell the server where to find the certificate, and the client what certificates it should trust. Typically a server will also require a private key, as well as a password for that key.
So when you run one of the server programs you may have to provide these three pieces of information:
For the JSSE environment, you use runtime properties to provide the information to the program:
javax.net.ssl.keyStore
points at the keystore containing a server
certificate and private keyjavax.net.ssl.keyStorePassword
is the password for the keystoreFor VMS/UNIX, you use DCL symbols/environment variables to provide this information:
servercert
points to a PEM file containing the server
certificateprivatekey
points to a PEM file containing the server
certificate's private keyserverpwd
is the password for the private key. If you don't
specify one, then OpenSSL will prompt interactivelyWhen you run one of the client programs, you may have to provide information about where it can find trusted certificates. On Java you use:
javax.net.ssl.trustStore
to point at a keystore containing a
source of trusted certificatesFor VMS/UNIX, you use the DCL symbol/environment variable:
truststore
to point to a PEM file containing one or more trusted certificates.All the programs can display information about what they're doing at run-time. You can turn this on by specifying 't' in the trace argument for each program. Additionally for the Java programs you can use 'j' which will enable Java SSL debugging messages (which can be useful, but voluminous). I didn't come across an equivalent OpenSSL run-time trace facility.
The commands shown for running the C programs are valid for VMS or UNIX,
but require you to define a suitable foreign command on VMS, e.g. $
ExampleSSLServer:==$disk:[dir]ExampleSSLServer.exe
. Note that some of
the commands are split on to several lines for readability.
$ ExampleSSLServer 6000 a 1 t
> java ExampleSSLClient server 6000 a 1
> java -Djavax.net.ssl.keyStore="my.keystore" -Djavax.net.ssl.keyStorePassword="mypassword" ExampleSSLServer 6000 c
csh> setenv truststore cacert.pem csh> ExampleSSLClient server 6000 c 3
$ servercert="server-cert.pem" $ privatekey="private-key.pem" $ serverpwd="password" $ ExampleSSLServer 6000 c 4
> java -Djavax.net.ssl.trustStore="trust.keystore" ExampleSSLClient server 6000 c 1 jt