Overview

Please note that this was tested using macOS Catalina 10.15.4 and the LibreSSL (version 2.8.3) implementation of OpenSSL.
The source code is available at https://github.com/locp/blog-content/blob/master/aes-256/aes256
The source code is available at https://github.com/locp/blog-content/blob/master/aes-256/aes256
The Script
Examples
# Check the contents of the files we wish to encrypt: $ cat /tmp/hello.txt Hello, world! # Encrypt the file: $ aes256 -e -f /tmp/hello.txt -p 'Secret123' INFO: Encrypting /tmp/hello.txt to /tmp/hello.txt.aes256. # See what has happened: $ ls -l /tmp/hello.txt.* -rw-r--r-- 1 ben.dalling wheel 32 28 Mar 10:47 /tmp/hello.txt.aes256 $ od -c /tmp/hello.txt.aes256 0000000 S a l t e d _ _ 345 006 k 027 g 033 305 \0 0000020 214 210 370 217 020 245 031 354 \b 212 . 202 367 344 ^ 033 0000040 # Now let's decrypt the file and show the contents: $ aes256 -d -f /tmp/hello.txt.aes256 -p 'Secret123' INFO: Decrypting /tmp/hello.txt.aes256 to /tmp/hello.txt. $ cat /tmp/hello.txt Hello, world!
References
- Martellaro, J. (2016) How to Strongly Encrypt a File (for free) in OS X, Available at: https://www.macobserver.com/tmo/article/how-to-strongly-encrypt-a-file-for-free-in-os-x (Accessed: 28th March 2020).
- Wikimedia Foundation (2020) Advanced Encryption Standard, Available at: https://en.wikipedia.org/wiki/Advanced_Encryption_Standard (Accessed: 28th March 2020).
No comments:
Post a Comment