silc_pgp_private_key_decode

SYNOPSIS

    SilcBool silc_pgp_private_key_decode(SilcList *list,
                                         const char *passphrase,
                                         SilcUInt32 passphrase_len,
                                         SilcPGPPrivateKey *ret_private_key);

DESCRIPTION

Decodes OpenPGP secret key (private key) from decoded PGP packets list indicated by `list'. The decoded private key is returned into the `ret_private_key' which the caller must free by calling the silc_pgp_private_key_free function. Returns FALSE on error.

The `passphrase' can be provided in case the private key is encrypted. Usually all OpenPGP private keys are encrypted so the passphrase should be always provided.

The `list' can be allocated by calling silc_pgp_packet_decode. If the `list' contains more that one private keys this only decodes the first one. The private key `list' is advanced while decoding the public key. If another private key follows the first public key, this function may be called again to decode that private key as well.