sxt: added key export API description, some misc functions added as well;

master
Alexander Vdolainen 8 years ago
parent 057433f1ba
commit 116aa2b6bf

@ -81,8 +81,39 @@ void sxt_key_free(sxtkey_t *);
*/ */
int sxt_key_generate(sxtkey_t *, int , int ); int sxt_key_generate(sxtkey_t *, int , int );
/* generic functions useful to deal with keys */
/* get 8bit ID from key name */
uint8_t sxt_key_type_fname(const char *);
/* return 0 if key isn't public, 1 otherwise */
int sxt_key_public(const sxtkey_t *);
/* return 0 if key isn't private, 1 otherwise */
int sxt_key_private(const sxtkey_t *);
/* export key API */
/** this function will pack the private key to sxt key container and
* write it to the file.
* @key - private key
* @file - file name to write
* NOTE: the following parameters required in case if you want to encrypt the key
* with passkey (password)
* @passkey - plaintext passkey
* or
* @ask_passkey with:
* @@pkbuf - passkey buffer (allocated)
* @@length - length of pkbuf
* @@confirm - if not nil - function should force passkey confirmation
* @@priv - some custom pointer to the some custom data
* @priv - the data coming to ask_passkey function
*/
int sxt_key_export_priv_file(const sxtkey_t *key, const char *file, const char *passkey,
int (*ask_passkey)(char *pkbuf, size_t length, int confirm, void *priv),
void *priv);
/* key custom hash ops */ /* key custom hash ops */
/* assign a 64bit hash, 0 mean there are no hash */
int sxt_key_assign_hash(sxtkey_t *, uint64_t); int sxt_key_assign_hash(sxtkey_t *, uint64_t);
/* get a 64bit hash from a key */
uint64_t sxt_key_hash(const sxtkey_t *); uint64_t sxt_key_hash(const sxtkey_t *);
#endif /* __SXT_SXTKEY_H__ */ #endif /* __SXT_SXTKEY_H__ */

Loading…
Cancel
Save