Table of Contents

Encrypt and Decrypt a File using Symmetric Encryption

To encrypt:

openssl enc -aes-256-cbc -salt -in archive.tar.xz -out archive.tar.xz.aes

To decrypt:

openssl enc -d -aes-256-cbc -in archive.tar.xz.aes -out archive.tar.xz

Create a Self-Signed Certificate

openssl genrsa -des3 -out server.key 1024
openssl req -key server.key -out server.csr
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
cp server.key server.key.secure
openssl rsa -in server.key.secure -out server.key

Benchmark

To benchmark an OpenSSL encryption scheme, for example aes-256-cbc, issue the following command:

openssl speed -evp aes-256-cbc

Check PEM Encoded Certificate Expiration

openssl x509 -enddate -noout -in cert.pem

where: