Инструменты пользователя

Инструменты сайта


howto:utils:openssl

Различия

Здесь показаны различия между двумя версиями данной страницы.

Ссылка на это сравнение

Предыдущая версия справа и слева Предыдущая версия
Следующая версия
Предыдущая версия
howto:utils:openssl [2019/01/17 14:07]
Алексей Кожевников ↷ Страница перемещена из howto:openssl в howto:utils:openssl
howto:utils:openssl [2023/05/17 15:42] (текущий)
Алексей Кожевников
Строка 2: Строка 2:
  
 ===== Информация о сертификате ===== ===== Информация о сертификате =====
-Вся ​информация + 
-<​code>​openssl x509 -in cert.pem -text -noout</​code>​+информация 
 + 
 +<​code>​ 
 +openssl x509 -in cert.pem -text -noout 
 +</​code>​ 
 Даты Даты
-<​code>​openssl x509 -in cert.pem -dates -noout</​code>​+ 
 +<​code>​ 
 +openssl x509 -in cert.pem -dates -noout 
 +</​code>​ 
 Дата окончания Дата окончания
-<​code>​openssl x509 -in cert.pem -enddate-noout</​code>​+ 
 +<​code>​ 
 +openssl x509 -in cert.pem -enddate-noout 
 +</​code>​ 
 + 
 +===== Генерация самоподписанного сертификата ===== 
 + 
 +<​code>​ 
 +openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout selfsigned.key -out selfsigned.crt 
 +</​code>​ 
 + 
 +===== Конвертация DER (.crt .cer .der) в PEM ===== 
 + 
 +<​code>​ 
 +openssl x509 -inform der -in certificate.cer -out certificate.pem 
 +</​code>​ 
 + 
 +===== Конвертация x509 в pfx ===== 
 + 
 +<​code>​ 
 +openssl pkcs12 -export -out selfsigned.pfx -inkey selfsigned.key -in selfsigned.crt 
 +</​code>​
  
 ===== Конвертация pfx в отдельные файлы .crt и .key ===== ===== Конвертация pfx в отдельные файлы .crt и .key =====
  
 Экстрагируем сертификат:​ Экстрагируем сертификат:​
-<​code>​openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [certificate.crt]</​code>​+ 
 +<​code>​ 
 +openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [certificate.crt] 
 +</​code>​ 
 Получаем RSA ключ с паролем Получаем RSA ключ с паролем
-<​code>​openssl pkcs12 -in [yourfile.pfx] -nocerts -out [keyfile-encrypted.key]</​code>​+ 
 +<​code>​ 
 +openssl pkcs12 -in [yourfile.pfx] -nocerts -out [keyfile-encrypted.key] 
 +</​code>​ 
 Получаем RSA ключ без пароля:​ Получаем RSA ключ без пароля:​
-<​code>​openssl rsa -in [keyfile-encrypted.key] -out [keyfile-decrypted.key]</​code>​ 
-Получаем PEM ключ: 
-<​code>​openssl rsa -in [keyfile-encrypted.key] -outform PEM -out [keyfile-encrypted-pem.key]</​code>​ 
  
-===== Проверка SMTP =====+<​code>​ 
 +openssl rsa -in [keyfile-encrypted.key] -out [keyfile-decrypted.key] 
 +</​code>​
  
-<​code>​ openssl s_client -connect [ip-or-host]:​25 -CAfile CA-cert.pem -starttls smtp | openssl x509 -enddate -noout</​code>​ 
  
 +===== Проверка HTTPS =====
 +
 +<​code>​
 +echo | openssl s_client -connect [ip-or-host]:​443 -servername [host] 2>/​dev/​null | openssl x509 -noout -enddate
 +</​code>​
 +
 +===== Проверка SMTP =====
 +
 +<​code>​
 + ​openssl s_client -connect [ip-or-host]:​25 -CAfile CA-cert.pem -starttls smtp | openssl x509 -enddate -noout
 +</​code>​
  
 {{tag> openssl }} {{tag> openssl }}
 +
 +
howto/utils/openssl.1547723250.txt.gz · Последние изменения: 2019/01/17 14:07 — Алексей Кожевников