wickr-crypto-c

fingerprint.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 fingerprint_h
23 #define fingerprint_h
24
25 #include "buffer.h"
26 #include "eckey.h"
27 #include "crypto_engine.h"
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
47 typedef enum {
48 FINGERPRINT_OUTPUT_SHORT,
49 FINGERPRINT_OUTPUT_LONG
50 } wickr_fingerprint_output;
51
61 typedef enum { WICKR_FINGERPRINT_TYPE_SHA512 } wickr_fingerprint_type;
62
75 struct wickr_fingerprint {
76 wickr_fingerprint_type type;
77 wickr_buffer_t *data;
78 };
79
80 typedef struct wickr_fingerprint wickr_fingerprint_t;
81
94 wickr_fingerprint_t *wickr_fingerprint_gen(wickr_crypto_engine_t engine,
95 const wickr_ec_key_t *key,
96 const wickr_buffer_t *identifier,
97 wickr_fingerprint_type type);
98
113 wickr_fingerprint_t *wickr_fingerprint_gen_bilateral(wickr_crypto_engine_t engine,
114 const wickr_fingerprint_t *local,
115 const wickr_fingerprint_t *remote,
116 wickr_fingerprint_type type);
117
128 wickr_fingerprint_t *wickr_fingerprint_create(wickr_fingerprint_type type, wickr_buffer_t *data);
129
130
140 wickr_fingerprint_t *wickr_fingerprint_copy(const wickr_fingerprint_t *fingerprint);
141
142
151 void wickr_fingerprint_destroy(wickr_fingerprint_t **fingerprint);
152
163 wickr_buffer_t *wickr_fingerprint_get_b32(const wickr_fingerprint_t *fingerprint, wickr_fingerprint_output output_mode);
164
165
176 wickr_buffer_t *wickr_fingerprint_get_hex(const wickr_fingerprint_t *fingerprint, wickr_fingerprint_output output_mode);
177
178 #ifdef __cplusplus
179 }
180 #endif
181
182 #endif /* fingerprint_h */
wickr_fingerprint_type
wickr_fingerprint_type
Definition: fingerprint.h:61
wickr_fingerprint_get_hex
wickr_buffer_t * wickr_fingerprint_get_hex(const wickr_fingerprint_t *fingerprint, wickr_fingerprint_output output_mode)
wickr_fingerprint_destroy
void wickr_fingerprint_destroy(wickr_fingerprint_t **fingerprint)
wickr_fingerprint_get_b32
wickr_buffer_t * wickr_fingerprint_get_b32(const wickr_fingerprint_t *fingerprint, wickr_fingerprint_output output_mode)
wickr_fingerprint_copy
wickr_fingerprint_t * wickr_fingerprint_copy(const wickr_fingerprint_t *fingerprint)
wickr_fingerprint_gen
wickr_fingerprint_t * wickr_fingerprint_gen(wickr_crypto_engine_t engine, const wickr_ec_key_t *key, const wickr_buffer_t *identifier, wickr_fingerprint_type type)
wickr_fingerprint_create
wickr_fingerprint_t * wickr_fingerprint_create(wickr_fingerprint_type type, wickr_buffer_t *data)
wickr_fingerprint_gen_bilateral
wickr_fingerprint_t * wickr_fingerprint_gen_bilateral(wickr_crypto_engine_t engine, const wickr_fingerprint_t *local, const wickr_fingerprint_t *remote, wickr_fingerprint_type type)
wickr_fingerprint_output
wickr_fingerprint_output
Definition: fingerprint.h:47
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_fingerprint
A fingerprint representation of a combination of signature keys / identifiers.
Definition: fingerprint.h:75
wickr_fingerprint::type
wickr_fingerprint_type type
Definition: fingerprint.h:76
wickr_fingerprint::data
wickr_buffer_t * data
Definition: fingerprint.h:77