aus HisWiki

2.1.7.1 Erzeugen eines SSL Zertifikats

Auf dem Rechner, der verschlüsseln soll, muss das Paket Openssl installiert sein. Ist dies der Fall, kann man als User root ein Zertifikat erzeugen.

Wir führen alle Schritte als user root durch, und gehen z.B. davon aus, dass wir uns im Verzeichnis /root befinden.

Zunächst muss ein Zertifikat erzeugt werden (bitte passen Sie die Verzeichnisnamen jeweils an Ihr OpenSSL-Paket an):

/usr/share/ssl/misc/CA.sh -newca

Unter RedHat verwenden Sie bitte folgenden Befehl:

openssl req -new -x509 -keyout ssl_priv.pem -out ca_cert.pem -days 3650

Sie geben ein Passwort ein und die jeweiligen Angaben (Land, Organisation etc.). Beim "Common Name" muss der DNS-Servername des Servers angegeben werden.

Ein Challenge Passwort ist erst einmal nicht notwendig. Am Ende der Prozedur muss man noch einmal das eingegebene Passwort eingeben.

 

Ein Beispiel

mercury:~ # /usr/share/ssl/misc/CA.sh -newca
CA certificate filename (or enter to create)

Making CA certificate ...
Generating a 1024 bit RSA private key
...................................++++++
..............++++++
writing new private key to './demoCA/private/./cakey.pem'
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:DE
State or Province Name (full name) [Some-State]:NRW
Locality Name (eg, city) []:Wuppertal
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Memtext
Organizational Unit Name (eg, section) []:Workshop
Common Name (eg, YOUR name) []:192.168.0.108
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
Using configuration from /etc/ssl/openssl.cnf
Enter pass phrase for ./demoCA/private/./cakey.pem:
Check that the request matches the signature
Signature ok
Certificate Details:
        Serial Number: 0 (0x0)
        Validity
            Not Before: Mar 13 13:22:45 2007 GMT
            Not After : Mar 12 13:22:45 2010 GMT
        Subject:
...  

Certificate is to be certified until Mar 12 13:22:45 2010 GMT (1095 days)

Write out database with 1 new entries
Data Base Updated

Das öffentliche CA-Zertifikat liegt nun in /root/demoCA/cacert.pem und der private Schlüssel liegt in /root/demoCA/private/cakey.pem ..

Der öffentliche Schlüssel hat das RSA Format. In Java Runtimes und im Browser wird ggf. nur ein X.509 Zeirtifikat erlaubt. Dazu müssen Sie das öffentliche Zertifikat zuerst in das entsprechende DER-Format konvertieren:

openssl x509 -in demoCA/cacert.pem -out capub.crt -outform DER

Es wird die Datei /root/capub.crt erzeugt.