LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Help w/ PGP and GPG (http://www.linuxquestions.org/questions/linux-software-2/help-w-pgp-and-gpg-546527/)

rsmccain 04-16-2007 01:31 PM

Help w/ PGP and GPG
 
I am running gpg-1.2.4-68.13 on a SLES box (kernel 2.6.5-7.244-smp). I have a script that is setup to encrypt a file and automatically FTP it to a business partner, whos public key I have imported. They are running a Windows version of PGP.

When they get the file and try to decrypt it the error "encrypted session key is bad" pops up. I have googled around and tried a few different options but can't seem to get it working. You'll see a few different options I have tried in the script below.

Any ideas?

---

#!/bin/sh
rm /home/dsshms/LAExtractMSSC.txt.gpg

#gpg --output /home/dsshms/LAExtractMSSC.txt.gpg --encrypt --compress-algo 1 --cipher-algo cast5 -
-recipient "Company Inc." /home/dsshms/LAExtractMSSC.txt

#gpg --output /home/dsshms/LAExtractMSSC.txt.gpg --encrypt --compress-algo 1 --recipient "Company Inc." /home/dsshms/LAExtractMSSC.txt

gpg --output /home/dsshms/LAExtractMSSC.txt.gpg --recipient "Company Inc." --encrypt --c
ipher-algo cast5 /home/dsshms/LAExtractMSSC.txt


cd /home/dsshms
HOST='host.domain.com'
USER='user'
PASSWD='pw1'
FILE='LAExtractMSSC.txt.gpg'

ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
cd incoming
put $FILE
quit
END_SCRIPT
exit 0

Matir 04-16-2007 01:35 PM

For one, I'm not seeing the "script below". That being said, is there any chance you are FTPing it in ASCII mode? (I.e., the line endings are being converted.) Make sure the file is the same on both ends: md5sum can be helpful in this regard.

rsmccain 04-16-2007 01:48 PM

woops..
 
Quote:

Originally Posted by Matir
For one, I'm not seeing the "script below". That being said, is there any chance you are FTPing it in ASCII mode? (I.e., the line endings are being converted.) Make sure the file is the same on both ends: md5sum can be helpful in this regard.

I have pasted the script into the original message. I thought FTP servers were smart enough to figure out ASCII and BINARY these days? Is that not true?

Thanks.

Matir 04-16-2007 01:56 PM

Quote:

Originally Posted by rsmccain
I have pasted the script into the original message. I thought FTP servers were smart enough to figure out ASCII and BINARY these days? Is that not true?

Thanks.

More often, it's client dependent. The default for most systems when transferring between Windows and *NIX (either way) is to enable line-ending switching, which corrupts truly binary files.

rsmccain 04-16-2007 01:58 PM

Quote:

Originally Posted by Matir
More often, it's client dependent. The default for most systems when transferring between Windows and *NIX (either way) is to enable line-ending switching, which corrupts truly binary files.

You are suggesting add "binary" into the script?

Matir 04-16-2007 02:07 PM

I believe the ftp command is "type binary". This assumes, of course, that a corrupt transfer is the cause of your problems. (Which can be verified with md5sum)

rsmccain 04-16-2007 02:32 PM

Quote:

Originally Posted by Matir
I believe the ftp command is "type binary". This assumes, of course, that a corrupt transfer is the cause of your problems. (Which can be verified with md5sum)

ok.. will check it out. thanks

rsmccain 04-16-2007 03:39 PM

Quote:

Originally Posted by Matir
I believe the ftp command is "type binary". This assumes, of course, that a corrupt transfer is the cause of your problems. (Which can be verified with md5sum)

THAT DID IT!

wow.. i spent days trying all kinds of gpg options and it was changing it to binary that did the trick..



thanks!

Matir 04-17-2007 12:40 AM

No problem! Glad it was so simple!

Thanks for posting the results.


All times are GMT -5. The time now is 11:34 PM.