Certificate questions Peter Antman To do something really useful with SSL (and thereby SSLtcl) one have to be able to handle certificate. This can sometimes be a little hard to learn, so here are a few word about what to do to create certificates. Autentication in SSL is partly done through a chain of signed certificates, where there somewhere in the end is a signer that you have good reason to trust. For Netscape-servers and clients, and even for apache-ssl, there are certain organizations that acts as Certificate Authorities. To have a website that people really know are your you can create a certificate and get an authority that everybody trust to guaranty that this certificate it really yours. In the lingua franca of SSL (and SSLtcl) we can hereby speak of two different kind of certificate. One is a CA certificate. That is, it is a certificate that you uses to verify other certificates against. The other is your own certificate, that is signed by someone else, in SSLtcl called cert. You will also have a private key that accompanies the certificate (where your public key is). I don't know if any CA will sign certificates for use in SSLtcl based applications. But you can set up your own CA and creates your own certificates. In the demo directory there is includes a demoCA directory. In it I have placed a demo CA certificate and a signed certificate. The private keys are removed prom there password so that they can be used by anybody. But when you start using SSLtcl you probably wants to create your own certificates. The easiest way to do that is to use the script CA.sh in the demo directory. This is a slightly modified version of the CA.sh that comes with SSLeay. Create a directory where you want to store your certificates and copy CA.sh there or start ut with its full path. The following command will set a demoCA up for you and create a CA certificate, that is a self signed certificate. CH.sh -newca You will be asked some questions, just answer them the best you can. If you are running a website you should however pay attention to the question about your common name. Several clients demand that this is not your personal name but the domainname of the server. You are now a CA authority. Time to sign some certificates. You begin by creating a certificate request: CA.sh -newreq and answers the questions again. Now you send it to your CA which is you and you sign it: CA.sh -sign By now you have a CAfile, a cert and a key. The key to use is the key that was generated when you did your request, not your CA. As you saw you had to fill in a password or passphrase each time you generated a certificate. This is to protect the private key. Anybody thats gets hold of your plain private key can pretend his you. So it should be protected. But sometimes it is quite boring to have to type the passfrase every time you do something with a key. Luckily the passfrase can be removed with the following command: ssleay rsa -in key.pwprotected -out key.plain You will find ssleay in the bin directory under ssl. I couple of questions might remain. How to I do to get a (Netscape) client to accept my new CA? Here is a small cgi-bin script that handle just that. You call it without argument from a webpage and the client will have it send to it, and reject or save it. The only thing you have to do is to convert your CA from pem to der encoded this way: x509 -inform pem -outform der < newca.pem > newca.der #!/bin/sh # ca-cert.sh # # (c) Peter Antman, 1997. # # cgi-bin-script to send a server ca file to netscape. # The script is called witout any argument, and the der-encoded certificate # is specified in the variable ''certfile'' certfile=/home/www/certs/newca.der if [ -e $certfile ]; then echo ''Content-Type: application/x-x509-ca-cert''; echo cat $certfile else cat << END Content-Type: text/html