diff options
author | George Hazan <george.hazan@gmail.com> | 2016-01-26 08:28:32 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-01-26 08:28:32 +0000 |
commit | 2a82a9154f9d6e0b5658c82cd346051017339a1e (patch) | |
tree | 8321c2d1897d4026e68064241014eef4a57ddc9d /libs/libaxolotl/src/session_pre_key.h | |
parent | 80148955f82c205cc94f0112e0fbfe8f91bc4330 (diff) |
libaxolotl - initial commit
git-svn-id: http://svn.miranda-ng.org/main/trunk@16169 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'libs/libaxolotl/src/session_pre_key.h')
-rw-r--r-- | libs/libaxolotl/src/session_pre_key.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/libs/libaxolotl/src/session_pre_key.h b/libs/libaxolotl/src/session_pre_key.h new file mode 100644 index 0000000000..4b5f1b179a --- /dev/null +++ b/libs/libaxolotl/src/session_pre_key.h @@ -0,0 +1,65 @@ +#ifndef SESSION_PRE_KEY_H +#define SESSION_PRE_KEY_H + +#include <stdint.h> +#include <stddef.h> +#include "axolotl_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define PRE_KEY_MEDIUM_MAX_VALUE 0xFFFFFF + +/*------------------------------------------------------------------------*/ + +int session_pre_key_create(session_pre_key **pre_key, uint32_t id, ec_key_pair *key_pair); +int session_pre_key_serialize(axolotl_buffer **buffer, const session_pre_key *pre_key); +int session_pre_key_deserialize(session_pre_key **pre_key, const uint8_t *data, size_t len, axolotl_context *global_context); + +uint32_t session_pre_key_get_id(const session_pre_key *pre_key); +ec_key_pair *session_pre_key_get_key_pair(const session_pre_key *pre_key); + +void session_pre_key_destroy(axolotl_type_base *type); + +/*------------------------------------------------------------------------*/ + +int session_signed_pre_key_create(session_signed_pre_key **pre_key, + uint32_t id, uint64_t timestamp, ec_key_pair *key_pair, + const uint8_t *signature, size_t signature_len); +int session_signed_pre_key_serialize(axolotl_buffer **buffer, const session_signed_pre_key *pre_key); +int session_signed_pre_key_deserialize(session_signed_pre_key **pre_key, const uint8_t *data, size_t len, axolotl_context *global_context); + +uint32_t session_signed_pre_key_get_id(const session_signed_pre_key *pre_key); +uint64_t session_signed_pre_key_get_timestamp(const session_signed_pre_key *pre_key); +ec_key_pair *session_signed_pre_key_get_key_pair(const session_signed_pre_key *pre_key); +const uint8_t *session_signed_pre_key_get_signature(const session_signed_pre_key *pre_key); +size_t session_signed_pre_key_get_signature_len(const session_signed_pre_key *pre_key); + +void session_signed_pre_key_destroy(axolotl_type_base *type); + +/*------------------------------------------------------------------------*/ + +int session_pre_key_bundle_create(session_pre_key_bundle **bundle, + uint32_t registration_id, int device_id, uint32_t pre_key_id, + ec_public_key *pre_key_public, + uint32_t signed_pre_key_id, ec_public_key *signed_pre_key_public, + const uint8_t *signed_pre_key_signature_data, size_t signed_pre_key_signature_len, + ec_public_key *identity_key); + +uint32_t session_pre_key_bundle_get_registration_id(const session_pre_key_bundle *bundle); +int session_pre_key_bundle_get_device_id(const session_pre_key_bundle *bundle); +uint32_t session_pre_key_bundle_get_pre_key_id(const session_pre_key_bundle *bundle); +ec_public_key *session_pre_key_bundle_get_pre_key(const session_pre_key_bundle *bundle); +uint32_t session_pre_key_bundle_get_signed_pre_key_id(const session_pre_key_bundle *bundle); +ec_public_key *session_pre_key_bundle_get_signed_pre_key(const session_pre_key_bundle *bundle); +axolotl_buffer *session_pre_key_bundle_get_signed_pre_key_signature(const session_pre_key_bundle *bundle); +ec_public_key *session_pre_key_bundle_get_identity_key(const session_pre_key_bundle *bundle); + +void session_pre_key_bundle_destroy(axolotl_type_base *type); + +#ifdef __cplusplus +} +#endif + +#endif /* SESSION_PRE_KEY_H */ |