notes:openssl
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| notes:openssl [2021/11/02 18:33] – created david | notes:openssl [2024/06/01 21:18] (current) – [openssl s_client] david | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | Create a certificate request | + | ===== Create a certificate request |
| + | ==== Create a ECC key ==== | ||
| + | Create a ECC private key using the prime256v1 algorithm ((https:// | ||
| + | < | ||
| + | using secp384r1 | ||
| + | < | ||
| + | |||
| + | Create CSR from key | ||
| + | < | ||
| + | -subj "/ | ||
| + | -addext " | ||
| + | |||
| + | |||
| + | One-liner for ECC key | ||
| + | < | ||
| + | -keyout $(hostname -f).key -out $(hostname -f).csr \ | ||
| + | -subj "/ | ||
| + | -addext " | ||
| + | </ | ||
| + | |||
| + | |||
| + | ==== Create a RSA key ==== | ||
| < | < | ||
| + | |||
| + | Create rsa key and csr | ||
| + | < | ||
| + | -keyout example.com.key \ | ||
| + | -subj "/ | ||
| + | -addext " | ||
| + | |||
| + | one liner for RSA key and csr using system FQDN | ||
| + | < | ||
| + | -addext " | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== get cert modulus and compare to private key ===== | ||
| + | < | ||
| + | if [[ " | ||
| + | echo "they don't match" | ||
| + | fi | ||
| + | </ | ||
| =====pkcs12 ===== | =====pkcs12 ===== | ||
| Line 48: | Line 88: | ||
| With certificate verification | With certificate verification | ||
| openssl s_client -connect example.com: | openssl s_client -connect example.com: | ||
| + | |||
| + | Retrieve just the RSA public key if the site has both ECDSA & RSA | ||
| + | openssl s_client -sigalgs " | ||
| + | to retrieve the EC cert use " | ||
| + | |||
| + | For more examples of using signature algorithms see https:// | ||
| + | |||
| + | |||
| wget and openssl s_client | wget and openssl s_client | ||
| Line 56: | Line 104: | ||
| ===== Encrypting using openssl ===== | ===== Encrypting using openssl ===== | ||
| openssl enc -e -k 1234 -aes256 -in text.txt -out text.txt.enc | openssl enc -e -k 1234 -aes256 -in text.txt -out text.txt.enc | ||
| + | |||
| + | |||
| + | openssl enc -e -k 1234 -aes256 -pbkdf2 -in text.txt -out text.txt.enc | ||
| + | |||
| + | openssl enc -d -k 1234 -aes256 -pbkdf2 -in text.txt -out text.txt.enc | ||
| #Signing files | #Signing files | ||
| Line 108: | Line 161: | ||
| < | < | ||
| + | ===== compare key with signed cert ===== | ||
| + | openssl x509 -noout -modulus -in < | ||
| + | openssl rsa -noout -modulus -in < | ||
| + | and compare the two | ||
| + | |||
| + | |||
| + | ===== References ===== | ||
| + | https:// | ||
| + | |||
| + | https:// | ||
| + | |||
| + | https:// | ||
| + | https:// | ||
| + | https:// | ||
notes/openssl.1635892437.txt.gz · Last modified: by david
