\see StructuringInfo, free_StructuringInfo
*/
bool signMessage( const char* cleartext,
- const char** ciphertext,
+ char** ciphertext,
const size_t* cipherLen,
const char* certificate,
- struct StructuringInfo* structuring );
+ struct StructuringInfo* structuring,
+ int* errId,
+ char** errTxt );
/*! \ingroup groupSignAct
const char** ciphertext,
const size_t* cipherLen,
const char* addressee,
- struct StructuringInfo* structuring );
+ struct StructuringInfo* structuring,
+ int* errId,
+ char** errTxt );
/*! \ingroup groupCryptAct
bool signMessage( const char* cleartext,
- const char** ciphertext,
+ char** ciphertext,
const size_t* cipherLen,
const char* certificate,
- struct StructuringInfo* structuring )
+ struct StructuringInfo* structuring,
+ int* errId,
+ char** errTxt )
{
GpgmeCtx ctx;
GpgmeError err;
}
gpgme_set_include_certs (ctx, sendCerts);
- /* PENDING(g10) Implement this
+ /* PENDING(g10) Implement this
gpgme_set_signature_algorithm( ctx, config.signatureAlgorithm )
--> This does not make sense. The algorithm is a property of
bOk = true;
strncpy((char*)*ciphertext, rSig, *cipherLen );
}
- ((char*)(*ciphertext))[*cipherLen] = '\0';
+ (*ciphertext)[*cipherLen] = '\0';
}
free( rSig );
}
else {
gpgme_data_release( sig );
*ciphertext = 0;
- /* erro handling missing to detect wther signing failed (hier
- fehlt eine Fehlerbehandlung, falls das Signieren schiefging) */
+ fprintf( stderr, "\ngpgme_op_sign() returned this error code: %i\n\n", err );
+ if( errId )
+ *errId = err;
+ if( errTxt ) {
+ const char* _errTxt = gpgme_strerror( err );
+ *errTxt = malloc( strlen( _errTxt ) + 1 );
+ if( *errTxt )
+ strcpy(*errTxt, _errTxt );
+ }
}
gpgme_data_release( data );
gpgme_release (ctx);
const char** ciphertext,
const size_t* cipherLen,
const char* certificate,
- struct StructuringInfo* structuring )
+ struct StructuringInfo* structuring,
+ int* errId,
+ char** errTxt )
{
GpgmeCtx ctx;
GpgmeError err;
err = gpgme_op_encrypt (ctx, rset, gPlaintext, gCiphertext );
- if( err )
- fprintf( stderr, "gpgme_op_encrypt() returned this error code: %i\n\n", err );
+ if( err ) {
+ fprintf( stderr, "\ngpgme_op_encrypt() returned this error code: %i\n\n", err );
+ if( errId )
+ *errId = err;
+ if( errTxt ) {
+ const char* _errTxt = gpgme_strerror( err );
+ *errTxt = malloc( strlen( _errTxt ) + 1 );
+ if( *errTxt )
+ strcpy(*errTxt, _errTxt );
+ }
+ }
gpgme_recipients_release (rset);
gpgme_data_release (gPlaintext);