* SOURCE
*/
typedef struct {
+ SilcUInt16 pk_type; /* Public key type (SilcSKEPKType) */
SilcUInt32 len;
char *name;
char *identifier;
*
* DESCRIPTION
*
- * Returns SILC style public key.
+ * Returns SILC style public key. The caller must free the returned
+ * data.
*
***/
unsigned char *silc_pkcs_get_public_key(SilcPKCS pkcs, SilcUInt32 *len);
*
* DESCRIPTION
*
- * Returns SILC style private key.
+ * Returns SILC style private key. The caller must free the returned
+ * data and SHOULD zero the memory area before freeing.
*
***/
unsigned char *silc_pkcs_get_private_key(SilcPKCS pkcs, SilcUInt32 *len);
*
* SYNOPSIS
*
- * bool silc_pkcs_public_key_decode(unsigned char *data, SilcUInt32 data_len,
- * SilcPublicKey *public_key);
+ * bool silc_pkcs_public_key_decode(unsigned char *data,
+ * SilcUInt32 data_len,
+ * SilcPublicKey *public_key);
*
* DESCRIPTION
*
bool silc_pkcs_public_key_decode(unsigned char *data, SilcUInt32 data_len,
SilcPublicKey *public_key);
+/****f* silccrypt/SilcPKCSAPI/silc_pkcs_public_key_decode
+ *
+ * SYNOPSIS
+ *
+ * bool silc_pkcs_public_key_payload_encode(SilcPublicKey public_key);
+ *
+ * DESCRIPTION
+ *
+ * Encodes the Public Key Payload from the public key indicated by
+ * `public_key' of type of `pk_type'. The type is SilcSKEPKType.
+ * Returns the encoded payload buffer.
+ *
+ ***/
+SilcBuffer silc_pkcs_public_key_payload_encode(SilcPublicKey public_key);
+
+/****f* silccrypt/SilcPKCSAPI/silc_pkcs_public_key_decode
+ *
+ * SYNOPSIS
+ *
+ * bool
+ * silc_pkcs_public_key_payload_decode(unsigned char *data,
+ * SilcUInt32 data_len,
+ * SilcPublicKey *public_key);
+ *
+ * DESCRIPTION
+ *
+ * Decodes Public Key Payload from `data' of `data_len' bytes in length
+ * data buffer into `public_key' pointer. Returns FALSE if the payload
+ * cannot be decoded.
+ *
+ ***/
+bool silc_pkcs_public_key_payload_decode(unsigned char *data,
+ SilcUInt32 data_len,
+ SilcPublicKey *public_key);
+
/****f* silccrypt/SilcPKCSAPI/silc_pkcs_public_key_compare
*
* SYNOPSIS
*
* DESCRIPTION
*
- * Saves public key into file. Returns FALSE on error.
+ * Saves public key into file. The public key is already encoded as
+ * data when calling this function. Returns FALSE on error.
*
***/
bool silc_pkcs_save_public_key_data(char *filename, unsigned char *data,
* SYNOPSIS
*
* bool silc_pkcs_save_private_key(char *filename,
- * SilcPrivateKey private_key,
- * unsigned char *passphrase,
- * SilcUInt32 encoding);
+ * SilcPrivateKey private_key,
+ * unsigned char *passphrase,
+ * SilcUInt32 passphrase_len,
+ * SilcUInt32 encoding);
*
* DESCRIPTION
*
- * Saves private key into file. Returns FALSE on error.
+ * Saves private key into file. The private key is encrypted into
+ * the file with the `passphrase' as a key. The encryption algorithm
+ * is AES with 256 bit key in CBC mode. Returns FALSE on error.
*
***/
bool silc_pkcs_save_private_key(char *filename, SilcPrivateKey private_key,
unsigned char *passphrase,
+ SilcUInt32 passphrase_len,
SilcUInt32 encoding);
-/****f* silccrypt/SilcPKCSAPI/silc_pkcs_save_private_key_data
- *
- * SYNOPSIS
- *
- * bool silc_pkcs_save_private_key_data(char *filename, unsigned char *data,
- * SilcUInt32 data_len,
- * unsigned char *passphrase,
- * SilcUInt32 encoding);
- *
- * DESCRIPTION
- *
- * Saves private key into file. Returns FALSE on error.
- *
- ***/
-bool silc_pkcs_save_private_key_data(char *filename, unsigned char *data,
- SilcUInt32 data_len,
- unsigned char *passphrase,
- SilcUInt32 encoding);
-
/****f* silccrypt/SilcPKCSAPI/silc_pkcs_load_public_key
*
* SYNOPSIS
* SYNOPSIS
*
* bool silc_pkcs_load_private_key(char *filename,
- * SilcPrivateKey *private_key,
- * SilcUInt32 encoding);
+ * SilcPrivateKey *private_key,
+ * unsigned char *passphrase,
+ * SilcUInt32 passphrase_len,
+ * SilcUInt32 encoding);
*
* DESCRIPTION
*
* Load private key from file and allocates new private key. Returns TRUE
- * if loading was successful.
+ * if loading was successful. The `passphrase' is used as decryption
+ * key of the private key file.
*
***/
bool silc_pkcs_load_private_key(char *filename, SilcPrivateKey *private_key,
+ unsigned char *passphrase,
+ SilcUInt32 passphrase_len,
SilcUInt32 encoding);
#endif /* SILCPKCS_H */