Created
December 20, 2016 01:19
-
-
Save evpo/95deafcedbc0c81de004dce353d7d2e9 to your computer and use it in GitHub Desktop.
0001-replace-gpg-with-gpg2-and-add-batch.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 278d8b7234795631641a7ddce749cd31ac3175eb Mon Sep 17 00:00:00 2001 | |
From: Evgeny Pokhilko <software@evpo.net> | |
Date: Tue, 20 Dec 2016 12:16:22 +1100 | |
Subject: [PATCH] replace gpg with gpg2 and add batch | |
--- | |
func_tests/decryption_test.sh | 4 ++-- | |
func_tests/encrypt_with_gpg.sh | 3 ++- | |
func_tests/epd_encryption_test.sh | 11 ++++++----- | |
func_tests/run_all_tests.sh | 3 ++- | |
func_tests/x2_enc_step1.sh | 3 ++- | |
func_tests/x2_enc_step2.sh | 3 ++- | |
6 files changed, 16 insertions(+), 11 deletions(-) | |
diff --git a/func_tests/decryption_test.sh b/func_tests/decryption_test.sh | |
index 341c8be..776dfbb 100755 | |
--- a/func_tests/decryption_test.sh | |
+++ b/func_tests/decryption_test.sh | |
@@ -25,9 +25,9 @@ RESULT=0 | |
for FILE in ${IN_DIR}/* | |
do | |
- if [ $DECRYPTOR = "gpg" ] | |
+ if [[ "$DECRYPTOR" = "gpg" || "$DECRYPTOR" = "gpg2" ]] | |
then | |
- gpg -d --no-use-agent --passphrase-file $PASSPHRASE_FILE -o $TMP_DIR/out_file.txt $FILE | |
+ $DECRYPTOR -d --batch --no-use-agent --passphrase-file $PASSPHRASE_FILE -o $TMP_DIR/out_file.txt $FILE | |
else | |
cat $PASSPHRASE_FILE | $DECRYPTOR -d --pwd-fd 0 -o $TMP_DIR/out_file.txt $FILE | |
fi | |
diff --git a/func_tests/encrypt_with_gpg.sh b/func_tests/encrypt_with_gpg.sh | |
index bc42314..975f797 100755 | |
--- a/func_tests/encrypt_with_gpg.sh | |
+++ b/func_tests/encrypt_with_gpg.sh | |
@@ -1,7 +1,8 @@ | |
#!/bin/bash | |
set -e | |
set -o pipefail | |
-CMD="gpg -c --verbose --no-use-agent --passphrase-file passphrase.txt" | |
+GPG="gpg2" | |
+CMD="$GPG -c --verbose --batch --no-use-agent --passphrase-file passphrase.txt" | |
if [ "$PLAIN_TEXT_FILE" = "" ] | |
then | |
diff --git a/func_tests/epd_encryption_test.sh b/func_tests/epd_encryption_test.sh | |
index 64d0ec1..85d1545 100755 | |
--- a/func_tests/epd_encryption_test.sh | |
+++ b/func_tests/epd_encryption_test.sh | |
@@ -1,6 +1,7 @@ | |
#!/bin/bash | |
set -e | |
set -o pipefail | |
+GPG="gpg2" | |
USAGE="epd_encryption_test.sh <path_to_encryptcli> <tested_file>" | |
if [ $# -lt 2 ] | |
@@ -30,7 +31,7 @@ then | |
echo encrypted file does not exist | |
exit -1; | |
fi | |
-gpg -d --no-use-agent --passphrase-file $PASSPHRASE_FILE -o $TMP_DIR/out_file.txt $TMP_DIR/out_file.gpg | |
+$GPG -d --batch --batch --no-use-agent --passphrase-file $PASSPHRASE_FILE -o $TMP_DIR/out_file.txt $TMP_DIR/out_file.gpg | |
if diff $FILE $TMP_DIR/out_file.txt | |
then | |
@@ -65,7 +66,7 @@ rm $TMP_DIR/out_file.txt | |
############ | |
echo "Key only when encrypting a .gpg file" | |
$ENCRYPT_CLI -e --key-only --plain-text-key -k $KEY_FILE -o $TMP_DIR/out_file.gpg $FILE | |
-gpg -d --no-use-agent --passphrase-file $KEY_FILE -o $TMP_DIR/out_file.txt $TMP_DIR/out_file.gpg | |
+$GPG -d --batch --batch --no-use-agent --passphrase-file $KEY_FILE -o $TMP_DIR/out_file.txt $TMP_DIR/out_file.gpg | |
if diff $FILE $TMP_DIR/out_file.txt | |
then | |
@@ -154,7 +155,7 @@ rm $TMP_DIR/out_file.txt | |
echo "Encrypted key file generated by EncryptPad and decrypted by GPG" | |
cat $PASSPHRASE_FILE | $ENCRYPT_CLI --generate-key --key-pwd-fd 0 $TMP_DIR/encrypted_key.key | |
-gpg -d --no-use-agent --passphrase-file $PASSPHRASE_FILE -o $TMP_DIR/out_file.txt $TMP_DIR/encrypted_key.key | |
+$GPG -d --batch --batch --no-use-agent --passphrase-file $PASSPHRASE_FILE -o $TMP_DIR/out_file.txt $TMP_DIR/encrypted_key.key | |
if [ "$?" = "0" ] | |
then | |
@@ -172,8 +173,8 @@ echo "EncryptPad encrypts with an encrypted key file" | |
cat $PASSPHRASE_FILE | $ENCRYPT_CLI --generate-key --key-pwd-fd 0 $TMP_DIR/encrypted_key.key | |
cat $PASSPHRASE_FILE | $ENCRYPT_CLI -e --key-only --key-pwd-fd 0 -k $TMP_DIR/encrypted_key.key -o $TMP_DIR/out_file.gpg $FILE | |
-gpg -d --no-use-agent --passphrase-file $PASSPHRASE_FILE -o $TMP_DIR/unencrypted_key.key $TMP_DIR/encrypted_key.key | |
-gpg -d --no-use-agent --passphrase-file $TMP_DIR/unencrypted_key.key -o $TMP_DIR/out_file.txt $TMP_DIR/out_file.gpg | |
+$GPG -d --batch --no-use-agent --passphrase-file $PASSPHRASE_FILE -o $TMP_DIR/unencrypted_key.key $TMP_DIR/encrypted_key.key | |
+$GPG -d --batch --no-use-agent --passphrase-file $TMP_DIR/unencrypted_key.key -o $TMP_DIR/out_file.txt $TMP_DIR/out_file.gpg | |
if diff $FILE $TMP_DIR/out_file.txt | |
then | |
diff --git a/func_tests/run_all_tests.sh b/func_tests/run_all_tests.sh | |
index 1ca52b7..c5de188 100755 | |
--- a/func_tests/run_all_tests.sh | |
+++ b/func_tests/run_all_tests.sh | |
@@ -1,6 +1,7 @@ | |
#!/bin/bash | |
set -e | |
set -o pipefail | |
+GPG="gpg2" | |
S="$SHELL" | |
@@ -43,7 +44,7 @@ rm -R ./gpg_encrypted_last | |
$S ./encrypt_with_epd.sh $BIN "$PLAIN_TEXT_FILE" | |
# decrypt the above with gpg | |
-$S ./decryption_test.sh gpg ./epd_encrypted_last | |
+$S ./decryption_test.sh $GPG ./epd_encrypted_last | |
rm -R ./epd_encrypted_last | |
# input output redirection and pipes | |
diff --git a/func_tests/x2_enc_step1.sh b/func_tests/x2_enc_step1.sh | |
index 206d543..7d1bc8f 100755 | |
--- a/func_tests/x2_enc_step1.sh | |
+++ b/func_tests/x2_enc_step1.sh | |
@@ -1,2 +1,3 @@ | |
#!/bin/bash | |
-gpg -c --verbose --passphrase-file x2_key/test_x2_key.key -o x2_encrypted/enc_step1.gpg plain_text.txt | |
+GPG="gpg2" | |
+$GPG -c --verbose --passphrase-file x2_key/test_x2_key.key -o x2_encrypted/enc_step1.gpg plain_text.txt | |
diff --git a/func_tests/x2_enc_step2.sh b/func_tests/x2_enc_step2.sh | |
index cdd6ad2..f2102f9 100755 | |
--- a/func_tests/x2_enc_step2.sh | |
+++ b/func_tests/x2_enc_step2.sh | |
@@ -1,2 +1,3 @@ | |
#!/bin/bash | |
-gpg -c --verbose --passphrase-file passphrase.txt -o gpg_encrypted/CAST5_SHA1_none_key_file.gpg x2_encrypted/payload.wad | |
+GPG="gpg2" | |
+$GPG -c --verbose --passphrase-file passphrase.txt -o gpg_encrypted/CAST5_SHA1_none_key_file.gpg x2_encrypted/payload.wad | |
-- | |
2.5.0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment