Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
538fe24621 | ||
|
|
ceed4339a8 | ||
|
|
a37f3a8822 | ||
|
|
e55e62413a |
13
CHANGELOG.md
13
CHANGELOG.md
@@ -1,2 +1,15 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
## 2.0.1 - *10/2/2017*
|
||||
|
||||
- Small optimization, removed unneeded function `cryptr_info()`.
|
||||
|
||||
## 2.0.0 - *10/2/2017*
|
||||
|
||||
*BREAKING CHANGE*
|
||||
- Increased the OpenSSL key size to *256bit* from *128bit*. Any files encrypted with version `1.0.0` must be decrypted with version `1.0.0`.
|
||||
|
||||
## 1.0.0 - *10/1/2017*
|
||||
|
||||
- Initial release.
|
||||
|
||||
22
README.md
22
README.md
@@ -13,16 +13,16 @@ ln -s "$PWD"/cryptr/cryptr.bash /usr/local/bin/cryptr
|
||||
|
||||
### encrypt
|
||||
|
||||
> encrypt \<file\> - Encryptes file with OpenSSL AES-128 cipher block chaining. Writes an encrypted file out *(ciphertext)* appending `.aes` extension.
|
||||
> encrypt \<file\> - Encryptes file with OpenSSL AES-256 cipher block chaining. Writes an encrypted file out *(ciphertext)* appending `.aes` extension.
|
||||
|
||||
```
|
||||
➜ cryptr encrypt ./secrets-file
|
||||
enter aes-128-cbc encryption password:
|
||||
Verifying - enter aes-128-cbc encryption password:
|
||||
enter aes-256-cbc encryption password:
|
||||
Verifying - enter aes-256-cbc encryption password:
|
||||
```
|
||||
|
||||
```
|
||||
➜ ll
|
||||
➜ ls -alh
|
||||
-rw-r--r-- 1 user group 1.0G Oct 1 13:33 secrets-file
|
||||
-rw-r--r-- 1 user group 1.0G Oct 1 13:34 secrets-file.aes
|
||||
```
|
||||
@@ -30,20 +30,20 @@ Verifying - enter aes-128-cbc encryption password:
|
||||
|
||||
### decrypt
|
||||
|
||||
> decrypt \<file.aes\> - Decrypt encrypted file using OpenSSL AES-128 cipher block chaining. Writes a decrypted file out *(plaintext)* removing `.aes` extension.
|
||||
> decrypt \<file.aes\> - Decrypt encrypted file using OpenSSL AES-256 cipher block chaining. Writes a decrypted file out *(plaintext)* removing `.aes` extension.
|
||||
|
||||
```
|
||||
➜ ll
|
||||
➜ ls -alh
|
||||
-rw-r--r-- 1 user group 1.0G Oct 1 13:34 secrets-file.aes
|
||||
```
|
||||
|
||||
```
|
||||
➜ cryptr decrypt secrets-file.aes
|
||||
enter aes-128-cbc decryption password:
|
||||
➜ cryptr decrypt ./secrets-file.aes
|
||||
enter aes-256-cbc decryption password:
|
||||
```
|
||||
|
||||
```
|
||||
➜ ll
|
||||
➜ ls -alh
|
||||
-rw-r--r-- 1 user group 1.0G Oct 1 13:35 secrets-file
|
||||
-rw-r--r-- 1 user group 1.0G Oct 1 13:34 secrets-file.aes
|
||||
```
|
||||
@@ -69,7 +69,7 @@ Usage: cryptr command <command-specific-options>
|
||||
|
||||
```
|
||||
➜ cryptr version
|
||||
cryptr 1.0.0
|
||||
cryptr 2.0.1
|
||||
```
|
||||
|
||||
### default
|
||||
@@ -78,7 +78,7 @@ cryptr 1.0.0
|
||||
|
||||
```
|
||||
➜ cryptr
|
||||
cryptr 1.0.0
|
||||
cryptr 2.0.1
|
||||
|
||||
Usage: cryptr command <command-specific-options>
|
||||
|
||||
|
||||
21
cryptr.bash
21
cryptr.bash
@@ -18,17 +18,13 @@
|
||||
|
||||
set -eo pipefail; [[ $TRACE ]] && set -x
|
||||
|
||||
readonly VERSION="1.0.0"
|
||||
readonly VERSION="2.0.1"
|
||||
readonly OPENSSL_CIPHER="aes-256-cbc"
|
||||
|
||||
cryptr_version() {
|
||||
echo "cryptr $VERSION"
|
||||
}
|
||||
|
||||
cryptr_info() {
|
||||
cryptr_version
|
||||
echo
|
||||
}
|
||||
|
||||
cryptr_help() {
|
||||
echo "Usage: cryptr command <command-specific-options>"
|
||||
echo
|
||||
@@ -44,28 +40,29 @@ EOF
|
||||
cryptr_encrypt() {
|
||||
local _file="$1"
|
||||
if [[ ! -f "$_file" ]]; then
|
||||
echo "File not found or invalid" 1>&2
|
||||
echo "File not found" 1>&2
|
||||
exit 4
|
||||
fi
|
||||
|
||||
openssl aes-128-cbc -salt -in "$_file" -out "$_file".aes
|
||||
openssl $OPENSSL_CIPHER -salt -in "$_file" -out "$_file".aes
|
||||
}
|
||||
|
||||
cryptr_decrypt() {
|
||||
local _file="$1"
|
||||
if [[ ! -f "$_file" ]]; then
|
||||
echo "File not found or invalid" 1>&2
|
||||
echo "File not found" 1>&2
|
||||
exit 5
|
||||
fi
|
||||
|
||||
openssl aes-128-cbc -d -salt -in "$_file" -out "${_file%\.aes}"
|
||||
openssl $OPENSSL_CIPHER -d -salt -in "$_file" -out "${_file%\.aes}"
|
||||
}
|
||||
|
||||
cryptr_main() {
|
||||
local _command="$1"
|
||||
|
||||
if [[ -z $_command ]]; then
|
||||
cryptr_info
|
||||
cryptr_version
|
||||
echo
|
||||
cryptr_help
|
||||
exit 0
|
||||
fi
|
||||
@@ -89,7 +86,7 @@ cryptr_main() {
|
||||
;;
|
||||
|
||||
*)
|
||||
cryptr_help >&2
|
||||
cryptr_help 1>&2
|
||||
exit 3
|
||||
esac
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user