Nachdem ich in den letzten Wochen immer mal wieder mit OpenSSL wegen Heartbleed und Co. zu tun hatte, gibt es hier mal ein paar wissenswerte Befehle und Tipps:
Einen Private Key mit 2048bit erzeugen:openssl genrsa -out 2048
Einen Private Key mit 4096bit erzeugen:openssl genrsa -out 4096
Einen CSR (Certificate Signing Request, Zertifikatsanforderung) erzeugen:openssl req -new -key -out
Anschließend müssen ein paar Fragen beantwortet werden (Beispiel):Country Name (2 letter code) [DE]: DE State or Province Name (full name) [Some-State]: Germany Locality Name (eg, city) []: Berlin Organization Name (eg, company) [Internet Widgits Pty Ltd]: Websenat Organizational Unit Name (eg, section) []: Ecommerce
Wichtig für ein öffentliches Zertifikat ist der “Common Name”. Hier muss der Domainname angegeben werden:Common Name (eg, YOUR name) []: domain.de Email Address []: info@domain.de
Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: An optional company name []:
Passt der Private Key zum Zertifikat (Public Key Match):openssl x509 -noout -modulus -in | openssl md5 openssl rsa -noout -modulus -in | openssl md5
Sind beide Werte identisch, passt es. Ansonsten nicht.
Das kann man natürlich auch mit dem CSR machen:openssl req -noout -modulus -in | openssl md5
Komplettes Zertifikat anzeigen:openssl x509 -noout -text -in
Hash anzeigen:openssl x509 -noout -hash -in
MD5-Fingerprint anzeigen:openssl x509 -noout -fingerprint -in
Ach ja, noch was: !!! DEN PRIVATE KEY NIE NIE NIE WEITERGEBEN !!!