6 examples for openssl

{{ score }}
  # get certiface from remote server
openssl s_client -connect www.domain.com:443 -showcerts
        
{{ score }}
  # Check whether a private key matches a certificate (do this before installing the cert) (courtesy sslshopper tools page) 
openssl x509 -noout -modulus -in certificate.crt | openssl md5
openssl rsa -noout -modulus -in privateKey.key | openssl md5
        
{{ score }}
  # Quickly encrypt a file

# Lock:
    openssl aes-256-cbc -a -salt -in file -out file.enc

# Unlock:
    openssl aes-256-cbc -d -a -in file.enc -out file

# For directories, create a tarball first
    tar -czvf directory.tar.gz directory

# Then lock it
    openssl aes-256-cbc -a -salt -in directory.tar.gz -out directory.tar.gz.enc

# Unlock it
    openssl aes-256-cbc -d -a -in directory.tar.gz.enc -out directory.tar.gz
    
# And extract it
    tar -xzvf directory.tar.gz
        
{{ score }}
  # Get certificate info
openssl x509 -text -noout -in cert.crt
        
{{ score }}
  # Generate self-signed openssl rsa 4096 bit certificate for https
openssl req -newkey rsa:4096 -days 365 -nodes -x509 -keyout key.pem -out cert.crt
        
{{ score }}
  # get certificate from remote server
openssl s_client -connect www.domain.com:443 -showcerts