summaryrefslogtreecommitdiffstats
path: root/g10/card-util.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2009-07-09 16:54:18 +0200
committerWerner Koch <wk@gnupg.org>2009-07-09 16:54:18 +0200
commit31084d6dc9287f6ab113ae0096d971c3e28c4eff (patch)
treeda5896e251fb6cd55a8decc45ee7376ba77750be /g10/card-util.c
parentMarked an entry fuzzy. (diff)
downloadgnupg2-31084d6dc9287f6ab113ae0096d971c3e28c4eff.tar.xz
gnupg2-31084d6dc9287f6ab113ae0096d971c3e28c4eff.zip
Support writing of existing keys with non-matching key sizes.
Diffstat (limited to 'g10/card-util.c')
-rw-r--r--g10/card-util.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/g10/card-util.c b/g10/card-util.c
index 26349d653..f825034b6 100644
--- a/g10/card-util.c
+++ b/g10/card-util.c
@@ -1,5 +1,5 @@
/* card-util.c - Utility functions for the OpenPGP card.
- * Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+ * Copyright (C) 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -1393,7 +1393,8 @@ card_store_subkey (KBNODE node, int use)
show_card_key_info (&info);
- if (!is_RSA (sk->pubkey_algo) || nbits_from_sk (sk) != 1024 )
+ if (!is_RSA (sk->pubkey_algo)
+ || (!info.is_v2 && nbits_from_sk (sk) != 1024) )
{
tty_printf ("You may only store a 1024 bit RSA key on the card\n");
tty_printf ("\n");
@@ -1461,7 +1462,10 @@ card_store_subkey (KBNODE node, int use)
rc = save_unprotected_key_to_card (sk, keyno);
if (rc)
- goto leave;
+ {
+ log_error (_("error writing key to card: %s\n"), gpg_strerror (rc));
+ goto leave;
+ }
/* Get back to the maybe protected original secret key. */
if (copied_sk)