Helper functions for ACME client. More...
#include "acme/acme_client.h"
#include "acme/acme_client_jose.h"
#include "acme/acme_client_misc.h"
#include "pkix/pem_import.h"
#include "pkix/x509_csr_create.h"
#include "encoding/base64url.h"
#include "jansson.h"
#include "jansson_private.h"
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | TRACE_LEVEL ACME_TRACE_LEVEL |
Functions | |
error_t | acmeClientLoadKeyPair (AcmeKeyPair *keyPair, const char_t *publicKey, size_t publicKeyLen, const char_t *privateKey, size_t privateKeyLen) |
Load public/private key pair. More... | |
void | acmeClientUnloadKeyPair (AcmeKeyPair *keyPair) |
Unload public/private key pair. More... | |
error_t | acmeClientSendRequest (AcmeClientContext *context) |
Send HTTP request. More... | |
error_t | acmeClientFormatRequestHeader (AcmeClientContext *context, const char_t *method, const char_t *url) |
Format HTTP request header. More... | |
error_t | acmeClientFormatJwsProtectedHeader (const AcmeKeyPair *keyPair, const char_t *kid, const char_t *nonce, const char_t *url, char_t *buffer, size_t *written) |
Format JWS protected header. More... | |
error_t | acmeClientFormatJwk (const AcmeKeyPair *keyPair, char_t *buffer, size_t *written, bool_t sort) |
Export a public key to JWK format. More... | |
error_t | acmeClientGenerateCsr (AcmeClientContext *context, uint8_t *buffer, size_t *written) |
Generate CSR (Certificate Signing Request) More... | |
error_t | acmeClientParseResponseHeader (AcmeClientContext *context) |
Parse HTTP response header. More... | |
error_t | acmeClientParseProblemDetails (AcmeClientContext *context) |
Parse error response. More... | |
const char_t * | acmeClientGetPath (const char_t *url) |
Extract the path name from a given URL. More... | |
Detailed Description
Helper functions for ACME client.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2019-2024 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneACME Open.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version
- 2.4.4
Definition in file acme_client_misc.c.
Macro Definition Documentation
◆ TRACE_LEVEL
#define TRACE_LEVEL ACME_TRACE_LEVEL |
Definition at line 32 of file acme_client_misc.c.
Function Documentation
◆ acmeClientFormatJwk()
error_t acmeClientFormatJwk | ( | const AcmeKeyPair * | keyPair, |
char_t * | buffer, | ||
size_t * | written, | ||
bool_t | sort | ||
) |
Export a public key to JWK format.
- Parameters
-
[in] keyPair Pointer to the key pair [out] buffer Output buffer where to store the JSON representation [out] written Length of the resulting JSON representation [in] sort Sort members of the JWK representation in lexicographic order
- Returns
- Error code
Definition at line 772 of file acme_client_misc.c.
◆ acmeClientFormatJwsProtectedHeader()
error_t acmeClientFormatJwsProtectedHeader | ( | const AcmeKeyPair * | keyPair, |
const char_t * | kid, | ||
const char_t * | nonce, | ||
const char_t * | url, | ||
char_t * | buffer, | ||
size_t * | written | ||
) |
Format JWS protected header.
- Parameters
-
[in] keyPair Pointer to the key pair [in] kid Key identifier (account URL) [in] nonce Unique value that enables the verifier of a JWS to recognize when replay has occurred [in] url URL to which the client is directing the request [out] buffer Output buffer where to store the JSON object [out] written Length of the resulting JSON object
- Returns
- Error code
Definition at line 659 of file acme_client_misc.c.
◆ acmeClientFormatRequestHeader()
error_t acmeClientFormatRequestHeader | ( | AcmeClientContext * | context, |
const char_t * | method, | ||
const char_t * | url | ||
) |
Format HTTP request header.
- Parameters
-
[in] context Pointer to the ACME client context [in] method NULL-terminating string containing the HTTP method [in] url Target URL
- Returns
- Error code
Definition at line 543 of file acme_client_misc.c.
◆ acmeClientGenerateCsr()
error_t acmeClientGenerateCsr | ( | AcmeClientContext * | context, |
uint8_t * | buffer, | ||
size_t * | written | ||
) |
Generate CSR (Certificate Signing Request)
- Parameters
-
[in] context Pointer to the ACME client context [out] buffer Output buffer where to store the CSR [out] written Length of the resulting CSR
- Returns
- Error code
Definition at line 828 of file acme_client_misc.c.
◆ acmeClientGetPath()
Extract the path name from a given URL.
param[in] NULL-terminated string that contains the URL
- Returns
- Path component of the URL
Definition at line 1171 of file acme_client_misc.c.
◆ acmeClientLoadKeyPair()
error_t acmeClientLoadKeyPair | ( | AcmeKeyPair * | keyPair, |
const char_t * | publicKey, | ||
size_t | publicKeyLen, | ||
const char_t * | privateKey, | ||
size_t | privateKeyLen | ||
) |
Load public/private key pair.
- Parameters
-
[in] keyPair Pointer to the key pair [in] publicKey Public key (PEM format) [in] publicKeyLen Length of the public key [in] privateKey Private key (PEM format) [in] privateKeyLen Length of the private key
- Returns
- Error code
Definition at line 59 of file acme_client_misc.c.
◆ acmeClientParseProblemDetails()
error_t acmeClientParseProblemDetails | ( | AcmeClientContext * | context | ) |
Parse error response.
- Parameters
-
[in] context Pointer to the ACME client context
- Returns
- Error code
Definition at line 1111 of file acme_client_misc.c.
◆ acmeClientParseResponseHeader()
error_t acmeClientParseResponseHeader | ( | AcmeClientContext * | context | ) |
Parse HTTP response header.
- Parameters
-
[in] context Pointer to the ACME client context
- Returns
- Error code
Definition at line 990 of file acme_client_misc.c.
◆ acmeClientSendRequest()
error_t acmeClientSendRequest | ( | AcmeClientContext * | context | ) |
Send HTTP request.
- Parameters
-
[in] context Pointer to the ACME client context
- Returns
- Error code
Definition at line 344 of file acme_client_misc.c.
◆ acmeClientUnloadKeyPair()
void acmeClientUnloadKeyPair | ( | AcmeKeyPair * | keyPair | ) |
Unload public/private key pair.
- Parameters
-
[in] keyPair Pointer to the key pair
Definition at line 291 of file acme_client_misc.c.