tech:notes_pki_java_pk12_pk12util_certutil_libnss3-tools
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédente | |||
| tech:notes_pki_java_pk12_pk12util_certutil_libnss3-tools [2025/11/07 14:03] – Jean-Baptiste | tech:notes_pki_java_pk12_pk12util_certutil_libnss3-tools [2026/06/07 19:12] (Version actuelle) – modification externe 127.0.0.1 | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # PKI Java pk12 pk12util certutil libnss3-tools NSS | ||
| + | |||
| + | |||
| + | Voir : | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | Voir aussi : | ||
| + | * PKICertImport | ||
| + | |||
| + | NSS | ||
| + | ~~~ | ||
| + | Network Security Services (NSS) is a set of libraries designed to | ||
| + | support cross-platform development of security-enabled client and server | ||
| + | applications. Applications built with NSS can support SSL v2 and v3, | ||
| + | TLS, PKCS #5, PKCS #7, PKCS #11, PKCS #12, S/MIME, X.509 v3 certificates, | ||
| + | other security standards. For detailed information on standards supported, see | ||
| + | ~~~ | ||
| + | http:// | ||
| + | |||
| + | https:// | ||
| + | ~~~ | ||
| + | If libcurl was built with NSS support, then depending on the OS distribution, | ||
| + | |||
| + | Starting with version 7.19.7, libcurl automatically adds the ' | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | Test CA | ||
| + | ~~~bash | ||
| + | openssl s_client -connect foo.whatever.com: | ||
| + | ~~~ | ||
| + | |||
| + | Install NSS | ||
| + | ~~~bash | ||
| + | sudo apt-get update | ||
| + | |||
| + | # Obsolète | ||
| + | #sudo apt-get install -y p11-kit libnss3 | ||
| + | #sudo apt-get install p11-kit-modules | ||
| + | |||
| + | #Install de certutil | ||
| + | sudo apt-get install libnss3-tools | ||
| + | ~~~ | ||
| + | |||
| + | Conversion des certs au format p12 | ||
| + | ~~~bash | ||
| + | openssl pkcs12 -export -inkey your_private_key.key | ||
| + | openssl pkcs12 -export -inkey your_private_key.key -in your_certificate.cer -certfile your_chain.pem -out final_result.p12 | ||
| + | ~~~ | ||
| + | |||
| + | Création de la NSS DB | ||
| + | ~~~bash | ||
| + | mkdir -p ~/ | ||
| + | chmod 700 ~/ | ||
| + | certutil -N -d $HOME/ | ||
| + | ~~~ | ||
| + | |||
| + | Import du certificat p12 dans la NSS DB | ||
| + | ~~~bash | ||
| + | pk12util -i server.p12 -d $HOME/ | ||
| + | ~~~ | ||
| + | |||
| + | Vérif lister les certificats | ||
| + | ~~~bash | ||
| + | certutil -L -d sql: | ||
| + | |||
| + | certutil -L -d sql:. -a -n " | ||
| + | ~~~ | ||
| + | |||
| + | import each as trusted proxy | ||
| + | |||
| + | ~~~bash | ||
| + | # list of hosts to get certificates from | ||
| + | hosts=" | ||
| + | |||
| + | for host in ${hosts}; do | ||
| + | openssl s_client -connect ${host} -prexit </ | ||
| + | certutil -d sql: | ||
| + | rm ${host}.crt | ||
| + | done | ||
| + | ~~~ | ||
| + | |||
| + | source : https:// | ||
| + | |||
| + | Autre - Importer un crt | ||
| + | ~~~bash | ||
| + | certutil -A -n " | ||
| + | |||
| + | # CA | ||
| + | certutil -d sql: | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | NSS DB PATH - pour curl | ||
| + | ~~~bash | ||
| + | export SSL_DIR=$HOME/ | ||
| + | ~~~ | ||
| + | |||
| + | Compil curl | ||
| + | ~~~bash | ||
| + | ./configure --with-ssl --without-nss | ||
| + | ~~~ | ||
| + | |||
| + | Aide | ||
| + | ~~~bash | ||
| + | certutil -H | ||
| + | pk12util -H | ||
| + | ~~~ | ||
| + | |||
| + | keytool | ||
| + | ~~~bash | ||
| + | echo "### remove old keystore" | ||
| + | rm -f solrtest.keystore | ||
| + | |||
| + | echo "### create keystore and keys" | ||
| + | keytool -keystore solrtest.keystore -storepass " | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | -------------- | ||
| + | |||
| + | Voir : | ||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | ~~~bash | ||
| + | apt-get install libnss3-tools | ||
| + | ~~~ | ||
| + | |||
| + | By default, certutil / pk12util searches for databases named cert8.db and key3.db, but some of the versions of Web Server use alternate names such as https-instance-hostname-cert8.db and https-instance-hostname-key3.db in that case add "-P https-instance-hostname-" | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ~~~bash | ||
| + | certutil -L -d certdir | ||
| + | |||
| + | #pkcs12util -o exportedcertfilename -d . -n Server-Cert | ||
| + | #pkcs12util -i exportedcertfilename -d . -h "Sun Metaslot" | ||
| + | pk12util -o exportcert -n Server-Cert_xx -d . | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | pk12util | ||
| + | |||
| + | https:// | ||
| + | |||
| + | |||
| + | Import keys and certificates from a PKCS#12 file into a security | ||
| + | database. | ||
| + | |||
| + | https:// | ||
| + | |||
| + | ~~~bash | ||
| + | pk12util -d . -i / | ||
| + | #pk12util -d . -P slapd- -i / | ||
| + | ~~~ | ||
| + | |||
| + | ## Exemple certutil | ||
| + | |||
| + | Exemple | ||
| + | ~~~bash | ||
| + | mkdir $HOME/.pki/ | ||
| + | certutil -N -d sql: | ||
| + | certutil -d sql: | ||
| + | certutil -d sql: | ||
| + | env SSL_DIR=$HOME/ | ||
| + | ~~~ | ||
| + | |||
| + | ## Autres | ||
| + | |||
| + | ~~~bash | ||
| + | mkdir -p $HOME/ | ||
| + | ~~~ | ||
| + | |||
| + | |||
