Утилита OpenSSL
Отредактирована 03.12.2025
openssl x509 -in certificate.crt -text -noout
# PEM в DER openssl x509 -in cert.pem -outform der -out cert.der # DER в PEM openssl x509 -in cert.der -inform der -out cert.pem # PFX/P12 в PEM openssl pkcs12 -in cert.pfx -out cert.pem -nodes
openssl verify -CAfile ca-bundle.crt your-cert.crt
# RSA 2048 бит openssl genrsa -out private.key 2048 # С паролем openssl genrsa -aes256 -out private.key 2048 # EC ключ openssl ecparam -genkey -name prime256v1 -out ec.key
openssl req -x509 -new -key private.key -sha256 -days 365 -out cert.crt
openssl req -new -key private.key -out request.csr
# Полная информация openssl s_client -connect example.com:443 -showcerts # С проверкой цепочки openssl s_client -connect example.com:443 -CAfile ca-bundle.crt # Проверка конкретного протокола openssl s_client -connect example.com:443 -tls1_2
openssl s_client -connect example.com:443 2>/dev/null | openssl x509 -noout -dates
# AES-256-CBC openssl enc -aes-256-cbc -salt -in file.txt -out file.enc # Дешифровка openssl enc -aes-256-cbc -d -in file.enc -out file.txt
# MD5 openssl md5 file.txt # SHA256 openssl sha256 file.txt # Создание HMAC openssl dgst -sha256 -hmac "ключ" file.txt
# 32 байта в base64 openssl rand -base64 32 # 16 байт в hex openssl rand -hex 16
openssl speed rsa openssl speed aes openssl speed sha256
Практические примеры OpenSSL:
echo | openssl s_client -connect google.com:443 -servername google.com 2>/dev/null | openssl x509 -noout -subject -dates
# Генерация CA openssl req -x509 -newkey rsa:2048 -days 365 -keyout ca-key.pem -out ca-cert.pem # Генерация серверного сертификата openssl req -newkey rsa:2048 -keyout server-key.pem -out server-req.pem openssl x509 -req -in server-req.pem -CA ca-cert.pem -CAkey ca-key.pem -CAcreateserial -out server-cert.pem
openssl rsa -in private.key -check
- Безопасность ключей: Никогда не передавайте приватные ключи;
- Современные алгоритмы: Используйте минимум RSA 2048 или ECC 256;
- Актуальность: Регулярно обновляйте OpenSSL;
- Пароли: Защищайте ключи паролями при необходимости.
openssl command -h # или man openssl-command