Re: libgpgme-11.dll

2016-12-01 Thread Robert J. Hansen
> Did you install gpgme-w32spawn.exe alongside gpgme-11.dll ?  This 
> wrapper is required due to pecularities of Windows' CreateProcess
> API.

I did not, and this was the problem.  Thank you, Werner.  :)


___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


Re: libgpgme-11.dll

2016-12-01 Thread Werner Koch
On Thu,  1 Dec 2016 03:54, r...@sixdemonbag.org said:
> For long and boring reasons I need to be able to call GPGME from
> Microsoft Visual C++.  The MSVC linker requires .lib files, which are
> not shipped with GnuPG.  That's okay: the procedure to make them is

The gnupg 2.1 installer actually installs all header files as well as
the the .lib files (look for *.imp).  Note that the -11 suffix is not
used with the imp files.  If you are using glib or gtk+ make sure to
link against libgpgme-glib.imp. 

> My sample code runs just fine on OS X and Linux, incidentally, so I
> doubt the problem is with it.  (If people want to see it just to make

  set GPGME_DEBUG=9;c:/temp/gpgme.log
  mygpgmebasedtool

and then look at the log file.  It will show you where it looks for
gnupg.  The code in gpgme works even for gnupg 1.4 but it prefers gnupg
2.x. 

Did you install gpgme-w32spawn.exe alongside gpgme-11.dll ?  This
wrapper is required due to pecularities of Windows' CreateProcess API.


Salam-Shalom,

   Werner

-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.


pgp_QjIVPbaWn.pgp
Description: PGP signature
___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


libgpgme-11.dll

2016-11-30 Thread Robert J. Hansen
For long and boring reasons I need to be able to call GPGME from
Microsoft Visual C++.  The MSVC linker requires .lib files, which are
not shipped with GnuPG.  That's okay: the procedure to make them is
pretty straightforward.

For each of libgpgme-11.dll, libgpg-error-0.dll, and libassuan-0.dll, I:

1.  ran dumpbin /exports on it, to recover the function names
2.  put these function names in a text file with "EXPORTS" at the top
3.  ran lib /def:somefile.def /out:somefile.lib to create the .libs

(Insert appropriate filenames for "somefile", of course.)

A really basic test of GPGME passes: I can link against
gpgme_check_version and confirm the correct version of GPGME.  However,
I can't actually *do* anything with it: gpgme_engine_check_version
continually throws an invalid engine error, and gpgme_get_dirinfo keeps
on returning nulls.

So, if I had to wager a guess, GPGME isn't able to find GnuPG.

My sample code runs just fine on OS X and Linux, incidentally, so I
doubt the problem is with it.  (If people want to see it just to make
sure, I'm happy to provide it.)

Anyone have any ideas?

___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


Re: HELP - IMPORTANT - Signature check with libgpgme-11.dll

2009-11-09 Thread Werner Koch
On Fri,  6 Nov 2009 13:51, p...@sevencs.com said:

> I need some help as soon as possible!

If you in that urgent need for help you may want to check with a
commercial support company or a freelancer.  The GnuPG service directory
at http://www.gnupg.org/service.html may be helpful.


Shalom-Salam,

   Werner


-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.


___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


Signature check with libgpgme-11.dll

2009-11-04 Thread Knud Pehrs
Hello!

I have a problem to use the functions of libgpgme-11.dll in my application.
I have downloaded the gnupg-1.4.10, libgpg-error-1.7 and gpg_MadeEasy_1.1.8.
All three packages were installed to c:\usr\local\bin The gnupg-1.4.10 and 
libgpg-error-1.7 were build with ./configure, make, make install.

I have patched the gnupg-1.4.10 as described by Carlo Luciano Bianco.

The gpg_MadeEasy_1.1.8 was configured with ./configure --prefix=c:/usr/local 
--enable-static --with-gpg=c:/usr/local --without-gpgsm and build with make and 
make install.

To build the libraries I used MINGW32.
My operating system is WinXP and Visual Studio 2005 (C++).
In my application I load the libgpgme-11.dll via LoadLibrary(...).

I init GPGME like:
GPGSETLOCALE pSetLocale = (GPGSETLOCALE) GetProcAddress( hMod, 
"gpgme_set_locale" );
if( pSetLocale != NULL )
{
GPGVERSIONCHK pVersionChk = (GPGVERSIONCHK) GetProcAddress( 
hMod, "gpgme_check_version" );
if( pVersionChk != NULL )
{
setlocale (LC_ALL, "");
pVersionChk( NULL );
// gpgme_check_version
pSetLocale( NULL, LC_CTYPE, setlocale( LC_CTYPE, NULL ) 
);  // gpgme_set_locale 
}

GPGSETENGINEINFO pSetEngineInfo =(GPGSETENGINEINFO)GetProcAddress( 
hMod, gpgme_set_engine_info" );
if( pSetEngineInfo != NULL )
{
gpgme_error_t error = pSetEngineInfo( GPGME_PROTOCOL_OpenPGP, 
"gpg.exe", C:/usr/local/bin" );
if( error != GPG_ERR_NO_ERROR)  // 
gpgme_set_engine_info
{
freeResult = FreeLibrary( hMod );   // free the DLL 
module
return false;
}
}

I init CTX like:
// *** INIT CTX ***
GPGNEWDATA pNewData = (GPGNEWDATA) GetProcAddress( hMod, "gpgme_new" );
if( pNewData != NULL )
{
gpgme_error_t error = pNewData( &ctx );
if( error != GPG_ERR_NO_ERROR )
{
GPGRELDATA pRelData = (GPGRELDATA) GetProcAddress( 
hMod, "gpgme_data_release" );
if( pRelData != NULL )
pRelData( keydata );
freeResult = FreeLibrary( hMod );   
// free the DLL module
return false;
}
}

I read the public key file like:
GPGRead pRead = (GPGRead) GetProcAddress( hMod, 
"gpgme_data_new_from_file" );

if( pRead != NULL )
{
err = pRead( &keydata, cipher_2_asc, 1 );   // 
Method: gpgme_data_new_from_file
if( err != GPG_ERR_NO_ERROR )
{
// could not create a new data buffer
GPGRELDATA pRelData = (GPGRELDATA) GetProcAddress( 
hMod, "gpgme_data_release" );
if( pRelData != NULL )
pRelData( keydata );
freeResult = FreeLibrary( hMod );   
// free the DLL module
return false;
}
}


But if I import the public key file into the context CTX like following code I 
get the error 117440662 (invalid crypto engine).

GPGIMPORT pImport = (GPGIMPORT) GetProcAddress( hMod, "gpgme_op_import" 
);

if( pImport != NULL )
{
err = pImport( ctx, keydata );  
// Method: gpgme_op_import
if( err != GPG_ERR_NO_ERROR )
{
// could not import public key file
GPGRELDATA pRelData = (GPGRELDATA) GetProcAddress( 
hMod, "gpgme_data_release" );
if( pRelData != NULL )
pRelData( keydata );

GPGRELCTX pRelCTX = (GPGRELCTX) GetProcAddress( hMod, 
"gpgme_release" );
if( pRelCTX != NULL )
pRelCTX( ctx );
freeResult = FreeLibrary( hMod );   
// free the DLL module
return false;
}
}


If I test the following I get the ErrorCode GPG_ERR_INV_ENGINE
GPGENGINECHK pEngineChk = (GPGENGINECHK) GetProcAddress( hMod, 
"gpgme_engine_check_version" );
if( pEngineChk != NULL )
{
if( pEngineChk( GPGME_PROTOCOL_OpenPGP ) == GPG_ERR_NO_ERROR )
...
The version no. of the engine cannot found but the file_name can.

Do you have any ideas how I can fix this error (compile gnupg-

Calling libgpgme-11.dll from Visual basic 6

2009-10-16 Thread Franklin Hu

I have been able to find the Win32 version of the gpgme library called 
libgpgme-11.dll from the gpg4win package. I am trying to figure out how to call 
it from visual basic 6. I have first started by looking how to call C dlls from 
vb:
 
http://support.microsoft.com/kb/106553
 
I want to call the gpgme_new function which takes one parameter which is a 
context. It is declared in the .h file (used when calling from c++) as:
 
/* The context holds some global state and configration options, as
well as the results of a crypto operation. */
struct gpgme_context;
typedef struct gpgme_context *gpgme_ctx_t;
/* Create a new context and return it in CTX. */
gpgme_error_t gpgme_new (gpgme_ctx_t *ctx);
 
To start, I just tried to set it up and call it like:
 
Declare Function gpgme_new Lib "libgpgme-11.dll" (ctx)
Sub Main()
Dim ctx
Dim gpgme_error

gpgme_error = gpgme_new(ctx)
End Sub
 
It is able to find the dll and the reference to gpgme_new. If I put in the name 
of a function which doesn't exist, it complains. But it comes back with the 
error:
 
Run-time error '49':
Bad DLL calling convention
 
I looked up this error and found:
http://support.microsoft.com/kb/85108
 
This said something about calling ByVal which I tried and that didn't do 
anything. Seems to me, I need to figure out just what kind of object the ctx is 
and specify that specific type 
in the declaration. The way it is declared, it just looks like a pointer, but 
VB doesn't have a pointer type.
 
I'm a beginner to this whole gpg and calling DLL thing. So I'm not even sure 
that it is possible to do this or if I'm just making a silly mistake in the 
declaration. If anyone can help out on how to call this dll, I would appreciate 
it.
 
-thanks


  ___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users