acme_client_jose.h
Go to the documentation of this file.
1 /**
2  * @file acme_client_jose.h
3  * @brief JOSE (JSON Object Signing and Encryption)
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2019-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneACME Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.4
29  **/
30 
31 #ifndef _ACME_CLIENT_JOSE_H
32 #define _ACME_CLIENT_JOSE_H
33 
34 //Dependencies
35 #include "acme/acme_client.h"
36 
37 //C++ guard
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 //JOSE related functions
43 error_t jwkExportRsaPublicKey(const RsaPublicKey *publicKey, char_t *buffer,
44  size_t *written, bool_t sort);
45 
47  const EcPublicKey *publicKey, char_t *buffer, size_t *written, bool_t sort);
48 
50  const EddsaPublicKey *publicKey, char_t *buffer, size_t *written,
51  bool_t sort);
52 
53 error_t jwsCreate(const PrngAlgo *prngAlgo, void *prngContext,
54  const char_t *protected, const char_t *payload, const char_t *alg,
55  const char_t *crv, const void *privateKey, char_t *buffer, size_t *written);
56 
57 error_t jwsGenerateSignature(const PrngAlgo *prngAlgo, void *prngContext,
58  const char_t *alg, const char_t *crv, const void *privateKey,
59  const char_t *input, size_t inputLen, uint8_t *output, size_t *outputLen);
60 
61 //C++ guard
62 #ifdef __cplusplus
63 }
64 #endif
65 
66 #endif
error_t jwsGenerateSignature(const PrngAlgo *prngAlgo, void *prngContext, const char_t *alg, const char_t *crv, const void *privateKey, const char_t *input, size_t inputLen, uint8_t *output, size_t *outputLen)
Compute JWS signature using the specified algorithm.
int bool_t
Definition: compiler_port.h:53
error_t jwkExportRsaPublicKey(const RsaPublicKey *publicKey, char_t *buffer, size_t *written, bool_t sort)
Export an RSA public key to JWK format.
#define PrngAlgo
Definition: crypto.h:938
EC domain parameters.
Definition: ec.h:76
error_t
Error codes.
Definition: error.h:43
EdDSA public key.
Definition: eddsa.h:49
RSA public key.
Definition: rsa.h:57
EC public key.
Definition: ec.h:94
char char_t
Definition: compiler_port.h:48
uint8_t payload[]
Definition: ipv6.h:286
error_t jwkExportEddsaPublicKey(const char_t *crv, const EddsaPublicKey *publicKey, char_t *buffer, size_t *written, bool_t sort)
Export an EdDSA public key to JWK format.
error_t jwsCreate(const PrngAlgo *prngAlgo, void *prngContext, const char_t *protected, const char_t *payload, const char_t *alg, const char_t *crv, const void *privateKey, char_t *buffer, size_t *written)
Create a JSON Web Signature.
error_t jwkExportEcPublicKey(const EcDomainParameters *params, const EcPublicKey *publicKey, char_t *buffer, size_t *written, bool_t sort)
Export an EC public key to JWK format.
ACME client (Automatic Certificate Management Environment)