diff options
author | Werner Koch <wk@gnupg.org> | 2013-12-11 10:20:15 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2013-12-11 10:20:15 +0100 |
commit | 101a54add351ff62793cbfbf3877787c4791f833 (patch) | |
tree | 7bf96a96fc6c3cf47ec70f5e78e0ccb97b75d257 /g10/mainproc.c | |
parent | gpg: Change OID of Ed25519 and add Brainpool oids. (diff) | |
download | gnupg2-101a54add351ff62793cbfbf3877787c4791f833.tar.xz gnupg2-101a54add351ff62793cbfbf3877787c4791f833.zip |
gpg: Change --show-session-key to print the session key earlier.
* g10/cpr.c (write_status_strings): New.
(write_status_text): Replace code by a call to write_status_strings.
* g10/mainproc.c (proc_encrypted): Remove show_session_key code.
* g10/decrypt-data.c (decrypt_data): Add new show_session_key code.
--
This feature can be used to return the session key for just a part of
a file. For example to downloading just the first 32k of a huge file,
decrypting that incomplete part and while ignoring all the errors
break out the session key. The session key may then be used on the
server to decrypt the entire file without the need to have the private
key on the server.
GnuPG-bug-id: 1389
Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'g10/mainproc.c')
-rw-r--r-- | g10/mainproc.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/g10/mainproc.c b/g10/mainproc.c index bd5cac5bc..18fe7e70b 100644 --- a/g10/mainproc.c +++ b/g10/mainproc.c @@ -570,6 +570,7 @@ proc_encrypted( CTX c, PACKET *pkt ) } else if( !c->dek ) result = G10ERR_NO_SECKEY; + if (!result) result = decrypt_data (c->ctrl, c, pkt->pkt.encrypted, c->dek ); @@ -584,16 +585,6 @@ proc_encrypted( CTX c, PACKET *pkt ) write_status( STATUS_GOODMDC ); else if(!opt.no_mdc_warn) log_info (_("WARNING: message was not integrity protected\n")); - if(opt.show_session_key) - { - int i; - char *buf = xmalloc ( c->dek->keylen*2 + 20 ); - sprintf ( buf, "%d:", c->dek->algo ); - for(i=0; i < c->dek->keylen; i++ ) - sprintf(buf+strlen(buf), "%02X", c->dek->key[i] ); - log_info( "session key: '%s'\n", buf ); - write_status_text ( STATUS_SESSION_KEY, buf ); - } } else if( result == G10ERR_BAD_SIGN ) { glo_ctrl.lasterr = result; |