acme_client_jose.h File Reference

JOSE (JSON Object Signing and Encryption) More...

#include "acme/acme_client.h"

Go to the source code of this file.

Functions

error_t jwkExportRsaPublicKey (const RsaPublicKey *publicKey, char_t *buffer, size_t *written, bool_t sort)
 Export an RSA public key to JWK format. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 

Detailed Description

JOSE (JSON Object Signing and Encryption)

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.0

Definition in file acme_client_jose.h.

Function Documentation

◆ jwkExportEcPublicKey()

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.

Parameters
[in]paramsEC domain parameters
[in]publicKeyEC public key
[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 171 of file acme_client_jose.c.

◆ jwkExportEddsaPublicKey()

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.

Parameters
[in]crvSubtype of the key
[in]publicKeyEdDSA public key
[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 321 of file acme_client_jose.c.

◆ jwkExportRsaPublicKey()

error_t jwkExportRsaPublicKey ( const RsaPublicKey publicKey,
char_t buffer,
size_t *  written,
bool_t  sort 
)

Export an RSA public key to JWK format.

Parameters
[in]publicKeyRSA public key
[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 55 of file acme_client_jose.c.

◆ jwsCreate()

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.

Parameters
[in]prngAlgoPRNG algorithm
[in]prngContextPointer to the PRNG context
[in]protectedPointer to the JWS protected header
[in]payloadPointer to the JWS payload
[in]algCryptographic algorithm used to secure the JWS
[in]crvSubtype of the key
[in]privateKeyPointer to the signer's private key
[out]bufferJSON structure representing the digitally signed or MACed message
[out]writtenLength of the resulting JSON structure
Returns
Error code

Definition at line 442 of file acme_client_jose.c.

◆ jwsGenerateSignature()

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.

Parameters
[in]prngAlgoPRNG algorithm
[in]prngContextPointer to the PRNG context
[in]algCryptographic algorithm used to secure the JWS
[in]crvSubtype of the key
[in]privateKeyPointer to the signer's private key
[in]inputPointer to the JWS signing input
[in]inputLenLength of the JWS signing input
[out]outputBuffer where to store the JWS signature
[out]outputLenLength of the JWS signature
Returns
Error code

Definition at line 575 of file acme_client_jose.c.