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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Failed to put to adpater from TX - Batch help?

Status
Not open for further replies.

RedSoxM3

IS-IT--Management
Mar 27, 2006
39
US
So, we use GNUPG to encrypt/decrypt. We call the batch script from the map using the batch adapter. The problem is, the subsequent map that processes the file commonly gets a "12" or source not available. Evidence is leaning towards gpg.exe taking too long to decrypt/encrypt. Does anyone know a batch solution to write the file with a .tmp extension and then rename it to the right extension when finished?

Here are my script examples:

Encrypt:
gpg -e -r 49786D11 %1

Decrypt:
type c:\mercenc.txt | gpg --passphrase-fd --decrypt %1

Thanks
 
The easiest solution is to use the PGP adapter that comes with the security option.

The next easiest option would be to call PGP from within your map using the GET function and return the encrypted or decrypted data to the map (get PGP to return the data using standard output).

If you just want to know how to create a particular file name from PGP, you can use "--output %1.tmp", then use REN to rename the file. See for PGP examples.

Cheers,
Olly.
 
Well, easy is relative. :) These are all production systems and changing the encryption method would require retesting. We would have to re-swap keys etc. right?

Do you have an example of option two? Could I add a retry? This is because GPG.exe commonly failes when it is busy.
 
Mercator 6.7.1 uses GNUPG anyway, but even if you changed your PGP software you can export keys from your old software and import into the new software anyway (i.e. you don't need to recreate keys).

I'm not sure whether GNUPG supports standard in / out, but using other PGP software you could:
save data to a file;
=VALID (PUT("FILE", tempfilename , encrypted_data),
FAIL (failed to create temporary encrypted file"))[/color blue]

then encrypt the data and get the results echoed back;
=EITHER (GET("SHL", "-CMD ""pgp -f < "+tempfilename+""""), FAIL ("failed to unencrypt data"))[/color blue]

then delete your original message;
=VALID (EXIT("rm",tempfilename," "), FAIL ("failed to delete encrypted file"))[/color blue]


(Ideally you'd do it in a single function but Mercator doesn't support passing data out with the GET/SHL function)

You'd have to build in retries, possibly in a loop. I've never had any problems with multiple instances of PGP though (maybe you're filenames are clashing?)

Cheers,
Olly
 
Would be nice to use SHL on Windows. EXIT("rm") is also hard to do.



BocaBurger
<===========================||////////////////|0
The pen is mightier than the sword, but the sword hurts more!
 
:) yes, "rm" would be difficult on windows!

GET could be used if another command is added on to echo back data.

Cheers,
Olly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top