x509_sign_generate.h File Reference

RSA/DSA/ECDSA/EdDSA signature generation. More...

#include "core/crypto.h"
#include "pkix/x509_common.h"

Go to the source code of this file.

Typedefs

typedef error_t(* X509SignGenCallback) (const PrngAlgo *prngAlgo, void *prngContext, const X509OctetString *tbsData, const X509SignAlgoId *signAlgoId, const X509SubjectPublicKeyInfo *publicKeyInfo, const void *privateKey, uint8_t *output, size_t *written)
 Signature generation callback function. More...
 

Functions

error_t x509RegisterSignGenCallback (X509SignGenCallback callback)
 Register signature generation callback function. More...
 
error_t x509GenerateSignature (const PrngAlgo *prngAlgo, void *prngContext, const X509OctetString *tbsData, const X509SignAlgoId *signAlgoId, const X509SubjectPublicKeyInfo *publicKeyInfo, const void *privateKey, uint8_t *output, size_t *written)
 Certificate signature generation. More...
 
error_t x509GenerateRsaSignature (const X509OctetString *tbsData, const HashAlgo *hashAlgo, const RsaPrivateKey *privateKey, uint8_t *output, size_t *written)
 RSA signature generation. More...
 
error_t x509GenerateRsaPssSignature (const PrngAlgo *prngAlgo, void *prngContext, const X509OctetString *tbsData, const HashAlgo *hashAlgo, size_t saltLen, const RsaPrivateKey *privateKey, uint8_t *output, size_t *written)
 RSA-PSS signature generation. More...
 
error_t x509GenerateDsaSignature (const PrngAlgo *prngAlgo, void *prngContext, const X509OctetString *tbsData, const HashAlgo *hashAlgo, const DsaPrivateKey *privateKey, uint8_t *output, size_t *written)
 DSA signature generation. More...
 
error_t x509GenerateEcdsaSignature (const PrngAlgo *prngAlgo, void *prngContext, const X509OctetString *tbsData, const HashAlgo *hashAlgo, const X509SubjectPublicKeyInfo *publicKeyInfo, const EcPrivateKey *privateKey, uint8_t *output, size_t *written)
 ECDSA signature generation. More...
 
error_t x509GenerateSm2Signature (const PrngAlgo *prngAlgo, void *prngContext, const X509OctetString *tbsData, const HashAlgo *hashAlgo, const EcPrivateKey *privateKey, uint8_t *output, size_t *written)
 SM2 signature generation. More...
 
error_t x509GenerateEd25519Signature (const X509OctetString *tbsData, const EddsaPrivateKey *privateKey, uint8_t *output, size_t *written)
 Ed25519 signature generation. More...
 
error_t x509GenerateEd448Signature (const X509OctetString *tbsData, const EddsaPrivateKey *privateKey, uint8_t *output, size_t *written)
 Ed448 signature generation. More...
 

Detailed Description

RSA/DSA/ECDSA/EdDSA signature generation.

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneCRYPTO 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 x509_sign_generate.h.

Typedef Documentation

◆ X509SignGenCallback

typedef error_t(* X509SignGenCallback) (const PrngAlgo *prngAlgo, void *prngContext, const X509OctetString *tbsData, const X509SignAlgoId *signAlgoId, const X509SubjectPublicKeyInfo *publicKeyInfo, const void *privateKey, uint8_t *output, size_t *written)

Signature generation callback function.

Definition at line 48 of file x509_sign_generate.h.

Function Documentation

◆ x509GenerateDsaSignature()

error_t x509GenerateDsaSignature ( const PrngAlgo prngAlgo,
void *  prngContext,
const X509OctetString tbsData,
const HashAlgo hashAlgo,
const DsaPrivateKey privateKey,
uint8_t *  output,
size_t *  written 
)

DSA signature generation.

Parameters
[in]prngAlgoPRNG algorithm
[in]prngContextPointer to the PRNG context
[in]tbsDataPointer to the data to be signed
[in]hashAlgoUnderlying hash function
[in]privateKeySigner's private key
[out]outputResulting signature
[out]writtenLength of the resulting signature
Returns
Error code

Definition at line 291 of file x509_sign_generate.c.

◆ x509GenerateEcdsaSignature()

error_t x509GenerateEcdsaSignature ( const PrngAlgo prngAlgo,
void *  prngContext,
const X509OctetString tbsData,
const HashAlgo hashAlgo,
const X509SubjectPublicKeyInfo publicKeyInfo,
const EcPrivateKey privateKey,
uint8_t *  output,
size_t *  written 
)

