Add ability to import PKCS12 keys

PKCS12 is a fairly common key wrapping protocol, particularly used by
Microsoft, so add the ability to wrap PKCS12 keys.  The wrap merely
searches the PKCS12 bag for the private key, ignores all the
certificates and produces a TPM wrapped version of the private key it
finds.  We can discriminate easily between PKCS12 and PEM private keys
because the PKCS12 DER is a very specific ASN.1 format, so we don't
need to know what type of keyfile we have, we just try both formats to
see if it will import.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
3 files changed