Openssl
De Linuxmemo.
(Différences entre les versions)
(→OCSP) |
|||
(5 versions intermédiaires masquées) | |||
Ligne 1 : | Ligne 1 : | ||
[[Catégorie:Linux sysadmin]] | [[Catégorie:Linux sysadmin]] | ||
+ | Voir: [[Certutil]], [[Openssl]], [[Certificats]] | ||
+ | |||
https://www.madboa.com/geek/openssl/ | https://www.madboa.com/geek/openssl/ | ||
https://www.goconqr.com/mindmap/8704000/pki | https://www.goconqr.com/mindmap/8704000/pki | ||
- | Générons une clé privée de 2048 bits | + | Générons une clé privée de 2048 bits pour la CA |
openssl genrsa -out ca.key 2048 | openssl genrsa -out ca.key 2048 | ||
Ligne 10 : | Ligne 12 : | ||
openssl req -new -x509 -key ca.key -out ca.crt -days 1095 | openssl req -new -x509 -key ca.key -out ca.crt -days 1095 | ||
- | Générons une clé privée de 2048 bits | + | Générons une clé privée de 2048 bits pour test |
openssl genrsa -out test.key 2048 | openssl genrsa -out test.key 2048 | ||
- | Générez la clé publique avec l'ordre | + | Générez la clé publique avec l'ordre pour test |
openssl req -new -key test.key -out test.csr | openssl req -new -key test.key -out test.csr | ||
- | openssl x509 -req -in test.csr -out testcertif.pem -CA ca.crt -CAkey ca.key -CAcreateserial -CAserial ca.srl -days 90 | + | Création du certificat auto-signé |
+ | openssl x509 -req -in test.csr -out testcertif.pem -CA ca.crt -CAkey ca.key -CAcreateserial -CAserial ca.srl -days 90 | ||
+ | |||
+ | voir info | ||
+ | openssl x509 -text -in testcertif.pem -noout | ||
+ | |||
+ | |||
+ | ==OCSP== | ||
+ | openssl s_client -connect wikipedia.org:443 2>&1 < /dev/null | sed -n '/-----BEGIN/,/-----END/p' | ||
+ | openssl s_client -connect wikipedia.org:443 2>&1 < /dev/null | sed -n '/-----BEGIN/,/-----END/p' > wikipedia.pem | ||
+ | |||
+ | Now, check if this certificate has an OCSP URI: | ||
+ | openssl x509 -noout -ocsp_uri -in wikipedia.pem | ||
+ | http://ocsp2.globalsign.com/gsorganizationvalsha2g2 | ||
+ | |||
+ | Getting the certificate chain: | ||
+ | openssl s_client -connect wikipedia.org:443 -showcerts 2>&1 < /dev/null | ||
+ | |||
- | + | Sending the OCSP request | |
- | openssl | + | openssl ocsp -issuer chain.pem -cert wikipedia.pem -text -url http://ocsp2.globalsign.com/gsorganizationvalsha2g2 |
Version actuelle en date du 16 septembre 2019 à 09:26
Voir: Certutil, Openssl, Certificats
https://www.madboa.com/geek/openssl/
https://www.goconqr.com/mindmap/8704000/pki
Générons une clé privée de 2048 bits pour la CA
openssl genrsa -out ca.key 2048
Creation de la CA
openssl req -new -x509 -key ca.key -out ca.crt -days 1095
Générons une clé privée de 2048 bits pour test
openssl genrsa -out test.key 2048
Générez la clé publique avec l'ordre pour test
openssl req -new -key test.key -out test.csr
Création du certificat auto-signé
openssl x509 -req -in test.csr -out testcertif.pem -CA ca.crt -CAkey ca.key -CAcreateserial -CAserial ca.srl -days 90
voir info
openssl x509 -text -in testcertif.pem -noout
[modifier] OCSP
openssl s_client -connect wikipedia.org:443 2>&1 < /dev/null | sed -n '/-----BEGIN/,/-----END/p' openssl s_client -connect wikipedia.org:443 2>&1 < /dev/null | sed -n '/-----BEGIN/,/-----END/p' > wikipedia.pem
Now, check if this certificate has an OCSP URI:
openssl x509 -noout -ocsp_uri -in wikipedia.pem http://ocsp2.globalsign.com/gsorganizationvalsha2g2
Getting the certificate chain:
openssl s_client -connect wikipedia.org:443 -showcerts 2>&1 < /dev/null
Sending the OCSP request
openssl ocsp -issuer chain.pem -cert wikipedia.pem -text -url http://ocsp2.globalsign.com/gsorganizationvalsha2g2