Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Other Programming > VBScript
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VBScript For questions and discussions related to VBScript.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VBScript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 13th, 2004, 12:23 PM
Registered User
 
Join Date: Aug 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Decrypting pgp files with vbscript

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 With Quote
  #2 (permalink)  
Old April 27th, 2006, 09:03 AM
Registered User
 
Join Date: Apr 2006
Location: Nashville, TN, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Did you ever solve this issue? I am having the same issue now. Not able to pass a passphrase using vbscript.

Reply With Quote
  #3 (permalink)  
Old May 26th, 2006, 09:37 AM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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 With Quote
  #4 (permalink)  
Old November 30th, 2007, 11:33 AM
Registered User
 
Join Date: Nov 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Did you ever solve this issue? I am having the same issue now
Please let me know how you did.
Thanks

Reply With Quote
  #5 (permalink)  
Old June 4th, 2008, 04:09 AM
Registered User
 
Join Date: Jun 2008
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
open password for excel files in VBscript lambin VB Databases Basics 0 January 24th, 2008 05:05 AM
PGP Encryption everest C# 2005 4 October 28th, 2007 08:20 PM
Extracting Files from a ZIP archive via VBScript kevorkian ASP.NET 1.0 and 1.1 Basics 1 June 19th, 2006 08:06 PM
Copying files using VBScript in ADO 3.0 munrrob Classic ASP Basics 2 October 26th, 2004 05:35 AM
pgp file? ktchlin C# 1 July 26th, 2004 07:49 AM



All times are GMT -4. The time now is 04:09 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.