LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 04-16-2007, 02:31 PM   #1
rsmccain
Member
 
Registered: Apr 2004
Location: Louisiana
Distribution: SUSE
Posts: 154

Rep: Reputation: 30
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

Last edited by rsmccain; 04-16-2007 at 02:47 PM.
 
Old 04-16-2007, 02:35 PM   #2
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 118Reputation: 118
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.
 
Old 04-16-2007, 02:48 PM   #3
rsmccain
Member
 
Registered: Apr 2004
Location: Louisiana
Distribution: SUSE
Posts: 154

Original Poster
Rep: Reputation: 30
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.
 
Old 04-16-2007, 02:56 PM   #4
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 118Reputation: 118
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.
 
Old 04-16-2007, 02:58 PM   #5
rsmccain
Member
 
Registered: Apr 2004
Location: Louisiana
Distribution: SUSE
Posts: 154

Original Poster
Rep: Reputation: 30
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?

Last edited by rsmccain; 04-16-2007 at 03:01 PM.
 
Old 04-16-2007, 03:07 PM   #6
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 118Reputation: 118
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)
 
Old 04-16-2007, 03:32 PM   #7
rsmccain
Member
 
Registered: Apr 2004
Location: Louisiana
Distribution: SUSE
Posts: 154

Original Poster
Rep: Reputation: 30
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
 
Old 04-16-2007, 04:39 PM   #8
rsmccain
Member
 
Registered: Apr 2004
Location: Louisiana
Distribution: SUSE
Posts: 154

Original Poster
Rep: Reputation: 30
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!
 
Old 04-17-2007, 01:40 AM   #9
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 118Reputation: 118
No problem! Glad it was so simple!

Thanks for posting the results.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GPG / PGP subkeys wwnexc Linux - Security 1 05-21-2006 02:54 PM
bash & gpg/pgp rblampain Programming 3 08-16-2005 02:03 AM
KMail and PGP/GPG not working - doesn't ask for passphrase steve1401 Linux - General 2 02-08-2005 07:42 AM
How does GPG relate to PGP? davee Linux - Security 1 02-20-2004 08:52 AM
gpg / pgp encryption pteren Linux - Software 8 07-26-2003 04:14 AM


All times are GMT -5. The time now is 05:08 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration