I am new to Unix and ksh script writing. I wrote a script that decrypts a gpg message. I get this error that I do not know how to resolve. I was hoping someone could look at my script and help me figure out what is going on. Thank you for any assistance you can provide. Here is the error:
gpg: processing message failed: eof
Here is my script:
#!/bin/ksh
####################################################################
# 1. Decrypt Inbound File #
# #
# Two parms are required: output file #
# encrypted file(to be decrypted) #
# #
####################################################################
# Variable declaration #
####################################################################
outputF=$1
encryptedF=$2
id=$$
####################################################################
# print_message #
# prints messages to log file #
####################################################################
print_message()
{
message="$1"
echo "`date '+%m-%d-%y %T'` $message"
}
#####################################################################
# Validate input parameters and existence of encrypted file #
#####################################################################
if [ $1 -eq ""] || [ $2 -eq ""]
then
print_message "Parameters not satisfied"
exit 1
fi
if [ ! -f $encryptedF ]
then
print_message "$id ERROR: $encryptedF File does not exist"
exit 1
fi
#####################################################
# Decrypt encryptedF #
#####################################################
gpg --output "$outputF" --decrypt "$encryptedF"
echo "PASSPHRASE" | gpg --passphrase-fd 0
print_message "$id INFO: File Decrypted Successfully"
I get this error that I do not know how to resolve... Please edit your message to include the exact text of the error message. As you have discovered, use the{}edit tool to keep the format of the message. Good luck.gpgyou are executing. All the other code looks fine, I would delete that, and post only the simpliest test case forgpg. ..... I'm not sure how I can help, given what I know about unix processes in general, I would have expected your 2 commands to be merged into one, AND for the output ofgpgto be sent somewhere: a redirect file likegpg ... > unecryptedFileOR assigned to shell variable likemyUnecryptedOutput=$(gpg .... ). Can you update to include expected output of using some simple phrase of input? Good luck.