11 Commits

Author SHA1 Message Date
Justin
77d39c1bc3 release 2.2.0 2020-07-10 15:48:08 -05:00
Justin Keller
3267969668 Merge pull request #6 from adam12/encrypted-file-overwrites-source
Append extension during encryption
2020-07-10 15:41:14 -05:00
Adam Daniels
358f631cbb Prepare for 2.1.2 release 2020-07-10 14:57:04 -04:00
Adam Daniels
3421864c38 Append extension during encryption 2020-07-10 12:14:36 -04:00
Justin Keller
05ff65d6e3 Merge pull request #3 from Darkitty/master
Update `openssl` command to follow recommandation
2019-06-30 15:12:15 -05:00
Nicolas Le Gall
36619f7ee0 Fix filename output 2019-06-27 00:29:35 +02:00
Nicolas Le Gall
e9576d180c Update openssl command to follow recommandation 2019-06-27 00:07:59 +02:00
Justin
db2bcce3aa updated CHANGELOG.md 2019-03-25 22:49:48 -05:00
Justin
96ba0cf90e updated README.md 2019-03-25 22:47:48 -05:00
Justin
1fe0e38c60 updated README.md 2019-03-25 22:47:19 -05:00
Justin
07df492a1f version release 2.1.1 2019-03-25 22:42:25 -05:00
6 changed files with 36 additions and 23 deletions

View File

