silc_pgp_s2k

SYNOPSIS

    unsigned char *silc_pgp_s2k(SilcPGPS2KType type,
                                SilcPGPHash hash,
                                const char *passphrase,
                                SilcUInt32 passphrase_len,
                                SilcUInt32 key_len,
                                unsigned char *salt,
                                SilcUInt32 iter_octet_count,
                                SilcRng rng);

DESCRIPTION

Computes the OpenPGP string-to-key (S2K). Converts passphrases to encryption and decryption keys. The `passphrase' must be non-NULL.

The `type' specifies the S2K specifier type. The `hash' is the hash algorithm used if the `type' is SILC_PGP_S2K_SALTED or SILC_PGP_S2K_ITERATED_SALTED. If the `type' is SILC_PGP_S2K_ITERATED_SALTED the `iter_octet_count' is the number of bytes to iteratively hash (max value is 65536).

The `key_len' is the length of the key to produce in bytes. If `salt' is NULL this will generate an encryption key. If it is non-NULL this will use the salt to compute the decryption key.