Это старая версия документа!


Сертификаты

Создание полной цепочки

Файлы сертификата:

  • Сертификат
  • CSR-запрос
  • Корневой сертификат
  • Private Key
$ cat Сертификат Корневой_сертификат > lampa-fullchain.crt
$ chown www-data:www-data /etc/nginx/ssl/lampa-fullchain.crt /etc/nginx/ssl/Private_Key
$ chmod 644 /etc/nginx/ssl/lampa-fullchain.crt
$ chmod 600 /etc/nginx/ssl/Private_Key

PEM ↔ DER

$ openssl x509 -in cert.pem -outform der -out cert.der
$ openssl x509 -inform der -in cert.der -out cert.pem

PEM → PKCS#12 (с ключом)

$ openssl pkcs12 -export -in cert.pem -inkey key.pem -out bundle.p12

PKCS#12 → PEM (сертификат + ключ)

$ openssl pkcs12 -in bundle.p12 -out cert.pem -nodes

Извлечение только закрытого ключа из PKCS#12

$ openssl pkcs12 -in bundle.p12 -nocerts -nodes -out private.key
## PEM
openssl x509 -in cert.pem -noout -text
 
## DER:
openssl x509 -in cert.der -inform der -noout -text
 
## PKCS#12:
openssl pkcs12 -in bundle.p12 -nodes -info -nokeys
$ openssl x509 -in /etc/nginx/ssl/command-fewgehe-bot.chickenkiller.com/fullchain.cer -noout -text
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            d6:51:d4:0e:fd:2b:09:ad:9b:af:f2:c6:7a:64:4f:82
        Signature Algorithm: ecdsa-with-SHA384
        Issuer: C=AT, O=ZeroSSL, CN=ZeroSSL ECC Domain Secure Site CA
        Validity
            Not Before: Dec 25 00:00:00 2025 GMT
            Not After : Mar 25 23:59:59 2026 GMT
        Subject: CN=command-fewgehe-bot.chickenkiller.com
        Subject Public Key Info:
            Public Key Algorithm: id-ecPublicKey
                Public-Key: (256 bit)
                pub:
                    04:76:7a:f0:1f:3e:b6:3a:ab:3a:8c:f8:82:ac:8e:
                    36:4b:44:0e:05:a8:e1:61:3a:7a:c2:b6:17:ba:43:
                    a4:1e:a3:0b:74:dc:95:58:a0:ff:90:44:52:45:04:
                    2f:67:d6:2d:2d:28:76:82:9c:33:1e:73:c9:87:0c:
                    2b:bc:6a:c7:45
                ASN1 OID: prime256v1
                NIST CURVE: P-256
        X509v3 extensions:
            X509v3 Authority Key Identifier:
                0F:6B:E6:4B:CE:39:47:AE:F6:7E:90:1E:79:F0:30:91:92:C8:5F:A3
            X509v3 Subject Key Identifier:
                78:0F:78:10:EF:4D:EC:48:E0:27:1F:EF:83:E2:53:7A:5E:9B:09:E0
            X509v3 Key Usage: critical
                Digital Signature
            X509v3 Basic Constraints: critical
                CA:FALSE
            X509v3 Extended Key Usage:
                TLS Web Server Authentication
            X509v3 Certificate Policies:
                Policy: 1.3.6.1.4.1.6449.1.2.2.78
                  CPS: https://sectigo.com/CPS
                Policy: 2.23.140.1.2.1
            Authority Information Access:
                CA Issuers - URI:http://zerossl.crt.sectigo.com/ZeroSSLECCDomainSecureSiteCA.crt
                OCSP - URI:http://zerossl.ocsp.sectigo.com
            CT Precertificate SCTs:
                Signed Certificate Timestamp:
                    Version   : v1 (0x0)
                    Log ID    : 0E:57:94:BC:F3:AE:A9:3E:33:1B:2C:99:07:B3:F7:90:
                                DF:9B:C2:3D:71:32:25:DD:21:A9:25:AC:61:C5:4E:21
                    Timestamp : Dec 25 19:21:33.944 2025 GMT
                    Extensions: none
                    Signature : ecdsa-with-SHA256
                                30:45:02:20:17:DD:98:03:00:BB:8C:E9:2F:1F:30:6A:
                                2B:AD:58:5E:D6:10:2B:66:FE:21:21:E0:5F:CC:26:0D:
                                16:21:CE:C2:02:21:00:8E:BE:97:77:CC:70:66:F0:9D:
                                0C:97:B9:8C:7E:00:66:5B:51:A3:15:D6:34:6B:0B:14:
                                AE:08:24:D3:FE:E0:62
                Signed Certificate Timestamp:
                    Version   : v1 (0x0)
                    Log ID    : D1:6E:A9:A5:68:07:7E:66:35:A0:3F:37:A5:DD:BC:03:
                                A5:3C:41:12:14:D4:88:18:F5:E9:31:B3:23:CB:95:04
                    Timestamp : Dec 25 19:21:34.153 2025 GMT
                    Extensions: none
                    Signature : ecdsa-with-SHA256
                                30:46:02:21:00:F9:4F:32:CA:3B:B5:99:9B:BD:CE:1E:
                                BA:71:A1:CA:75:B2:1F:DB:49:FE:04:E2:38:CB:1D:CB:
                                B7:A0:82:33:0B:02:21:00:B0:D7:F6:7B:42:C4:5A:93:
                                FD:B8:8A:43:33:83:51:88:02:B2:60:E0:34:75:52:D4:
                                1D:D8:47:81:97:AB:E5:8C
            X509v3 Subject Alternative Name:
                DNS:command-fewgehe-bot.chickenkiller.com
    Signature Algorithm: ecdsa-with-SHA384
    Signature Value:
        30:64:02:30:32:e8:1e:29:28:aa:d3:aa:93:78:ce:df:97:6c:
        70:38:77:81:fd:c8:73:d0:0c:26:87:96:e8:f8:6e:cc:27:5e:
        0c:fd:a1:bc:4a:13:70:c9:55:fe:6e:dd:10:fa:13:45:02:30:
        55:8f:93:b2:fc:69:31:d5:10:bb:d8:61:ce:b7:d0:fd:cb:0f:
        c5:c0:77:03:56:18:c6:cd:f8:4c:50:8e:d2:2c:8f:95:52:8c:
        07:d3:ea:aa:f6:3b:de:46:04:e2:5d:dc