NetTalk Central
NetTalk Web Server => Web Server - Share Knowledge => Topic started by: kevin plummer on March 16, 2014, 05:38:32 PM
-
Hi All,
I have a new client that wants a csv file PGP encrypted before FTPing it to their site. They have sent me a public key with an asc extension. Is this possible? My program runs on a 64bit windows 2008 server.
Cheers,
Kevin
-
Sure, it's possible.
Nothing to do with NetTalk, but I have a SQL Agent job that runs a Clarion program on a 64-bit Server2008 R2 machine to create a text file (not CSV, but some weird delimiters which is why I didn't use SSIS).
It was a bit of a challenge finding a cheap (or in this case, free) command-line PGP client.
I wound up using gpg2.exe.
The program and all its DLLs are in a folder used by my job.
After creating the text file, my program runs a batch file with one line:
gpg2 --homedir . -r client6 -a -o %1 -e %2
Then I run another batch file that calls WinSCP (a free SFTP program) to upload it.
I set this up about a year ago, so details are very fuzzy. There was some twiddling with getting keys into trustdb.gpg.
If I run gpg2 --list-public-keys --homedir .
It shows that "client6" is the uid in the trustdb file in the folder I'm using.
It's been running every night since then.
Jane
-
Thanks Jane - this is exactly what I need.
Cheers,
Kevin
-
Hi Jane,
I downloaded winscp and can transfer a file using the onscreen gui. When I try to use the following in my app I always get an error. I also tried to put the following in a script file but still no joy. I'm not sure what I'm doing wrong.
RUN('c:\winscp\winscp.exe /command <34>option batch abort<34> <34>option confirm off<34> <34>open sftp://' & Clip(L:User) & ':' & Clip(L:Pass) & '@' & Clip(L:IPAddress) & '/<34> <34>put ' & Clip(L:FileName3) & ' ' & Clip(L:Directory) & '<34> <34>exit<34>',1)
L:Directory = '/Inbound/' but I have also tried various combinations
any tips?
Cheers,
Kevin
-
Hi, Kevin,
Bearing in mind that we're just talking about the SFTP part of the process... I've PGP encrypted the file first.
Also... when I first set up an SFTP to a site, I'll normally connect manually first. A lot of times you get a "do you want to install this site's certificate" message.
My SFTP upload is two pieces.
There's a batch file, which reads:
"C:\Program Files (x86)\WinSCP\WinSCP.com" /script=c:\340b\Walgreen\WalgreenWinSCPscript.txt /log=c:\340b\Walgreen\Walgreens.log
And the script file it calls consists of:
option batch abort
option confirm off
open Walgreens
option transfer binary
lcd c:\340b\walgreen
put -nopermissions -nopreservetime c:\340b\Walgreen\OutputData\9310*.pgp *.pgp
close
exit
The "open Walgreens" is opening a site I've saved in WinSCP called Walgreens.
At least one other tweak I remember is needing to tell WinSCP to store its sites setup in an INI file rather than in the registry (since I'm running this as SQL Agent, not as a logged on user.) Pic attached.
You may also find this useful:
http://winscp.net/eng/docs/guide_automation
Cheers,
Jane
[attachment deleted by admin]
-
Thanks Jane that really helped - I can now get a file into the root folder but can't work out how to get it into the /Inbound/ folder. Still trying a few different combinations...
<34>put -nopermissions -nopreservetime ' & Clip(L:FileName3) & ' /Inbound/<34>
-
I finally found the lucky combination Inbound/
The docs and examples are a bit sketchy but it's a neat program that does what I want so thanks a million again for all your help Jane!
-
Awesome post, this should definitely get copied into the "Share Knowledge" forum .. Any mods able to do this?