Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: GnuPG: users

Signature check with libgpgme-11.dll

 

 

GnuPG users RSS feed   Index | Next | Previous | View Threaded


ph at sevencs

Nov 4, 2009, 7:34 AM

Post #1 of 2 (776 views)
Permalink
Signature check with libgpgme-11.dll

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-1.4.10 with valid crypto engine)?

If you need more details please let me know!

A soon answer would be appreciated!

Thank you very much and
best regards


Knud Pehrs
Software-Development
SevenCs GmbH
Ruhrstrasse 90, D-22761 Hamburg
Tel. +49-(0)40 851 72 40
Fax. +49-(0)40 851 72 479
www.sevencs.com

Handelsregister: Amtsgericht Hamburg HRB 102941
Geschäftsführer: John Humphrey


_______________________________________________
Gnupg-users mailing list
Gnupg-users [at] gnupg
http://lists.gnupg.org/mailman/listinfo/gnupg-users


ph at sevencs

Nov 4, 2009, 5:38 AM

Post #2 of 2 (706 views)
Permalink
Signature check with libgpgme-11.dll [In reply to]

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.
The gpg_MadeEasy_1.1.8 was configured with
./configure --prefix=/usr --enable-static --with-gpg=/usr/bin/gpg
--without-gpgsm --disable-largefile --without-pth-test
and build with make and make install.

To build the libraries I used MINGW32.
My operating system is WinXP and Visual Studio 2005 (C++).

I my application I load the libgpgme-11.dll via LoadLibrary(...).
If I start the app and init the GPGME I get always the same error 117440662 (invalid crypto engine)

Here is my initialization of GPGME:

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 )
{

// ******** HERE OCCURS THE ERROR 117440662 (invalid crypto engine) **********
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;
}
}

Have you any ideas how I can fix this error and what's the reason of this error is?

If you need more detailed information please let me know!

A soon answer would be appreciated!

Thank you very much and
best regards

Knud Pehrs
Software-Development
SevenCs GmbH
Ruhrstrasse 90, D-22761 Hamburg
Tel. +49-(0)40 851 72 40
Fax. +49-(0)40 851 72 479
www.sevencs.com

Handelsregister: Amtsgericht Hamburg HRB 102941
Geschäftsführer: John Humphrey


_______________________________________________
Gnupg-users mailing list
Gnupg-users [at] gnupg
http://lists.gnupg.org/mailman/listinfo/gnupg-users

GnuPG users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.