Saving photo of a key to a given filename

Kiefer, Sascha sk at intertivity.com
Wed Mar 16 18:38:13 CET 2005


Well, i use a c++ program to do the same (using CreateProcess and
redirecting STDIN, STDOUT, STDERR)
My code is

STARTUPINFO si;
BOOL result;

memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
si.hStdInput   = m_childstdinrd;
si.hStdOutput  = m_childstdoutwr;
si.hStdError   = m_childstderrwr;
si.wShowWindow = SW_HIDE;	

result = CreateProcess(
	NULL,
	(char *)m_cmdline.c_str(),
	NULL,
	NULL,
	TRUE,
	0,
	NULL,
	NULL,
	&si,
	&m_procinfo
);


And m_cmdline is defined as:

m_cmdline  = "gpg.exe";
m_cmdline += " --photo-viewer \"cmd /c copy /Y \"%i\" " + filename + "\"\"";
m_cmdline += " --status-fd 1 --command-fd 0 --edit-key \"" + fingerprint +
"\"";

So the edit-key command requieres additional input (since i say
'--command-fd 0' I'm able to use the redirected STDIN handle)
that looks like the following

input  = "showphoto\n";		// the edit command
input += "quit\n";		// quit is quit


HTH


> -----Original Message-----
> From: gnupg-users-bounces at gnupg.org 
> [mailto:gnupg-users-bounces at gnupg.org] On Behalf Of Thomas 
> Zangl - Home
> Sent: Mittwoch, 16. März 2005 17:28
> To: (GnuPG users)
> Subject: Re:Saving photo of a key to a given filename
> 
> 
>  
> Am Wed, 16 Mar 2005 15:49:27 +0100, schrieb "Sascha Kiefer" 
> <sk at intertivity.com>:
> 
> Hi,
> 
> >you can use the photo-viewer option.
> >example:
> >
> >- --photo-viewer \"cmd /c copy /Y \"%i\"filename.tmp\"\"
> >
> >will copy the picture-file to filename.tmp
> 
> Does work from the command line but not from within my Delphi 
> App. It seems that "cmd" is not called at all - maybe because 
> GPG is called from within a temporary batchfile which is 
> executed through "CreateProcess"... 
> 
> Is there no easy way to get the jpeg w/o using tempfiles 
> etc..? (Like I can parse the --list-keys output etc...)
> 
> Best regards,
> -- 
> ----------------------------------------------------------------
> ,yours Thomas Zangl -thomas at tzi.dhs.org- -TZ1-6BONE- 
> -http://tzi.dhs.org - http://www.borg-kindberg.ac.at Use 
> YAMC! now! Get it at http://www.borg-kindberg.ac.at/yamc/
> 
> _______________________________________________
> Gnupg-users mailing list
> Gnupg-users at gnupg.org 
> http://lists.gnupg.org/mailman/listinfo/gnupg-users
> 




More information about the Gnupg-users mailing list