Browse Source

Add message digest setting using SHA-256

master
Joel Parker Henderson 7 years ago
parent
commit
e4be704510
  1. 54
      README.md
  2. 42
      openssl-encrypt

54
README.md

@ -2,7 +2,7 @@
Syntax: Syntax:
openssl-encrypt <file> openssl-encrypt <input file path> [output file path]
Example: Example:
@ -14,20 +14,7 @@ Output is a new encrypted file:
To decrypt the file: To decrypt the file:
$ openssl-decrypt example.txt.openssl $ openssl-decrypt example.txt.aes
## Related
These commands are related:
* `gpg-encrypt`: use GPG to encrypt a file using our best settings.
* `gpg-decrypt`: use GPG to decrypt a file using our best settings.
* `openssl-encrypt`: use OpenSLL to encrypt a file using our best settings.
* `openssl-decrypt`: use OpenSSL to decrypt a file using our best settings.
## Settings ## Settings
@ -38,25 +25,46 @@ These commands are related:
* Encryption using the aes-256-cbc cipher algorithm. * Encryption using the aes-256-cbc cipher algorithm.
We choose this because it's a good balance of strong, fast, and portable. We choose this because it's a good balance of strong, fast, and portable.
* Salt * Message digest using SHA-256.
We choose this because it's the current default of the current openssl tool,
and we set it explicity because openssl versions have different defaults.
* Message digest using SHA-256.
We choose this because it's the current default of the current openssl tool,
and we set it explicity because openssl versions have different defaults.
* Salt that is randomly generated.
* The output file path defaults to the input file path with suffix ".aes".
## Command ## Command
The command is: The command is:
openssl \ openssl aes-256-cbc -salt -md sha256
aes-256-cbc \ -in "example.txt"
-salt -out "example.txt.aes"
-in "$1" \
-out "$1.aes"
## See also
These commands are related:
* `gpg-encrypt`: use GPG to encrypt a file using our best settings.
* `gpg-decrypt`: use GPG to decrypt a file using our best settings.
* `openssl-encrypt`: use OpenSLL to encrypt a file using our best settings.
* `openssl-decrypt`: use OpenSSL to decrypt a file using our best settings.
## Tracking ## Tracking
* Command: openssl-encrypt * Command: openssl-encrypt
* Version: 1.0.0 * Version: 2.0.0
* Created: 2017-09-14 * Created: 2017-09-14
* Updated: 2017-09-14 * Updated: 2017-11-27
* License: GPL * License: GPL
* Contact: Joel Parker Henderson (joel@joelparkerhenderson.com) * Contact: Joel Parker Henderson (joel@joelparkerhenderson.com)

42
openssl-encrypt

@ -4,11 +4,11 @@
# #
# Syntax: # Syntax:
# #
# openssl-encrypt <file> # openssl-encrypt <input file path> [output file path]
# #
# Example: # Example:
# #
# $ openssl-encrypt foo.txt # $ openssl-encrypt example.txt
# #
# Output is a new encrypted file: # Output is a new encrypted file:
# #
@ -27,9 +27,24 @@
# * Encryption using the aes-256-cbc cipher algorithm. # * Encryption using the aes-256-cbc cipher algorithm.
# We choose this because it's a good balance of strong, fast, and portable. # We choose this because it's a good balance of strong, fast, and portable.
# #
# * Salt # * Message digest using SHA-256.
# # We choose this because it's the current default of the current openssl tool,
# and we set it explicity because openssl versions have different defaults.
#
# * Salt that is randomly generated.
#
# * The output file path defaults to the input file path with suffix ".aes".
#
# #
# ## Command
#
# The command is:
#
# openssl aes-256-cbc -salt -md sha256
# -in "example.txt"
# -out "example.txt.aes"
#
#
# ## See also # ## See also
# #
# These commands are similar: # These commands are similar:
@ -47,26 +62,17 @@
# use OpenSSL to decrypt a file using our best settings. # use OpenSSL to decrypt a file using our best settings.
# #
# #
# ## Command
#
# The command is:
#
# openssl \
# aes-256-cbc \
# -salt
# -in "$1" \
# -out "$1.aes"
#
#
# ## Tracking # ## Tracking
# #
# * Command: openssl-encrypt # * Command: openssl-encrypt
# * Version: 1.0.0 # * Version: 2.0.0
# * Created: 2017-09-14 # * Created: 2017-09-14
# * Updated: 2017-09-14 # * Updated: 2017-11-27
# * License: GPL # * License: GPL
# * Contact: Joel Parker Henderson (joel@joelparkerhenderson.com) # * Contact: Joel Parker Henderson (joel@joelparkerhenderson.com)
## ##
set -eu set -eu
openssl aes-256-cbc -salt -in "$1" -out "$1.aes" in="$1"
out=${2:-$1.aes}
openssl aes-256-cbc -salt -md sha256 -in "$in" -out "$out"

Loading…
Cancel
Save