changed code according to our hack before CeBIT, we are giving *binary* data to the decryptMessage() and to the checkMessageSignature() methode instead of passing base64 encoded data to them
This commit is contained in:
parent
5ccbdf8cd7
commit
b5bc40d9d7
@ -1549,8 +1549,11 @@ bool encryptAndSignMessage( const char* cleartext,
|
|||||||
\c true, otherwise
|
\c true, otherwise
|
||||||
\c false.
|
\c false.
|
||||||
*/
|
*/
|
||||||
bool decryptMessage( const char* ciphertext, const
|
bool decryptMessage( const char* ciphertext,
|
||||||
char** cleartext, const char* certificate );
|
bool cipherIsBinary,
|
||||||
|
int cipherLen,
|
||||||
|
const char** cleartext,
|
||||||
|
const char* certificate );
|
||||||
|
|
||||||
/*! \ingroup groupCryptAct
|
/*! \ingroup groupCryptAct
|
||||||
\brief Combines the functionality of
|
\brief Combines the functionality of
|
||||||
|
@ -1204,8 +1204,8 @@ bool findCertificates( const char* addressee, char** certificates )
|
|||||||
GpgmeKey rKey;
|
GpgmeKey rKey;
|
||||||
const char *s;
|
const char *s;
|
||||||
const char *s2;
|
const char *s2;
|
||||||
bool bOk = false;
|
int nFound = 0;
|
||||||
|
|
||||||
strcpy( *certificates, "" );
|
strcpy( *certificates, "" );
|
||||||
|
|
||||||
gpgme_new (&ctx);
|
gpgme_new (&ctx);
|
||||||
@ -1215,21 +1215,25 @@ bool findCertificates( const char* addressee, char** certificates )
|
|||||||
while( GPGME_No_Error == err ) {
|
while( GPGME_No_Error == err ) {
|
||||||
err = gpgme_op_keylist_next(ctx, &rKey);
|
err = gpgme_op_keylist_next(ctx, &rKey);
|
||||||
if( GPGME_No_Error == err ) {
|
if( GPGME_No_Error == err ) {
|
||||||
bOk = true;
|
|
||||||
s = gpgme_key_get_string_attr (rKey, GPGME_ATTR_USERID, NULL, 0);
|
s = gpgme_key_get_string_attr (rKey, GPGME_ATTR_USERID, NULL, 0);
|
||||||
if( s ) {
|
if( s ) {
|
||||||
s2 = gpgme_key_get_string_attr (rKey, GPGME_ATTR_FPR, NULL, 0);
|
s2 = gpgme_key_get_string_attr (rKey, GPGME_ATTR_FPR, NULL, 0);
|
||||||
if( s2 ) {
|
if( s2 ) {
|
||||||
|
if( nFound )
|
||||||
|
strcat(*certificates,"\1" );
|
||||||
strcat( *certificates, s );
|
strcat( *certificates, s );
|
||||||
strcat( *certificates, " (" );
|
strcat( *certificates, " (" );
|
||||||
strcat( *certificates, s2 );
|
strcat( *certificates, s2 );
|
||||||
strcat( *certificates, ")\1" );
|
strcat( *certificates, ")" );
|
||||||
|
++nFound;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gpgme_op_keylist_end( ctx );
|
gpgme_op_keylist_end( ctx );
|
||||||
return bOk;
|
gpgme_release (ctx);
|
||||||
|
|
||||||
|
return ( 0 < nFound );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool encryptMessage( const char* cleartext,
|
bool encryptMessage( const char* cleartext,
|
||||||
@ -1419,7 +1423,10 @@ bool encryptAndSignMessage( const char* cleartext,
|
|||||||
return bOk;
|
return bOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool decryptMessage( const char* ciphertext,
|
bool decryptMessage( const char* ciphertext,
|
||||||
|
bool cipherIsBinary,
|
||||||
|
int cipherLen,
|
||||||
const char** cleartext,
|
const char** cleartext,
|
||||||
const char* certificate )
|
const char* certificate )
|
||||||
{
|
{
|
||||||
@ -1435,9 +1442,21 @@ bool decryptMessage( const char* ciphertext,
|
|||||||
|
|
||||||
err = gpgme_new (&ctx);
|
err = gpgme_new (&ctx);
|
||||||
gpgme_set_protocol (ctx, GPGMEPLUG_PROTOCOL);
|
gpgme_set_protocol (ctx, GPGMEPLUG_PROTOCOL);
|
||||||
|
|
||||||
|
gpgme_set_armor (ctx, cipherIsBinary ? 0 : 1);
|
||||||
|
// gpgme_set_textmode (ctx, cipherIsBinary ? 0 : 1);
|
||||||
|
|
||||||
|
/*
|
||||||
gpgme_data_new_from_mem( &gCiphertext, ciphertext,
|
gpgme_data_new_from_mem( &gCiphertext, ciphertext,
|
||||||
1+strlen( ciphertext ), 1 );
|
1+strlen( ciphertext ), 1 );
|
||||||
|
*/
|
||||||
|
gpgme_data_new_from_mem( &gCiphertext,
|
||||||
|
ciphertext,
|
||||||
|
cipherIsBinary
|
||||||
|
? cipherLen
|
||||||
|
: strlen( ciphertext ),
|
||||||
|
1 );
|
||||||
|
|
||||||
gpgme_data_new( &gPlaintext );
|
gpgme_data_new( &gPlaintext );
|
||||||
|
|
||||||
gpgme_op_decrypt( ctx, gCiphertext, gPlaintext );
|
gpgme_op_decrypt( ctx, gCiphertext, gPlaintext );
|
||||||
|
Loading…
Reference in New Issue
Block a user