silc_pkcs1_encode

SYNOPSIS

    SilcBool silc_pkcs1_encode(SilcPkcs1BlockType bt,
                               const unsigned char *data,
                               SilcUInt32 data_len,
                               unsigned char *dest_data,
                               SilcUInt32 dest_data_size,
                               SilcRng rng);

DESCRIPTION

Encodes PKCS#1 data block from the `data' according to the block type indicated by `bt'. When encoding signatures the `bt' must be SILC_PKCS1_BT_PRV1 and when encoding encryption blocks the `bt' must be SILC_PKCS1_BT_PUB. The encoded data is copied into the `dest_data' buffer which is size of `dest_data_size'. If the `dest_data' is not able to hold the encoded block this returns FALSE. Usually the `dest_data_size' is set to the RSA key length value as it is the length of one block. The `rng' should be set when `bt' is set to SILC_PKCS1_BT_PUB. If `rng' is NULL global RNG is used. This function returns TRUE on success.