openssl enc
The openssl subcommand that encrypts or decrypts files and data streams with a symmetric cipher such as AES.
In more detail
You choose the cipher and mode by name, such as -aes-256-ctr, and supply either a raw key and IV with -K and -iv or a password with -pass, where -pbkdf2 turns the password into a key; -d decrypts. It does not support authenticated modes such as GCM, so its output can be altered without detection, and real systems are better served by a library with AEAD.
Examples
cmd = ["openssl", "enc", "-aes-256-ctr", "-K", KEY, "-iv", IV]openssl enc -aes-256-cbc -pbkdf2 -pass file:db.key -in customers.db -out customers.db.encopenssl enc -d -aes-256-cbc -pbkdf2 -pass file:db.key -in customers.db.enc -out restored.dbRelated terms
- OpenSSL — A widely used toolkit and library for cryptography and TLS, including the openssl command-line tool.
- cipher — An algorithm for encrypting and decrypting data, such as AES; a mode, such as GCM, says how it is applied to data longer than one block.
- block cipher mode — The method for using a block cipher such as AES on data longer than one block, such as CBC or GCM.
- KDF — A key derivation function: an algorithm that turns a password or other secret into one or more cryptographic keys of the right length.
Taught in
- Data States: Security at Rest, in Transit, and in Use — Cybersecurity Fundamentals, GRC & Cryptography
- The Certificate That Expired On A Sunday: Hashes, Encryption And Certificates — CompTIA Linux+ (XK0-006) Exam Prep