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 #ifndef PLAINTEXT_H
12 #define PLAINTEXT_H
13 
14 #include <stdint.h>
15 
16 #include "common/oscore_edhoc_error.h"
17 
18 /**
19  * @brief                       Decodes id_cred to kid.
20  *
21  * @param[in] id_cred           ID_CRED_x
22  * @param[out] kid              The result.
23  * @retval                      Ok or error code.
24  */
25 enum err id_cred2kid(const struct byte_array *id_cred, struct byte_array *kid);
26 
27 /**
28  * @brief                       Splits the plaintext of message 2.
29  *
30  * @param[in] ptxt              Pointer to the plaintext.
31  * @param[out] c_r              Connection identifier of the responder.
32  *                              This MUST be NULL when used plaintext 3
33  * @param[out] id_cred_x        ID_CRED_x.
34  * @param[out] sign_or_mac      Signature or mac.
35  * @param[out] ead              External Authorization Data.
36  * @retval                      Ok or error code.
37  */
38 enum err plaintext_split(struct byte_array *ptxt, struct byte_array *c_r,
39 			 struct byte_array *id_cred_x,
40 			 struct byte_array *sign_or_mac, struct byte_array *ad);
41 
42 #endif
43