1 /*
2    Copyright (c) 2021 Fraunhofer AISEC. See the COPYRIGHT
3    file at the top-level directory of this distribution.
4 
5    Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6    http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7    <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8    option. This file may not be copied, modified, or distributed
9    except according to those terms.
10 */
11 
12 #ifndef OSCORE_COSE_H
13 #define OSCORE_COSE_H
14 
15 #include "common/byte_array.h"
16 #include "common/oscore_edhoc_error.h"
17 
18 /**
19  * @brief Decrypt the ciphertext
20  * @param in_ciphertext: input ciphertext to be decrypted
21  * @param out_plaintext: output plaintext
22  * @param nonce the nonce
23  * @param aad the aad
24  * @param recipient_key the recipient key
25  * @return err
26  */
27 enum err oscore_cose_decrypt(struct byte_array *in_ciphertext,
28 			     struct byte_array *out_plaintext,
29 			     struct byte_array *nonce, struct byte_array *aad,
30 			     struct byte_array *recipient_key);
31 
32 /**
33  * @brief Encrypt the plaintext
34  * @param in_plaintext: input plaintext to be encrypted
35  * @param out_ciphertext: output ciphertext with authentication tag (8 bytes)
36  * @param nonce the nonce
37  * @param sender_aad the aad
38  * @param key the sender key
39  * @return err
40  */
41 enum err oscore_cose_encrypt(struct byte_array *in_plaintext,
42 			     struct byte_array *out_ciphertext,
43 			     struct byte_array *nonce,
44 			     struct byte_array *sender_aad,
45 			     struct byte_array *key);
46 #endif
47