wickr-crypto-c

ephemeral_keypair.h
1 /*
2 * Copyright © 2012-2020 Wickr Inc. All rights reserved.
3 *
4 * This code is being released for EDUCATIONAL, ACADEMIC, AND CODE REVIEW PURPOSES
5 * ONLY. COMMERCIAL USE OF THE CODE IS EXPRESSLY PROHIBITED. For additional details,
6 * please see LICENSE
7 *
8 * THE CODE IS MADE AVAILABLE "AS-IS" AND WITHOUT ANY EXPRESS OR
9 * IMPLIED GUARANTEES AS TO FITNESS, MERCHANTABILITY, NON-
10 * INFRINGEMENT OR OTHERWISE. IT IS NOT BEING PROVIDED IN TRADE BUT ON
11 * A VOLUNTARY BASIS ON BEHALF OF THE AUTHOR’S PART FOR THE BENEFIT
12 * OF THE LICENSEE AND IS NOT MADE AVAILABLE FOR CONSUMER USE OR ANY
13 * OTHER USE OUTSIDE THE TERMS OF THIS LICENSE. ANYONE ACCESSING THE
14 * CODE SHOULD HAVE THE REQUISITE EXPERTISE TO SECURE THEIR SYSTEM
15 * AND DEVICES AND TO ACCESS AND USE THE CODE FOR REVIEW PURPOSES
16 * ONLY. LICENSEE BEARS THE RISK OF ACCESSING AND USING THE CODE. IN
17 * PARTICULAR, AUTHOR BEARS NO LIABILITY FOR ANY INTERFERENCE WITH OR
18 * ADVERSE EFFECT THAT MAY OCCUR AS A RESULT OF THE LICENSEE
19 * ACCESSING AND/OR USING THE CODE ON LICENSEE’S SYSTEM.
20 */
21
22 #ifndef ephemeral_keypair_h
23 #define ephemeral_keypair_h
24
25 #include <stdlib.h>
26 #include "ecdsa.h"
27 #include "eckey.h"
28 #include "crypto_engine.h"
29 #include "identity.h"
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
62 struct wickr_ephemeral_keypair {
63 uint64_t identifier;
64 wickr_ec_key_t *ec_key;
65 wickr_ecdsa_result_t *signature;
66 };
67
68 typedef struct wickr_ephemeral_keypair wickr_ephemeral_keypair_t;
69
81 wickr_ephemeral_keypair_t *wickr_ephemeral_keypair_create(uint64_t identifier, wickr_ec_key_t *ec_key, wickr_ecdsa_result_t *signature);
82
92 wickr_ephemeral_keypair_t *wickr_ephemeral_keypair_copy(const wickr_ephemeral_keypair_t *source);
93
107 wickr_ephemeral_keypair_t *wickr_ephemeral_keypair_generate_identity(const wickr_crypto_engine_t *engine, uint64_t identifier, const wickr_identity_t *identity);
108
120 bool wickr_ephemeral_keypair_verify_owner(const wickr_ephemeral_keypair_t *keypair, const wickr_crypto_engine_t *engine, const wickr_identity_t *owner);
121
122
130 void wickr_ephemeral_keypair_make_public(const wickr_ephemeral_keypair_t *keypair);
131
141 wickr_buffer_t *wickr_ephemeral_keypair_serialize(const wickr_ephemeral_keypair_t *keypair);
142
153 wickr_ephemeral_keypair_t *wickr_ephemeral_keypair_create_from_buffer(const wickr_buffer_t *buffer, const wickr_crypto_engine_t *engine);
154
163 void wickr_ephemeral_keypair_destroy(wickr_ephemeral_keypair_t **keypair);
164
165 #ifdef __cplusplus
166 }
167 #endif
168
169 #endif /* ephemeral_keypair_h */
wickr_ephemeral_keypair_serialize
wickr_buffer_t * wickr_ephemeral_keypair_serialize(const wickr_ephemeral_keypair_t *keypair)
wickr_ephemeral_keypair_make_public
void wickr_ephemeral_keypair_make_public(const wickr_ephemeral_keypair_t *keypair)
wickr_ephemeral_keypair_generate_identity
wickr_ephemeral_keypair_t * wickr_ephemeral_keypair_generate_identity(const wickr_crypto_engine_t *engine, uint64_t identifier, const wickr_identity_t *identity)
wickr_ephemeral_keypair_create_from_buffer
wickr_ephemeral_keypair_t * wickr_ephemeral_keypair_create_from_buffer(const wickr_buffer_t *buffer, const wickr_crypto_engine_t *engine)
wickr_ephemeral_keypair_destroy
void wickr_ephemeral_keypair_destroy(wickr_ephemeral_keypair_t **keypair)
wickr_ephemeral_keypair_create
wickr_ephemeral_keypair_t * wickr_ephemeral_keypair_create(uint64_t identifier, wickr_ec_key_t *ec_key, wickr_ecdsa_result_t *signature)
wickr_ephemeral_keypair_copy
wickr_ephemeral_keypair_t * wickr_ephemeral_keypair_copy(const wickr_ephemeral_keypair_t *source)
wickr_ephemeral_keypair_verify_owner
bool wickr_ephemeral_keypair_verify_owner(const wickr_ephemeral_keypair_t *keypair, const wickr_crypto_engine_t *engine, const wickr_identity_t *owner)
wickr_buffer
Represents an array of bytes and the length of the allocation associated with those bytes.
Definition: buffer.h:51
wickr_crypto_engine
Interface to a set of cryptographic operations used throughout the library. Currently the default imp...
Definition: crypto_engine.h:53
wickr_ec_key
Representation of public and private Elliptic Curve Keypair information as buffers.
Definition: eckey.h:92
wickr_ecdsa_result
Elliptic Curve Digital Signature Algorithm Result.
Definition: ecdsa.h:54
wickr_ephemeral_keypair
Represents a key pair used for message key exchanges within the Wickr Messaging Protocol.
Definition: ephemeral_keypair.h:62
wickr_ephemeral_keypair::identifier
uint64_t identifier
Definition: ephemeral_keypair.h:63
wickr_ephemeral_keypair::ec_key
wickr_ec_key_t * ec_key
Definition: ephemeral_keypair.h:64
wickr_ephemeral_keypair::signature
wickr_ecdsa_result_t * signature
Definition: ephemeral_keypair.h:65
wickr_identity
A signing identity on the Wickr system.
Definition: identity.h:90