silc_pgp_packet_decode
SYNOPSIS
SilcBool silc_pgp_packet_decode(const unsigned char *data, SilcUInt32 data_len, SilcBool *success, SilcList *ret_list);
DESCRIPTION
Decodes PGP packets from the data buffer indicated by `data' of length of `data_len' bytes. The data buffer may include one or more packets that are decoded and returned to the `ret_list'. The caller must free the returned packets with silc_pgp_packet_free_list. Each entry in the `ret_list' is SilcPGPPacket.
Returns the number of packets decoded or 0 on error. If the `success' is FALSE but this returns > 0 then not all packets were decoded successfully and the `ret_list' includes the packets that were decoded. When the `success' is TRUE all packets were decoded successfully.
EXAMPLE
SilcList list; SilcBool success; unsigned char *data; SilcUInt32 data_len; SilcPGPPublicKey public_key; // Open public key file (binary format) and parse all PGP packets data = silc_file_readfile("pubkey.bin", &data_len, NULL); silc_pgp_packet_decode(data, data_len, &success, &list); // Parse public key silc_pgp_public_key_decode(&list, &public_key);