ECDSA signature generation.

Parameters
[in]prngAlgoPRNG algorithm
[in]prngContextPointer to the PRNG context
[in]tbsDataPointer to the data to be signed
[in]hashAlgoUnderlying hash function
[in]publicKeyInfoSigner's public key information
[in]privateKeySigner's private key
[out]outputResulting signature
[out]writtenLength of the resulting signature
Returns
Error code

Definition at line 346 of file x509_sign_generate.c.

◆ x509GenerateEd25519Signature()

error_t x509GenerateEd25519Signature ( const X509OctetString tbsData,
const EddsaPrivateKey privateKey,
uint8_t *  output,
size_t *  written 
)

Ed25519 signature generation.

Parameters
[in]tbsDataPointer to the data to be signed
[in]privateKeySigner's private key
[out]outputResulting signature
[out]writtenLength of the resulting signature
Returns
Error code

Definition at line 481 of file x509_sign_generate.c.

◆ x509GenerateEd448Signature()

error_t x509GenerateEd448Signature ( const X509OctetString tbsData,
const EddsaPrivateKey privateKey,
uint8_t *  output,
size_t *  written 
)

Ed448 signature generation.

Parameters
[in]tbsDataPointer to the data to be signed
[in]privateKeySigner's private key
[out]outputResulting signature
[out]writtenLength of the resulting signature
Returns
Error code

Definition at line 531 of file x509_sign_generate.c.

◆ x509GenerateRsaPssSignature()

error_t x509GenerateRsaPssSignature ( const PrngAlgo prngAlgo,
void *  prngContext,
const X509OctetString tbsData,
const HashAlgo hashAlgo,
size_t  saltLen,
const RsaPrivateKey privateKey,
uint8_t *  output,
size_t *  written 
)

RSA-PSS signature generation.

Parameters
[in]prngAlgoPRNG algorithm
[in]prngContextPointer to the PRNG context
[in]tbsDataPointer to the data to be signed
[in]hashAlgoUnderlying hash function
[in]saltLenLength of the salt, in bytes
[in]privateKeySigner's private key
[out]outputResulting signature
[out]writtenLength of the resulting signature
Returns
Error code

Definition at line 251 of file x509_sign_generate.c.

◆ x509GenerateRsaSignature()

error_t x509GenerateRsaSignature ( const X509OctetString tbsData,
const HashAlgo hashAlgo,
const RsaPrivateKey privateKey,
uint8_t *  output,
size_t *  written 
)

RSA signature generation.

Parameters
[in]tbsDataPointer to the data to be signed
[in]hashAlgoUnderlying hash function
[in]privateKeySigner's private key
[out]outputResulting signature
[out]writtenLength of the resulting signature
Returns
Error code

Definition at line 210 of file x509_sign_generate.c.

◆ x509GenerateSignature()

error_t x509GenerateSignature ( const PrngAlgo prngAlgo,
void *  prngContext,
const X509OctetString tbsData,
const X509SignAlgoId signAlgoId,
const X509SubjectPublicKeyInfo publicKeyInfo,
const void *  privateKey,
uint8_t *  output,
size_t *  written 
)

Certificate signature generation.

Parameters
[in]prngAlgoPRNG algorithm
[in]prngContextPointer to the PRNG context
[in]tbsDataPointer to the data to be signed
[in]signAlgoIdSignature algorithm identifier
[in]publicKeyInfoSigner's public key information
[in]privateKeySigner's private key
[out]outputResulting signature
[out]writtenLength of the resulting signature
Returns
Error code

Definition at line 81 of file x509_sign_generate.c.

◆ x509GenerateSm2Signature()

error_t x509GenerateSm2Signature ( const PrngAlgo prngAlgo,
void *  prngContext,
const X509OctetString tbsData,
const HashAlgo hashAlgo,
const EcPrivateKey privateKey,
uint8_t *  output,
size_t *  written 
)

SM2 signature generation.

Parameters
[in]prngAlgoPRNG algorithm
[in]prngContextPointer to the PRNG context
[in]tbsDataPointer to the data to be signed
[in]hashAlgoUnderlying hash function
[in]privateKeySigner's private key
[out]outputResulting signature
[out]writtenLength of the resulting signature
Returns
Error code

Definition at line 426 of file x509_sign_generate.c.

◆ x509RegisterSignGenCallback()

error_t x509RegisterSignGenCallback ( X509SignGenCallback  callback)

Register signature generation callback function.

Parameters
[in]callbackSignature generation callback function
Returns
Error code

Definition at line 54 of file x509_sign_generate.c.