100 |
|
|
101 |
|
|
102 |
void |
void |
103 |
_gpgme_release_decrypt_result( _decrypt_result_t res ) |
_gpgme_release_decrypt_result (_decrypt_result_t res) |
104 |
{ |
{ |
105 |
if( res ) { |
if (res) { |
106 |
safe_free (res->passphrase_info); |
safe_free (res->passphrase_info); |
107 |
safe_free (res->userid_hint); |
safe_free (res->userid_hint); |
108 |
safe_free (res->file_name); |
safe_free (res->file_name); |
188 |
return; |
return; |
189 |
} |
} |
190 |
} |
} |
|
|
|
191 |
assert (ctx->result_type == RESULT_TYPE_DECRYPT); |
assert (ctx->result_type == RESULT_TYPE_DECRYPT); |
192 |
|
|
193 |
if (code == STATUS_GOODSIG || code == STATUS_REVKEYSIG |
if (code == STATUS_GOODSIG || code == STATUS_REVKEYSIG |
550 |
_gpgme_gpg_add_arg( ctx->gpg, "--yes" ); |
_gpgme_gpg_add_arg( ctx->gpg, "--yes" ); |
551 |
if( nfiles > 1 || !output ) |
if( nfiles > 1 || !output ) |
552 |
_gpgme_gpg_add_arg( ctx->gpg, "--no-mangle-dos-filenames" ); |
_gpgme_gpg_add_arg( ctx->gpg, "--no-mangle-dos-filenames" ); |
553 |
if( ctx->pipemode || nfiles > 1 ) |
if( ctx->use_pipemode || nfiles > 1 ) |
554 |
_gpgme_gpg_add_arg( ctx->gpg, "--decrypt-files" ); |
_gpgme_gpg_add_arg( ctx->gpg, "--decrypt-files" ); |
555 |
else |
else |
556 |
_gpgme_gpg_add_arg( ctx->gpg, "--decrypt" ); |
_gpgme_gpg_add_arg( ctx->gpg, "--decrypt" ); |
557 |
|
|
558 |
/* cannot use --output with --decrypt-files */ |
/* cannot use --output with --decrypt-files */ |
559 |
if( nfiles == 1 && !ctx->pipemode && output ) { |
if( nfiles == 1 && !ctx->use_pipemode && output ) { |
560 |
_gpgme_gpg_add_arg( ctx->gpg, "--output" ); |
_gpgme_gpg_add_arg( ctx->gpg, "--output" ); |
561 |
_gpgme_gpg_add_arg( ctx->gpg, output ); |
_gpgme_gpg_add_arg( ctx->gpg, output ); |
562 |
} |
} |
575 |
|
|
576 |
|
|
577 |
static gpgme_error_t |
static gpgme_error_t |
578 |
decrypt_start( gpgme_ctx_t ctx, gpgme_data_t ciph, gpgme_data_t plain ) |
decrypt_start (gpgme_ctx_t ctx, gpgme_data_t ciph, gpgme_data_t plain) |
579 |
{ |
{ |
580 |
int rc = 0; |
int rc = 0; |
581 |
|
|
591 |
if( rc ) |
if( rc ) |
592 |
goto leave; |
goto leave; |
593 |
|
|
594 |
_gpgme_gpg_set_status_handler( ctx->gpg, decrypt_status_handler, ctx ); |
_gpgme_gpg_set_status_handler (ctx->gpg, decrypt_status_handler, ctx); |
595 |
if( ctx->use_logging ) |
if (ctx->use_logging) |
596 |
_gpgme_gpg_set_logging_handler( ctx->gpg, ctx ); |
_gpgme_gpg_set_logging_handler (ctx->gpg, ctx); |
597 |
if( ctx->cb.passphrase ) { |
if (ctx->cb.passphrase) { |
598 |
rc = _gpgme_gpg_set_command_handler( ctx->gpg, decrypt_command_handler, ctx ); |
rc = _gpgme_gpg_set_command_handler (ctx->gpg, decrypt_command_handler, ctx); |
599 |
if ( rc ) |
if (rc) |
600 |
goto leave; |
goto leave; |
601 |
} |
} |
602 |
else if( ctx->passphrase_value ) { |
else if( ctx->passphrase_value ) { |
731 |
|
|
732 |
|
|
733 |
gpgme_error_t |
gpgme_error_t |
734 |
gpgme_op_clip_decrypt( gpgme_ctx_t ctx ) |
gpgme_op_clip_decrypt (gpgme_ctx_t ctx) |
735 |
{ |
{ |
736 |
gpgme_error_t err; |
gpgme_error_t err; |
737 |
gpgme_data_t ciph = NULL; |
gpgme_data_t ciph = NULL; |
738 |
gpgme_data_t plain = NULL; |
gpgme_data_t plain = NULL; |
739 |
|
|
740 |
err = gpgme_data_new_from_clipboard (&ciph); |
err = gpgme_data_new_from_clipboard (&ciph); |
741 |
if( !err ) |
if (!err) |
742 |
err = gpgme_data_new( &plain ); |
err = gpgme_data_new (&plain); |
743 |
if( !err ) |
if (!err) |
744 |
err = gpgme_op_decrypt( ctx, ciph, plain ); |
err = gpgme_op_decrypt (ctx, ciph, plain); |
|
|
|
|
gpgme_data_release_and_set_clipboard( plain ); |
|
|
gpgme_data_release( ciph ); |
|
745 |
|
|
746 |
|
gpgme_data_release_and_set_clipboard (plain); |
747 |
|
gpgme_data_release (ciph); |
748 |
return err; |
return err; |
749 |
} /* gpgme_op_clip_decrypt */ |
} /* gpgme_op_clip_decrypt */ |