diff options
author | Werner Koch <[email protected]> | 2013-08-26 15:29:54 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2013-08-28 15:40:32 +0000 |
commit | 780ba3233618393835970bac4cf8aab713f4d7fa (patch) | |
tree | 646f0a60cff18fb3743abeecc46bb2a21877937c /agent/divert-scd.c | |
parent | agent: Fix two compiler warnings. (diff) | |
download | gnupg-780ba3233618393835970bac4cf8aab713f4d7fa.tar.gz gnupg-780ba3233618393835970bac4cf8aab713f4d7fa.zip |
gpg: Make decryption with the OpenPGP card work.
* scd/app-common.h (APP_DECIPHER_INFO_NOPAD): New.
* scd/app-openpgp.c (do_decipher): Add arg R_INFO.
* scd/app-nks.c (do_decipher): Add arg R_INFO as a dummy.
* scd/app.c (app_decipher): Add arg R_INFO.
* scd/command.c (cmd_pkdecrypt): Print status line "PADDING".
* agent/call-scd.c (padding_info_cb): New.
(agent_card_pkdecrypt): Add arg R_PADDING.
* agent/divert-scd.c (divert_pkdecrypt): Ditto.
* agent/pkdecrypt.c (agent_pkdecrypt): Ditto.
* agent/command.c (cmd_pkdecrypt): Print status line "PADDING".
* g10/call-agent.c (padding_info_cb): New.
(agent_pkdecrypt): Add arg R_PADDING.
* g10/pubkey-enc.c (get_it): Use padding info.
--
Decryption using a card never worked in gpg 2.1 because the
information whether the pkcs#1 padding needs to be removed was not
available. Gpg < 2.1 too this info from the secret sub key but that
has gone in 2.1.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'agent/divert-scd.c')
-rw-r--r-- | agent/divert-scd.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/agent/divert-scd.c b/agent/divert-scd.c index f0d847389..ceef588fb 100644 --- a/agent/divert-scd.c +++ b/agent/divert-scd.c @@ -383,12 +383,13 @@ divert_pksign (ctrl_t ctrl, /* Decrypt the the value given asn an S-expression in CIPHER using the key identified by SHADOW_INFO and return the plaintext in an - allocated buffer in R_BUF. */ + allocated buffer in R_BUF. The padding information is stored at + R_PADDING with -1 for not known. */ int divert_pkdecrypt (ctrl_t ctrl, const unsigned char *cipher, const unsigned char *shadow_info, - char **r_buf, size_t *r_len) + char **r_buf, size_t *r_len, int *r_padding) { int rc; char *kid; @@ -399,6 +400,8 @@ divert_pkdecrypt (ctrl_t ctrl, char *plaintext; size_t plaintextlen; + *r_padding = -1; + s = cipher; if (*s != '(') return gpg_error (GPG_ERR_INV_SEXP); @@ -436,7 +439,7 @@ divert_pkdecrypt (ctrl_t ctrl, rc = agent_card_pkdecrypt (ctrl, kid, getpin_cb, ctrl, ciphertext, ciphertextlen, - &plaintext, &plaintextlen); + &plaintext, &plaintextlen, r_padding); if (!rc) { *r_buf = plaintext; |