Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GPG Command Line - RUN Issue 1

Status
Not open for further replies.

JRB-Bldr

Programmer
May 17, 2001
3,281
US
I don't know if anyone of you has had to use PGP/GPG encryption on files, but I am running into an issue which is baffling me for the time being.

I HATE PGP since it typically takes over an entire workstation whether during the installation you configure it NOT to or not. Consequently my first choice is to get GPG working.

Since I have not found a GPG ActiveX, I am reverting to using GPG4Win and getting it to run its GPG.EXE with a Command line string.

That in itself has been a lengthy effort with a GREAT deal of assistance from another forum guru, but now the command string that I have is working as long as I manually type it into a DOS window.

But when I try to execute it with a VFP RUN command, it will not execute.

NOTE - the command string is 210 characters long if I shorten the path references wihtin the string to DOS 8 character abbreviations. If I do not shorten the path references it is a good bit longer.

I have tried executing the command string itself
RUN cGPGCommand
And I have tried writing the command string into a BAT file and then executing it
RUN GPGCommand.bat

Nothing I do seems to work.
The DOS black screen flashes on 'execution', but when I look for the resultant output file, it does not exist.

Any ideas?

Your advice/suggestions would be greatly appreciated.

Thanks,
JRB-Bldr
 
JRB-Bldr,

I don't know this program, however ...

You say that when you run it, you can't see any output file. So, what happens if you run it manually from a DOS window? Does an output file get created? Have you tried looking for it in the same place with the RUN version?

Or, is the output merely echoed to the screen? If so, have you tried redirecting it to a file, using the ">" character?

(Sorry if this is stating the obvious.)

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
GPG is the open source version of PGP encryption.
GPG4Win is a Windows version GUI interface for it.

The GPG.exe will encrypt an input file with the passed parameters (keyrings, etc.) and output the resultant encrypted file where designated.

When I run this command string manually it will work on the designated input file: C:\Temp\NonEncrypted.txt
and create a designated output file which I have pathed & named: C:\Temp\Encrypted.pgp

For testing purposes I erase the output file
C:\Temp\Encrypted.pgp
each time before running the test so that I can determine afterwards by the file's existence (or not) if the routine worked (or not).

NOTE - while grasping for straws at getting this resolved I launched FOXRUN independently and tried it. When I did that it would not allow manual entry of the entire command string at its DOS prompt. Its input cut off and would not allow any more characters to be typed before the entire string can be entered. Perhaps that offers a clue.
I have yet to test it with the BAT file but I will do so when I am in their office again next Monday.

Any insights that you have to offer will be greatly appreciated.

Thanks,
JRB-Bldr


 
Actually we are using XP Pro.

As I mentioned above, GPG worked well when I manually entered the command line string in a DOS window - indicating that it will a command line 'script'

In fact, the command line includes a PIPE where the first part of the command line (before the PIPE character) includes the valid Passphrase and the second part (after the PIPE character) utilizes the parameter specified before the PIPE.

It is only when I attempt to run that same command string in a VFP RUN command that it will not do its job.

Thanks,
JRB-Bldr
 
For anyone who might be interested I FINALLY got the GPG encryption command to run successfully.

What was necessary...
1. Put my Input file into the GPG directory
2. Set my VFP Path to include the GPG directory as the first search path.
3. Define my output file to 'live' in the GPG directory
4. Write the now shortened command string (now no paths needed in the command string) to a BAT file in the GPG directory
5. Execute the BAT file with the Win API ShellExecute()
6. Move the both Input file and encrypted Output file to their 'real' destination path.
7. Delete temporary BAT file
8. Reset VFP Path back to original path.
9. Send encrypted Output file to client via SFTP file transfer.

Lots of fun, but it now works as needed.

Thanks for your help.
JRB-Bldr

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top