Problems with (anonymous) pipes with Win32
Gnupg User
gnugpg_@hotmail.com
Wed Oct 10 15:41:01 2001
I manage to make GnuPG-keys with "anonymous" pipes and
the --batch stuff, but I have no luck with --import...
This is on M$ NT4 and W2000 (don't flame me, it's for a
customer...).
"Pseudocode" for my sub I coded: (vars by refs)
sub GpgPipe( command, pipeout, pipein, pw )
CreatePipes //
CreateProcessA // In PROCESS_INFORMATION StdOut & StdErr have same handle
// Creationflag = DETACHED_PROCESS
if( pipein )
WriteFile( InWritePipe, pipein, ,, )
if( pw )
WriteFile( PwWritePipe, pw, ,, )
ReadFile( OutReadPipe, pipeout, ,, ) // I loop until I read less then the
bufsize
WriteFile( InWritePipe, "exit<cr><lf>", ,, ) // Workaround to exit the
gpg.exe-process
ClosePipeHandles
WaitForExitCode( !STILL_ACTIVE )
CloseProcessHandles
end sub
command = "gpg --yes --batch --gen-key"
batch = "<Some batch lines from doc examples>"
GpgPipe( command, resp, batch, "" ) // Works
DoSomeThingWith( resp )
command = "gpg --fingerprint " + user
GpgPipe( command, resp, "", "" ) // Works
DoSomeThingWith( resp )
command = "gpg --export -a"
GpgPipe( command, resp, "", "" ) // Works
DoSomeThingWith( resp )
// But
public_key = "<some public key text>"
command = "gpg --import"
GpgPipe( command, resp, public_key, "" ) // Does NOT work!!!!
DoSomeThingWith( resp )
"End Pseudo"
I have tried "command-lines" like:
gpg --import
gpg --import -
gpg --no-tty --import
gpg --no-tty --import -
gpg --batch --import
gpg --batch --import -
gpg --batch --no-tty --import
gpg --batch --no-tty --import -
cmd /C gpg --import
cmd /C gpg --import -
cmd /C gpg --no-tty --import
cmd /C gpg --no-tty --import -
cmd /C gpg --batch --import
cmd /C gpg --batch --import -
cmd /C gpg --batch --no-tty --import
cmd /C gpg --batch --no-tty --import -
With no success!!!! :-(
Everything above works from "CMD" like:
type <some armored public key file> | gpg --import
Questions:
Do I need to have the --batch parameter?
Do I need to append some line with "%commit" to
the "pipein-key" to let gpg submit the StdIn?
Or is it only the --gen-key command which allows StidIn/Pipe?
Or maybe it's fixed in >=1.0.6a ?
Best Regards
Claes
PS
One more thing, I don't understand why it's not possible to
get the fingerprint/info from an armored public key file
without import it or generate some temp-key?
_________________________________________________________________
Hämta MSN Explorer kostnadsfritt på http://explorer.msn.se