WSHELL.EXEC StdOut Problems

K

Kocica

Trying to use gpg to encrypt text without creating an intermediate file.
Tried using pipes two different ways (see code).

Dim wshell, gnupg
Dim PGPTextBodyNotify1

set wshell = server.createobject("wscript.shell")

'First tried to use command level pipe, but asp ignores everything after the |
'set gnupg = wshell.run("D:\directory\printf test |
D:\directory\gpg.exe --homedir D:\directory -t --
always-trust -a -e -r user")

'since that didn't work, tried to program the pipe......
set gnupg = wshell.exec("D:\directory\gpg.exe --homedir D:\directory -t --
always-trust -a -e -r user")

'so here I input the string I want encrypted....
gnupg.StdIn.Write "test"
gnupg.StdIn.Write VbCrLf

' all of the above works when the following portion is commented out....
' when submitting the web based form, the script just hangs, doesn't do
anything,
' and perpetually waits for a response.
If Not gnupg.StdOut.AtEndOfStream Then
PGPTextBodyNotify1 = PGPTextBodyNotify1 & gnupg.StdOut.Read(1)
End If

' also tried to read this way... no luck
'PGPTextBodyNotify1 = gnupg.StdOut.ReadAll

set wshell = nothing
 
K

Kocica

I think the problem in this case is that I don't have any output to process
(correct me if I'm wrong).

gpg.exe -e runs and waits for text for input (from the command line). gpg
will only return the encrypted file contents when the user presses control z
(end of file).

I guess I need this: how do I signal EOF for wshell
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top