acme_client_misc.h File Reference

Helper functions for ACME client. More...

#include "acme/acme_client.h"

Go to the source code of this file.

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_tacmeClientGetPath (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.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.4

Definition in file acme_client_misc.h.

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]keyPairPointer to the key pair
[out]bufferOutput buffer where to store the JSON representation
[out]writtenLength of the resulting JSON representation
[in]sortSort 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]keyPairPointer to the key pair
[in]kidKey identifier (account URL)
[in]nonceUnique value that enables the verifier of a JWS to recognize when replay has occurred
[in]urlURL to which the client is directing the request
[out]bufferOutput buffer where to store the JSON object
[out]writtenLength 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]contextPointer to the ACME client context
[in]methodNULL-terminating string containing the HTTP method
[in]urlTarget 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]contextPointer to the ACME client context
[out]bufferOutput buffer where to store the CSR
[out]writtenLength of the resulting CSR
Returns
Error code

Definition at line 828 of file acme_client_misc.c.

◆ acmeClientGetPath()

const char_t* acmeClientGetPath ( const char_t url)

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]keyPairPointer to the key pair
[in]publicKeyPublic key (PEM format)
[in]publicKeyLenLength of the public key
[in]privateKeyPrivate key (PEM format)
[in]privateKeyLenLength 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]contextPointer 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]contextPointer 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]contextPointer 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]keyPairPointer to the key pair

Definition at line 291 of file acme_client_misc.c.