OpenSSL — различия между версиями

Материал из pNp Wiki
Перейти к: навигация, поиск
(Новая страница: «== Получение SPKI pin для DNS-over-TLS == <code> openssl s_client -connect '145.100.185.16:853' < /dev/null 2> /dev/null | openssl x509 -pubkey -noout…»)
 
(Конвертация p11 в pem)
 
(не показано 7 промежуточных версий этого же участника)
Строка 1: Строка 1:
== Получение SPKI pin для DNS-over-TLS ==
+
==== Получение SSL сертификата с сервера ====
<code>
+
<syntaxhighlight lang="bash">
openssl s_client -connect '145.100.185.16:853' < /dev/null 2> /dev/null | openssl x509 -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64
+
# openssl s_client -showcerts -connect ipa-01.example.com:636 < /dev/null 2> /dev/null | openssl x509 -outform PEM > /home/andy/ipa-01.example.com.pem
</code>
+
</syntaxhighlight>
 +
 
 +
==== Конвертация p12 в pem ====
 +
<syntaxhighlight lang="bash">
 +
# openssl pkcs12 -in mycert.p12 -out file.key.pem -nocerts -nodes
 +
# openssl pkcs12 -in mycert.p12 -out file.crt.pem -clcerts -nokeys
 +
</syntaxhighlight>
 +
 
 +
==== Получение отпечатка SSL сертификата с сервера ====
 +
<syntaxhighlight lang="bash">
 +
# openssl x509 -in /home/andy/example.pem -noout -md5 -fingerprint
 +
</syntaxhighlight>
 +
 
 +
==== Получение информации о SSL сертификате в человекочитаемом формате ====
 +
<syntaxhighlight lang="bash">
 +
# openssl x509 -in /home/andy/example.pem -text -noout
 +
</syntaxhighlight>
 +
 
 +
==== Получение crt и key из pfx ====
 +
<syntaxhighlight lang="bash">
 +
# openssl pkcs12 -in /home/andy/test.pfx -nocerts -nodes -out /home/andy/example.key
 +
# openssl pkcs12 -in /home/andy/test.pfx -clcerts -nokeys -out /home/andy/example.crt
 +
</syntaxhighlight>
 +
 
 +
==== Получение SPKI pin для DNS-over-TLS ====
 +
<syntaxhighlight lang="bash">
 +
# openssl s_client -connect '145.100.185.16:853' < /dev/null 2> /dev/null | openssl x509 -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64
 +
</syntaxhighlight>
 +
 
 +
== CertUtil ==
 +
==== Добавление сертификата в базу NSS ====
 +
<syntaxhighlight lang="bash">
 +
# certutil -A -n win.example.com -t CTcu -d /etc/openldap/certs/ -a -i /root/win2012.win.example.com.cer
 +
</syntaxhighlight>
 +
 
 +
==== Получение информации о SSL сертификате в человекочитаемом формате ====
 +
<syntaxhighlight lang="bash">
 +
# certutil -L -n win.example.com -d /etc/openldap/certs/ -a | openssl x509  -text -noout
 +
</syntaxhighlight>
 +
 
 +
 
 +
== Ссылки ==
 +
 
 +
[https://www.tutorialsteacher.com/https/ssl-certificate-format О сертификатах]<br />

Текущая версия на 11:10, 28 апреля 2020

Получение SSL сертификата с сервера

# openssl s_client -showcerts -connect ipa-01.example.com:636 < /dev/null 2> /dev/null | openssl x509 -outform PEM > /home/andy/ipa-01.example.com.pem

Конвертация p12 в pem

# openssl pkcs12 -in mycert.p12 -out file.key.pem -nocerts -nodes
# openssl pkcs12 -in mycert.p12 -out file.crt.pem -clcerts -nokeys

Получение отпечатка SSL сертификата с сервера

# openssl x509 -in /home/andy/example.pem -noout -md5 -fingerprint

Получение информации о SSL сертификате в человекочитаемом формате

# openssl x509 -in /home/andy/example.pem -text -noout

Получение crt и key из pfx

# openssl pkcs12 -in /home/andy/test.pfx -nocerts -nodes -out /home/andy/example.key
# openssl pkcs12 -in /home/andy/test.pfx -clcerts -nokeys -out /home/andy/example.crt

Получение SPKI pin для DNS-over-TLS

# openssl s_client -connect '145.100.185.16:853' < /dev/null 2> /dev/null | openssl x509 -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64

CertUtil

Добавление сертификата в базу NSS

# certutil -A -n win.example.com -t CTcu -d /etc/openldap/certs/ -a -i /root/win2012.win.example.com.cer

Получение информации о SSL сертификате в человекочитаемом формате

# certutil -L -n win.example.com -d /etc/openldap/certs/ -a | openssl x509  -text -noout


Ссылки

О сертификатах