wickr-crypto-c

payload.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 payload_h
23 #define payload_h
24
25 #include "buffer.h"
26 #include "crypto_engine.h"
27 #include "packet_meta.h"
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
46 struct wickr_payload {
47 wickr_packet_meta_t *meta;
48 wickr_buffer_t *body;
49 };
50
51 typedef struct wickr_payload wickr_payload_t;
52
62 wickr_payload_t *wickr_payload_create(wickr_packet_meta_t *meta, wickr_buffer_t *body);
63
73 wickr_payload_t *wickr_payload_copy(const wickr_payload_t *source);
74
83 void wickr_payload_destroy(wickr_payload_t **payload);
84
94 wickr_buffer_t *wickr_payload_serialize(const wickr_payload_t *payload);
95
105 wickr_payload_t *wickr_payload_create_from_buffer(const wickr_buffer_t *buffer);
106
120 wickr_cipher_result_t *wickr_payload_encrypt(const wickr_payload_t *payload,
121 const wickr_crypto_engine_t *engine,
122 const wickr_cipher_key_t *payload_key);
123
134 wickr_payload_t *wickr_payload_create_from_cipher(const wickr_crypto_engine_t *engine,
135 const wickr_cipher_result_t *cipher_result,
136 const wickr_cipher_key_t *payload_key);
137
138 #ifdef __cplusplus
139 }
140 #endif
141
142 #endif /* payload_h */
wickr_payload_serialize
wickr_buffer_t * wickr_payload_serialize(const wickr_payload_t *payload)
wickr_payload_create_from_buffer
wickr_payload_t * wickr_payload_create_from_buffer(const wickr_buffer_t *buffer)
wickr_payload_encrypt
wickr_cipher_result_t * wickr_payload_encrypt(const wickr_payload_t *payload, const wickr_crypto_engine_t *engine, const wickr_cipher_key_t *payload_key)
wickr_payload_destroy
void wickr_payload_destroy(wickr_payload_t **payload)
wickr_payload_copy
wickr_payload_t * wickr_payload_copy(const wickr_payload_t *source)
wickr_payload_create
wickr_payload_t * wickr_payload_create(wickr_packet_meta_t *meta, wickr_buffer_t *body)
wickr_payload_create_from_cipher
wickr_payload_t * wickr_payload_create_from_cipher(const wickr_crypto_engine_t *engine, const wickr_cipher_result_t *cipher_result, const wickr_cipher_key_t *payload_key)
wickr_buffer
Represents an array of bytes and the length of the allocation associated with those bytes.
Definition: buffer.h:51
wickr_cipher_key
Definition: cipher.h:189
wickr_cipher_result
Definition: cipher.h:97
wickr_crypto_engine
Interface to a set of cryptographic operations used throughout the library. Currently the default imp...
Definition: crypto_engine.h:53
wickr_packet_meta
control metadata found in the encrypted payload of a packet
Definition: packet_meta.h:62
wickr_payload
The encrypted body content of a Wickr packet.
Definition: payload.h:46
wickr_payload::body
wickr_buffer_t * body
Definition: payload.h:48
wickr_payload::meta
wickr_packet_meta_t * meta
Definition: payload.h:47