1. Symmetric encrypt
openssl enc -aes-256-cbc encrypts a file with AES using one shared secret key — fast, for bulk data.
openssl enc -aes-256-cbc -in f.txt -out f.encTyporithm · medium
Step 1 of 8 · intro card
Cryptography
Symmetric crypto (AES) uses one shared secret key and is fast, good for bulk data. Asymmetric crypto (RSA/ECC) uses a public/private keypair for key exchange and signatures. Real systems are hybrid: asymmetric to exchange a fast symmetric session key.
Symmetric encryption uses a single secret key for both encryption and decryption. AES (here AES-256-CBC) is the standard; it is fast and ideal for encrypting large amounts of data, but both sides must already share the key.
Asymmetric encryption uses a keypair: a public key anyone can hold and a private key kept secret. Data encrypted with the public key can only be decrypted with the private key, and signatures work the reverse way — enabling key exchange and authentication without a pre-shared secret.
Asymmetric operations are slow, so real systems are hybrid: they use RSA or ECDH to securely agree on a random symmetric session key, then encrypt the actual traffic with fast AES. This is exactly how TLS sets up a connection.
Symmetric (AES): one shared key, fast, for bulk data.
Asymmetric (RSA/ECC): public/private keypair for exchange and signatures.
Hybrid: asymmetric exchanges a symmetric session key.
openssl enc -aes-256-cbc -in f.txt -out f.enc
openssl genrsa -out private.pem 2048
openssl rsa -in private.pem -pubout -out public.pem
openssl pkeyutl -encrypt -pubin -inkey public.pemConnect each part of the code to the concept before you type.
openssl enc -aes-256-cbc encrypts a file with AES using one shared secret key — fast, for bulk data.
openssl enc -aes-256-cbc -in f.txt -out f.encgenrsa creates a 2048-bit RSA private key; the matching public key is derived from it.
openssl genrsa -out private.pem 2048-pubout writes only the public half, which you can share freely while the private key stays secret.
openssl rsa -in private.pem -pubout -out public.pempkeyutl -encrypt -pubin encrypts with the public key so only the private-key holder can decrypt.
openssl pkeyutl -encrypt -pubin -inkey public.pemRead the concept map and follow the code breakdown.
Type the implementation, repair mistakes and work through every recall exercise.
Use the final check without hints; revisit weak concepts in short practice sessions.