One SafeBag of a PKCS#12 file: a private key, a certificate or something else, with its attributes.
PKCS12.decode/3 lists every bag of the file in PKCS12.t/0, in file
order. Most programs only need the :private_key, :certificate and
:ca_certificates fields there; the bags are for files with more than one
key, for the friendly names and for attributes the library does not
interpret.
Fields:
:type-:private_key,:certificateor:other.:value- for:private_key, the PrivateKeyInfo (PKCS#8) in DER, already decrypted; for:certificate, the X.509 certificate in DER; for:other, the DER of the bag value as it is in the file.:oid- the bag type (bagId), in dotted form.:friendly_name- thefriendlyNameattribute, ornil.:local_key_id- thelocalKeyIdattribute, ornil. A key and its certificate usually share it.:attributes- the other attributes, as{oid, values}with each value in DER, in file order.
inspect/1 leaves :value out, so that a private key does not end up in
a log by accident.