diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-05 23:53:57 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-05 23:53:57 +0000 |
commit | 7994b046610509c8fc3ad8350c77ee0b864f6349 (patch) | |
tree | b77e86bacb50c1ea775a40d34ceefff8c7fa3b48 /src/libcryptobox/keypair.h | |
parent | c13d594abf0c2c1f75b7b55573a047b757e2c2ec (diff) | |
download | rspamd-7994b046610509c8fc3ad8350c77ee0b864f6349.tar.gz rspamd-7994b046610509c8fc3ad8350c77ee0b864f6349.zip |
Add more utilities to operate with keypairs
Diffstat (limited to 'src/libcryptobox/keypair.h')
-rw-r--r-- | src/libcryptobox/keypair.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/libcryptobox/keypair.h b/src/libcryptobox/keypair.h index bd82b64ae..613c1296d 100644 --- a/src/libcryptobox/keypair.h +++ b/src/libcryptobox/keypair.h @@ -148,6 +148,14 @@ const guchar * rspamd_keypair_get_id (struct rspamd_cryptobox_keypair *kp); */ const guchar * rspamd_pubkey_get_id (struct rspamd_cryptobox_pubkey *pk); +/** + * Get raw public key from pubkey opaque structure + * @param pk + * @param len + * @return + */ +const guchar * rspamd_pubkey_get_pk (struct rspamd_cryptobox_pubkey *pk, + guint *len); /** Print pubkey */ #define RSPAMD_KEYPAIR_PUBKEY 0x1 @@ -171,4 +179,20 @@ const guchar * rspamd_pubkey_get_id (struct rspamd_cryptobox_pubkey *pk); GString *rspamd_keypair_print (struct rspamd_cryptobox_keypair *kp, guint how); +/** Get keypair pubkey ID */ +#define RSPAMD_KEYPAIR_COMPONENT_ID 0 +/** Get keypair public key */ +#define RSPAMD_KEYPAIR_COMPONENT_PK 1 +/** Get keypair private key */ +#define RSPAMD_KEYPAIR_COMPONENT_SK 2 +/** + * Get specific component of a keypair + * @param kp keypair + * @param ncomp component number + * @param len length of input + * @return raw content of the component + */ +const guchar * rspamd_keypair_component (struct rspamd_cryptobox_keypair *kp, + guint ncomp, guint *len); + #endif /* SRC_LIBCRYPTOBOX_KEYPAIR_H_ */ |