(security checkin) currently working on signing messages
This commit is contained in:
parent
4e1814223b
commit
168f43d4ec
@ -636,29 +636,33 @@ bool signMessage( const char* cleartext,
|
|||||||
const char** ciphertext,
|
const char** ciphertext,
|
||||||
const char* certificate )
|
const char* certificate )
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
GpgmeCtx ctx;
|
GpgmeCtx ctx;
|
||||||
GpgmeData data, sig;
|
GpgmeData data, sig;
|
||||||
|
|
||||||
|
char buf[1024];
|
||||||
|
size_t nread;
|
||||||
|
|
||||||
|
|
||||||
gpgme_new (&ctx);
|
gpgme_new (&ctx);
|
||||||
gpgme_set_armor (ctx, 1);
|
gpgme_set_armor (ctx, 1);
|
||||||
gpgme_set_textmode (ctx, 1);
|
gpgme_set_textmode (ctx, 1);
|
||||||
|
|
||||||
gpgme_data_new_from_mem (&data, mime_object,
|
gpgme_data_new_from_mem (&data, cleartext,
|
||||||
mime_object_len, TRUE );
|
strlen( cleartext ), 1 );
|
||||||
gpgme_data_new ( &sig );
|
gpgme_data_new ( &sig );
|
||||||
gpgme_op_sign (ctx, data, sig, GPGME_SIG_MODE_DETACH );
|
gpgme_op_sign (ctx, data, sig, GPGME_SIG_MODE_DETACH );
|
||||||
|
|
||||||
fputs ( "Content-Type: multipart/signed;\r\n"
|
fputs ( "Content-Type: multipart/signed;\r\n"
|
||||||
" protocol=\"application/pgp-signature\";\r\n"
|
" protocol=\"application/pgp-signature\";\r\n"
|
||||||
" boundary=\"42=.42=.42=.42\"\r\n"
|
" boundary=\"42=.42=.42=.42\"\r\n"
|
||||||
"\r\n--42=.42=.42=.42\r\n", stdout );
|
"\r\n--42=.42=.42=.42\r\n",
|
||||||
|
stdout );
|
||||||
|
|
||||||
gpgme_data_rewind (data);
|
gpgme_data_rewind (data);
|
||||||
while ( !gpgme_data_read (data, buf, sizeof buf, &nread ) ) {
|
while ( !gpgme_data_read (data, buf, sizeof buf, &nread ) ) {
|
||||||
fwrite (buf, nread, 1, stdout );
|
fwrite (buf, nread, 1, stdout );
|
||||||
}
|
}
|
||||||
fputs ( "\r\n--42=.42=.42=.42--\r\n"
|
fputs ( "\r\n--42=.42=.42=.42\r\n"
|
||||||
"Content-Type: application/pgp-signature\r\n\r\n", stdout);
|
"Content-Type: application/pgp-signature\r\n\r\n", stdout);
|
||||||
|
|
||||||
gpgme_data_rewind (sig);
|
gpgme_data_rewind (sig);
|
||||||
@ -670,7 +674,7 @@ bool signMessage( const char* cleartext,
|
|||||||
gpgme_release (ctx);
|
gpgme_release (ctx);
|
||||||
gpgme_data_release(data);
|
gpgme_data_release(data);
|
||||||
gpgme_data_release(sig);
|
gpgme_data_release(sig);
|
||||||
*/
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user