bad passphrase error passing it into GPG on Windows 98 using stdin

Leigh S. Jones, KR6X kr6x@kr6x.com
Wed Jun 26 22:43:02 2002


All the concepts below are consistent with the way it works
on a Linux box.  However, the MingW32 implementation (1.0.6)
requires that the file descriptors being passed to it with
--passphrase-fd, --command-fd, --status-fd, etc., be converted
from the file descriptor numerical value (usually very close to
4) to an "osf_filehandle" before being placed on the command
line as a decimal number string.  Maybe this is something that
Werner could change in future MingW32 implementations so
that there wouldn't be so much confusion among the Windows
set.

Being a C programmer rather than a VB programmer I don't
know for sure what the easiest way for you to get the file
descriptor converted would be.  I do know that there is a
Visual C runtime library in every copy of Windows, so if there's
no VB function to do the job, then the option of calling the
function osf_filehandle in the .dll from VB is viable.

----- Original Message -----
From: "Will Morgan" <gnugpghelp@mlhp.net>
To: <gnupg-users@gnupg.org>
Sent: Wednesday, June 26, 2002 11:52
Subject: bad passphrase error passing it into GPG on Windows 98 using stdin


> 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.
>
>
> _______________________________________________
> Gnupg-users mailing list
> Gnupg-users@gnupg.org
> http://lists.gnupg.org/mailman/listinfo/gnupg-users
>