|
Subject:
|
Decrypting pgp files with vbscript
|
|
Posted By:
|
tonyromero99
|
Post Date:
|
8/13/2004 12:23:47 PM
|
I'm trying to decrypt a gnupgp file using a vbscript. Here a copy of my script... 1) I created a WScript object, on which I execute the gpg command with the --decrypt function. Even though I can successfully decrypt the file I can't seem to automate the part where I have to provide my passphrase.
Has anyone dealt with this? If so I'd appreciate any help.
thanks,
-------------------------------------------------------- Set fso = CreateObject("Scripting.FileSystemObject")
Set objFolder = fso.GetFolder("C:\Inetpub\ftproot\ConcurrFTP\Inbox") Set objFiles = objFolder.Files Dim oShell Set oShell = WScript.CreateObject ("WScript.shell")
fPath = "C:\Inetpub\ftproot\ConcurrFTP\Inbox\"
dteCurrent = Date() timCurrent = Time() dteDay = Day(dteCurrent) dteMonth = Month(dteCurrent) dteYear = Year(dteCurrent) timMin = Minute(timCurrent) timHou = Hour(timCurrent)
if dteMonth < 10 then dteMonth = "0" & dteMonth if dteDay < 10 then dteDay = "0" & dteDay
Set f1 = fso.CreateTextFile(fPath & fFile, True)
' step through the files collection For Each objFile in objFiles
' get a file's name strName = objFile.Name
' make it lowercase for the URL strFile = Lcase(strName)
' get the file's type strType = objFile.Type
' make the name a title for display 'strName = MakeTitle(strName)
' get the file size in KB 'lngSize = objFile.Size\1024
NewFName = strFile NewFNameLen = len(NewFname) NewFName = Left(NewFName,NewFNameLen-4) & ".txt"
gnuComm = objFile FilTyp = left(strFile,4)
CurDat = dteYear & dteMonth & dteDay
CurrentDate = "" ActualDate = ""
if FilTyp = "extr" then ActDate = mid(strFile,16,8) CurrentDate = CurDat ActualDate = ActDate if CurrentDate = ActualDate then
'Decrypt file gnuComm2 = "c:\gnupg\gpg -o " & FPath & NewFName " --passphrase-fd 0 -d " & objFile gnuComm = gnuComm2 oShell.Run gnuComm, 1, true end if
end if Next
|
|
Reply By:
|
gap1549
|
Reply Date:
|
4/27/2006 9:03:43 AM
|
Did you ever solve this issue? I am having the same issue now. Not able to pass a passphrase using vbscript.
|
|
Reply By:
|
daebersold
|
Reply Date:
|
5/26/2006 9:37:21 AM
|
I am having the same problems with automating the decryption process. I've tried many different ways to pass in the passphrase, but to no avail.
|
|
Reply By:
|
mahsash
|
Reply Date:
|
11/30/2007 10:33:11 AM
|
Did you ever solve this issue? I am having the same issue now Please let me know how you did. Thanks
|
|
Reply By:
|
Mort1
|
Reply Date:
|
6/4/2008 4:09:23 AM
|
In order to pass the passphrase to GPG you have to put it in a file and use that file as a input like the following example:
gpg --batch -r 51E5908B --passphrase-fd 0 -e File2Encrypt.txt < passphrase-in-here.txt
|