PKCS Interface

DESCRIPTION

SILC PKCS API provides generic interface for performing various public key cryptography related operations with different types of public and private keys. Support for loading and saving of different types of public key and private keys are also provided.

This interface is used to perform operations with public keys and private keys but the interface cannot be used to generate new key pairs. Instead, PKCS implementations provide functions to generate key pairs. Call silc_pkcs_silc_generate_key to generate SILC protocol key pair. Call silc_ssh_generate_key to generate SSH2 protocol key pair. Call silc_pgp_generate_key to generate OpenPGP key pair.

EXAMPLE

 // Load public and private keys
 SilcPublicKey public_key;
 SilcPrivateKey private_key;

 silc_pkcs_load_public_key("pubkey.pub", SILC_PKCS_ANY, &public_key);
 silc_pkcs_load_private_key("privkey, prv", passphrase, passphrase_len,
                            SILC_PKCS_ANY, &public_key);

 // Compute signature
 unsigned char dst[2048];
 SilcUInt32 sig_len;

 silc_pkcs_sign(private_key, src, src_len, dst, sizeof(dst), &sig_len,
               TRUE, NULL, rng);

 // Free keys
 silc_pkcs_public_key_free(public_key);
 silc_pkcs_private_key_free(private_key);

TABLE OF CONTENTS