Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

executing external command to decrypt PGP files

Former Member
0 Likes
1,831

I'm trying to decrypt a .pgp file with GnuPG 1.4.6. I created a batch job with this command:

gpg --passphrase-fd 0 --decrypt-files *.pgp < {passphrase file}

When I execute the batch job through a Windows cmd line, it decrypts fine. When I call it through SM69, (with cmd /c {batch job file name}, the decryption fails.

It appears maybe the redirect changes the passphrase that is passing into gpg.

Does anyone have experience with this?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,378

Yes, this will be definitely due to the redirection symbol <. Actually redirection directive is not passed to the command, but here SAP SM69 will try to pass it to the command which is wrong.

On the operating system, the shell will not allow the command, here gpg, to see redirection symbol <. So I would suggest you to encapsulate the command in a shell script and use the shell script name as a command in SM69. That will definitely solve your problem

6 REPLIES 6
Read only

Former Member
0 Likes
1,379

Yes, this will be definitely due to the redirection symbol <. Actually redirection directive is not passed to the command, but here SAP SM69 will try to pass it to the command which is wrong.

On the operating system, the shell will not allow the command, here gpg, to see redirection symbol <. So I would suggest you to encapsulate the command in a shell script and use the shell script name as a command in SM69. That will definitely solve your problem

Read only

0 Likes
1,378

Sri Vishnu,

I think you are right about the redirection, but using the PATH variable to avoid cmd /c did not change the results. I've also tried to pipe the passphrase with an echo, and that too gets the same reaction.

Read only

0 Likes
1,378

Erik, I suppose you are using a batchfile name as your command and encapsulated the full pgp command inside that.

Given that info, are you using the full path name to the batchfile like say "C:\Program Files\Myexecutabl.bat" in the OS command field, in SM69?

You need to either provide full path to the batch file or put the batch file in a path present in the system PATH variable.

Read only

0 Likes
1,378

batch file name as my command, yes. pgp cmd inside it, yes.

I put the batch file in a PATH folder, but I also tried the former (full path in SM69), and neither solves.

Read only

Former Member
0 Likes
1,378

Once again reading your query, I realize that you are using batch file on Windows. If that is the case, I would suggest you to put the batch file in some system accessible path (PATH variable) and directly use the <batch job name> without cmd /c

Read only

Former Member
0 Likes
1,378

for posterity:

I figured this out. I created a scheduled task containing the batch file. The external command calls this scheduled task, and the pgp command runs as normal.