g10: Fix exporting secret keys of certain sizes.
* g10/build-packet.c (do_key): Do not use the header length specified by the public key packet from the keyring, but let 'write_header2' compute the required length.
Specifically exporting RSA keys of length 1024 failed, as the encoded
public key packet requires 141 bytes a length that fits into one byte,
but the secret key is significantly larger, making the export fail.
- GnuPG-bug-id: T2307
- Signed-off-by: Justus Winter <justus@g10code.com>