UnixDroid

Cryptography · Beginner

OpenSSL tutorial for beginners

The toolkit behind HTTPS: keys, certificates and hashing

OpenSSL screen demo — an illustration with sample data

What is OpenSSL?

OpenSSL is an open-source library and command-line tool for cryptography. It creates keys and certificates, checks website certificates, calculates hashes and encrypts files.

How OpenSSL works

  1. 1

    Make a key

    Generate a private and public key pair.

  2. 2

    Prove identity

    A certificate authority signs your certificate.

  3. 3

    Agree a secret

    TLS sets up a session key between browser and server.

  4. 4

    Encrypt

    Everything after that travels protected.

Words to know

  • Encryption: lock data so only the right key opens it
  • Hash: a one-way fingerprint
  • Certificate: proof that a public key belongs to a website

Learn by doing

Hash a file, change one letter, hash again — the result changes completely.

OpenSSL first steps

openssl version

Check the version

openssl dgst -sha256 file.txt

Fingerprint a file

openssl rand -base64 24

Make a strong random value

openssl s_client -connect example.com:443

View a website certificate chain

openssl enc -aes-256-cbc -pbkdf2 -in notes.txt -out notes.enc

Encrypt your own file with a password

Use OpenSSL safely and legally

Keep private keys secret (chmod 600) and never post them online.

Practise only on your own computer, your own network or a lab that gives you permission. Using security tools on systems that are not yours can be a crime (in India under the IT Act).

OpenSSL — common questions

What is OpenSSL used for?

OpenSSL is an open-source library and command-line tool for cryptography. It creates keys and certificates, checks website certificates, calculates hashes and encrypts files.

Encryption kya hai?

Encryption data ko aise lock karta hai ki sahi key wala hi use padh sake.

Is hashing the same as encryption?

No. Encryption can be reversed with a key; a hash cannot.

Why do certificates expire?

To limit risk if a key leaks and to keep information current.

Related topics: openssl tutorial · encryption kya hai · ssl certificate basics · sha256 hash