it-wiki:ssl:openssl
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
it-wiki:ssl:openssl [2022/11/04 13:47] – [Kleine OpenSSL FAQ Ecke] marko | it-wiki:ssl:openssl [2024/03/30 16:10] (aktuell) – [Creating a Private Key] marko | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
====== OpenSSL ====== | ====== OpenSSL ====== | ||
===== Kleine OpenSSL FAQ Ecke ===== | ===== Kleine OpenSSL FAQ Ecke ===== | ||
- | * [[openssl_faq|OpenSSL FAQ]] | + | * [[openssl_faq|OpenSSL FAQ]]\\ |
+ | * [[allgemeines_zu_zertifikaten|So unterscheiden sich Clientzertifikate von Serverzertifikaten]] | ||
+ | \\ | ||
+ | \\ | ||
+ | ===== Creating a Self-Signed Certificate With OpenSSL ===== | ||
+ | ==== Creating a Private Key ==== | ||
+ | First, we’ll create a private key. A private key helps to enable encryption, and is the most important component of our certificate. | ||
+ | |||
+ | Let’s create a password-protected, | ||
+ | <code bash> | ||
+ | openssl genrsa -des3 -out domain.key 2048 | ||
+ | </ | ||
+ | We’ll enter a password when prompted. The output will look like: | ||
+ | <code bash> | ||
+ | Generating RSA private key, 2048 bit long modulus (2 primes) | ||
+ | .....................+++++ | ||
+ | .........+++++ | ||
+ | e is 65537 (0x010001) | ||
+ | Enter pass phrase for domain.key: | ||
+ | Verifying - Enter pass phrase for domain.key: | ||
+ | </ | ||
+ | If we want our private key unencrypted, | ||
+ | |||
+ | Nun wird die Passphrase aus dem Schlüssel entfernt. | ||
+ | <code bash> | ||
+ | root@linux# openssl rsa -in domain.key -out domain.key | ||
+ | Enter pass phrase for serverkey.pem: | ||
+ | writing RSA key | ||
+ | </ | ||
+ | |||
+ | ==== Creating a Certificate Signing Request ==== | ||
+ | If we want our certificate signed, we need a certificate signing request (CSR). The CSR includes the public key and some additional information (such as organization and country). | ||
+ | |||
+ | Let’s create a CSR (domain.csr) from our existing private key: | ||
+ | <code bash> | ||
+ | openssl req -key domain.key -new -out domain.csr | ||
+ | </ | ||
+ | |||
+ | We’ll enter our private key password and some CSR information to complete the process. The output will look like: | ||
+ | <code bash> | ||
+ | Enter pass phrase for domain.key: | ||
+ | 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 ' | ||
+ | ----- | ||
+ | Country Name (2 letter code) [AU]:AU | ||
+ | State or Province Name (full name) [Some-State]: | ||
+ | Locality Name (eg, city) []:cityA | ||
+ | Organization Name (eg, company) [Internet Widgits Pty Ltd]: | ||
+ | Organizational Unit Name (eg, section) []: | ||
+ | Common Name (e.g. server FQDN or YOUR name) []:domain | ||
+ | Email Address []: | ||
+ | |||
+ | Please enter the following ' | ||
+ | to be sent with your certificate request | ||
+ | A challenge password []: | ||
+ | An optional company name []: | ||
+ | </ | ||
+ | An important field is “Common Name,” which should be the exact Fully Qualified Domain Name (FQDN) of our domain. | ||
+ | |||
+ | “A challenge password” and “An optional company name” can be left empty. | ||
+ | |||
+ | ==== Creating a Self-Signed Certificate ==== | ||
+ | A self-signed certificate is [b]a certificate that’s signed with its own private key[/b]. It can be used to encrypt data just as well as CA-signed certificates, | ||
+ | |||
+ | Let’s create a self-signed certificate (domain.crt) with our existing private key and CSR: | ||
+ | <code bash> | ||
+ | openssl x509 -signkey domain.key -in domain.csr -req -days 365 -out domain.crt | ||
+ | </ | ||
\\ | \\ | ||
\\ | \\ | ||
Zeile 195: | Zeile 267: | ||
Wohin sie die Zertifikate installieren, | Wohin sie die Zertifikate installieren, | ||
- | ==== Testen des Zertifikates ==== | + | |
- | Die Seite [[https:// | + |
it-wiki/ssl/openssl.1667569673.txt.gz · Zuletzt geändert: von marko