@@ -1,2 +1,4 @@
- Justin Keller ([nodesocket](https://github.com/nodesocket))
- Manuel Wildauer ([int9h](https://github.com/int9h))
- Adam Daniels ([adam12](https://github.com/adam12))
- Nicolas Le Gall ([Darkitty](https://github.com/Darkitty))

View File

@@ -1,6 +1,17 @@
CHANGELOG
=========
## 2.2.0 - *7/10/2020*
- Append `.aes` file extension instead of substituting when encrypting.
- Use derivation function _(-pbkdf2)_ when encrypting. See [pull request](https://github.com/nodesocket/cryptr/pull/3).
## 2.1.1 - *3/25/2019*
- Updated the notice text when using environment variable `CRYPTR_PASSWORD` for the password.
- Updated `tests/test.bash`.
- Bump copyright year to 2019.
## 2.1.0 - *10/4/2017*
- You may now define the password to use when encrypting and decrypting using the `CRYPTR_PASSWORD` environment variable. This change enables non-interactive/batch operations.

View File

@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2017 Justin Keller
Copyright 2019 Justin Keller
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View File

@@ -1,6 +1,6 @@
# cryptr
##### A simple shell utility for encrypting and decrypting files.
#### A simple shell utility for encrypting and decrypting files using OpenSSL.
## Installation
@@ -20,21 +20,21 @@ Add `tools/cryptr-bash-completion.bash` to your tab completion file directory.
> encrypt \<file\> - Encryptes file with OpenSSL AES-256 cipher block chaining. Writes an encrypted file out *(ciphertext)* appending `.aes` extension.
```
➜ cryptr encrypt ./secrets-file
➜ cryptr encrypt ./secret-file
enter aes-256-cbc encryption password:
Verifying - enter aes-256-cbc encryption password:
```
```
➜ 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
-rw-r--r-- 1 user group 1.0G Oct 1 13:33 secret-file
-rw-r--r-- 1 user group 1.0G Oct 1 13:34 secret-file.aes
```
You may optionally define the password to use when encrypting using the `CRYPTR_PASSWORD` environment variable. This enables non-interactive/batch operations.
```
➜ CRYPTR_PASSWORD=A1EO7S9SsQYcPChOr47n cryptr encrypt ./secrets-file
➜ CRYPTR_PASSWORD=A1EO7S9SsQYcPChOr47n cryptr encrypt ./secret-file
```
### decrypt
@@ -43,24 +43,24 @@ You may optionally define the password to use when encrypting using the `CRYPTR_
```
➜ ls -alh
-rw-r--r-- 1 user group 1.0G Oct 1 13:34 secrets-file.aes
-rw-r--r-- 1 user group 1.0G Oct 1 13:34 secret-file.aes
```
```
➜ cryptr decrypt ./secrets-file.aes
➜ cryptr decrypt ./secret-file.aes
enter aes-256-cbc decryption password:
```
```
➜ 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
-rw-r--r-- 1 user group 1.0G Oct 1 13:35 secret-file
-rw-r--r-- 1 user group 1.0G Oct 1 13:34 secret-file.aes
```
You may optionally define the password to use when decrypting using the `CRYPTR_PASSWORD` environment variable. This enables non-interactive/batch operations.
```
➜ CRYPTR_PASSWORD=A1EO7S9SsQYcPChOr47n cryptr decrypt ./secrets-file.aes
➜ CRYPTR_PASSWORD=A1EO7S9SsQYcPChOr47n cryptr decrypt ./secret-file.aes
```
### help
@@ -84,7 +84,7 @@ Usage: cryptr command <command-specific-options>
```
➜ cryptr version
cryptr 2.1.0
cryptr 2.2.0
```
### default
@@ -93,7 +93,7 @@ cryptr 2.1.0
```
➜ cryptr
cryptr 2.1.0
cryptr 2.2.0
Usage: cryptr command <command-specific-options>
@@ -130,7 +130,7 @@ For more information on semantic versioning, visit http://semver.org/.
## License & Legal
Copyright 2017 Justin Keller
Copyright 2019 Justin Keller
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash
###############################################################################
# Copyright 2017 Justin Keller
# Copyright 2019 Justin Keller
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
set -eo pipefail; [[ $TRACE ]] && set -x
readonly VERSION="2.1.0"
readonly VERSION="2.2.0"
readonly OPENSSL_CIPHER_TYPE="aes-256-cbc"
cryptr_version() {
@@ -45,10 +45,10 @@ cryptr_encrypt() {
fi
if [[ ! -z "${CRYPTR_PASSWORD}" ]]; then
echo "Using environment variable CRYPTR_PASSWORD for the password"
openssl $OPENSSL_CIPHER_TYPE -salt -in "$_file" -out "$_file".aes -pass env:CRYPTR_PASSWORD
echo "[notice] using environment variable CRYPTR_PASSWORD for the password"
openssl $OPENSSL_CIPHER_TYPE -salt -pbkdf2 -in "$_file" -out "${_file}.aes" -pass env:CRYPTR_PASSWORD
else
openssl $OPENSSL_CIPHER_TYPE -salt -in "$_file" -out "$_file".aes
openssl $OPENSSL_CIPHER_TYPE -salt -pbkdf2 -in "$_file" -out "${_file}.aes"
fi
}
@@ -60,10 +60,10 @@ local _file="$1"
fi
if [[ ! -z "${CRYPTR_PASSWORD}" ]]; then
echo "Using environment variable CRYPTR_PASSWORD for the password"
openssl $OPENSSL_CIPHER_TYPE -d -salt -in "$_file" -out "${_file%\.aes}" -pass env:CRYPTR_PASSWORD
echo "[notice] using environment variable CRYPTR_PASSWORD for the password"
openssl $OPENSSL_CIPHER_TYPE -d -salt -pbkdf2 -in "$_file" -out "${_file%\.aes}" -pass env:CRYPTR_PASSWORD
else
openssl $OPENSSL_CIPHER_TYPE -d -salt -in "$_file" -out "${_file%\.aes}"
openssl $OPENSSL_CIPHER_TYPE -d -salt -pbkdf2 -in "$_file" -out "${_file%\.aes}"
fi
}

View File

@@ -2,7 +2,7 @@
set -eo pipefail; [[ $TRACE ]] && set -x
plaintext=$(mktemp /tmp/cryptr.XXXXXXXX)
dd if=/dev/urandom bs=4096 count=1 2> /dev/null | LC_ALL=C tr -dc 'A-Za-z0-9' | head -c512 > "$plaintext"
dd if=/dev/urandom bs=4096 count=256 2> /dev/null | LC_ALL=C tr -dc 'A-Za-z0-9' | head -c262144 > "$plaintext"
plaintext_sha=($(openssl dgst -sha256 "$plaintext"))
export CRYPTR_PASSWORD