====== openssl ====== ===== Информация о сертификате ===== информация openssl x509 -in cert.pem -text -noout Даты openssl x509 -in cert.pem -dates -noout Дата окончания openssl x509 -in cert.pem -enddate-noout ===== Генерация самоподписанного сертификата ===== openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout selfsigned.key -out selfsigned.crt ===== Конвертация DER (.crt .cer .der) в PEM ===== openssl x509 -inform der -in certificate.cer -out certificate.pem ===== Конвертация x509 в pfx ===== openssl pkcs12 -export -out selfsigned.pfx -inkey selfsigned.key -in selfsigned.crt ===== Конвертация pfx в отдельные файлы .crt и .key ===== Экстрагируем сертификат: openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [certificate.crt] Получаем RSA ключ с паролем openssl pkcs12 -in [yourfile.pfx] -nocerts -out [keyfile-encrypted.key] Получаем RSA ключ без пароля: openssl rsa -in [keyfile-encrypted.key] -out [keyfile-decrypted.key] ===== Проверка HTTPS ===== echo | openssl s_client -connect [ip-or-host]:443 -servername [host] 2>/dev/null | openssl x509 -noout -enddate ===== Проверка SMTP ===== openssl s_client -connect [ip-or-host]:25 -CAfile CA-cert.pem -starttls smtp | openssl x509 -enddate -noout {{tag> openssl }}