aboutsummaryrefslogtreecommitdiffstats
path: root/g10/build-packet.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2003-09-30 08:00:08 +0000
committerWerner Koch <[email protected]>2003-09-30 08:00:08 +0000
commit8062cb418a4757c603447fb5fad2d06bf54cadb3 (patch)
treec4290b18aed7add7b1355acd16b5d0876edc8ac3 /g10/build-packet.c
parent2003-09-28 Timo Schulz <[email protected]> (diff)
downloadgnupg-8062cb418a4757c603447fb5fad2d06bf54cadb3.tar.gz
gnupg-8062cb418a4757c603447fb5fad2d06bf54cadb3.zip
* keygen.c (do_add_key_flags, parse_parameter_usage): Add support
the proposed AUTH key flag. * getkey.c (fixup_uidnode, merge_selfsigs_main) (merge_selfsigs_subkey, premerge_public_with_secret): Ditto. * keylist.c (print_capabilities): Ditto. * parse-packet.c (parse_key): Allow to parse the divert-to-card S2K mode. * build-packet.c (do_secret_key): Handle divert-to-card S2K * seckey-cert.c (is_secret_key_protected): Ditto. (check_secret_key): Ditto. * keygen.c (do_ask_passphrase): Renamed from ask_passphrase. * passphrase.c (ask_passphrase): New.
Diffstat (limited to '')
-rw-r--r--g10/build-packet.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/g10/build-packet.c b/g10/build-packet.c
index af97be423..cd0bb8a81 100644
--- a/g10/build-packet.c
+++ b/g10/build-packet.c
@@ -410,8 +410,9 @@ do_secret_key( IOBUF out, int ctb, PKT_secret_key *sk )
if( sk->protect.s2k.mode == 3 )
iobuf_put(a, sk->protect.s2k.count );
- /* For out special mode 1001 we do not need an IV */
- if( sk->protect.s2k.mode != 1001 )
+ /* For out special modes 1001, 1002 we do not need an IV */
+ if( sk->protect.s2k.mode != 1001
+ && sk->protect.s2k.mode != 1002 )
iobuf_write(a, sk->protect.iv, sk->protect.ivlen );
}
}
@@ -420,6 +421,14 @@ do_secret_key( IOBUF out, int ctb, PKT_secret_key *sk )
if( sk->protect.s2k.mode == 1001 )
; /* GnuPG extension - don't write a secret key at all */
+ else if( sk->protect.s2k.mode == 1002 )
+ { /* GnuPG extension - divert to OpenPGP smartcard. */
+ iobuf_put(a, sk->protect.ivlen ); /* length of the serial
+ number or 0 for no serial
+ number. */
+ /* The serial number gets stored in the IV field. */
+ iobuf_write(a, sk->protect.iv, sk->protect.ivlen);
+ }
else if( sk->is_protected && sk->version >= 4 ) {
/* The secret key is protected - write it out as it is */
byte *p;