bad passphrase error passing it into GPG on Windows 98 using stdin
Will Morgan
gnugpghelp@mlhp.net
Wed Jun 26 20:51:01 2002
Hello, I've been wallowing around for a few days and would really appreciate
some help!
Using the latest posted windows executable - 1.06 - I've got code going in
VB / Microsoft Access on Windows '98 that appears to succesfully write and
read STDIO via pipes to GPG.EXE but i have not been able to decrypt
anything, getting a bad passphrase error that does not occur when i do this
interactively. At this point I'd be happy to pass the pass phrase pretty
much any which way i can, the following method of using stdin is what i've
tried without success, any ideas about what i might do differently with this
technique or others to front end decrypting a batch o messages on win 98?
Thanks! Will
- Problem Description:
--- versions
gpg (GnuPG) 1.0.6-2
( latest windows executable available on www.gnupg.org )
called from VB / Microsoft Access running on Windows 98
--- commandline
gpg -o c:clearout.txt --passphrase-fd 0 --decrypt c:\cypherin.txt
--- input / stdin
I've tried setting the stdin string to "mypass phrase", "mypass phrase" &
vblf and "mypass phrase" & vbcrlf. ( I believe vblf is the same as /n )
--- output
gpg: encrypted with 1024-bit ELG-E key, <key ID>, created 2002-05-22
<key name >
gpg: public key decryption failed: bad passphrase
gpg: decryption failed: secret key not available
gpg: block_filter 0049775C: read error (size=8269,a->size=16777293)
gpg: block_filter: pending bytes!
--- Full text to code including winapi declarations at
http://www.speakeasy.org/~willmorg/gpgpost/execcmdstdio.txt
--- i believe the crux o' the code lines:
...
ret& = CreatePipe(hReadPipe3, hWritePipe3, sa, 0)
ret& = CreatePipe(hReadPipe2, hWritePipe2, sa, 0)
' Initialize the STARTUPINFO structure:
start.cb = Len(start)
start.dwFlags = STARTF_USESTDHANDLES
start.hStdInput = hReadPipe3
start.hStdError = hWritePipe2
start.hStdOutput = hWritePipe2
ret& = WriteFile(hWritePipe3, szStdIn, Len(szStdIn), lbytesWritten, 0&)
Call CloseHandle(hWritePipe3)
ret& = CreateProcessA(0&, cmdline$, sa, sa, 1&, NORMAL_PRIORITY_CLASS,
0&, 0&, start, proc)
...
The process returns instantly with the error, if i don't write to the pipe
gpg says its waiting on fd-0.