RSA/DSA/ECDSA/EdDSA signature generation and verification. More...
#include "core/crypto.h"
#include "pkix/x509_key_parse.h"
#include "pkix/x509_signature.h"
#include "pkc/rsa.h"
#include "pkc/dsa.h"
#include "ecc/ecdsa.h"
#include "ecc/eddsa.h"
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | TRACE_LEVEL CRYPTO_TRACE_LEVEL |
Functions | |
error_t | x509RegisterSignGenCallback (X509SignGenCallback callback) |
Register signature generation callback function. More... | |
error_t | x509RegisterSignVerifyCallback (X509SignVerifyCallback callback) |
Register signature verification callback function. More... | |
error_t | x509GenerateSignature (const PrngAlgo *prngAlgo, void *prngContext, const uint8_t *tbsCert, size_t tbsCertLen, const X509SignatureAlgoId *signatureAlgoId, const X509SubjectPublicKeyInfo *publicKeyInfo, const void *privateKey, uint8_t *output, size_t *written) |
Certificate signature generation. More... | |
error_t | x509GenerateRsaSignature (const uint8_t *tbsCert, size_t tbsCertLen, 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 uint8_t *tbsCert, size_t tbsCertLen, 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 uint8_t *tbsCert, size_t tbsCertLen, 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 uint8_t *tbsCert, size_t tbsCertLen, const HashAlgo *hashAlgo, const X509SubjectPublicKeyInfo *publicKeyInfo, const EcPrivateKey *privateKey, uint8_t *output, size_t *written) |
ECDSA signature generation. More... | |
error_t | x509GenerateEd25519Signature (const uint8_t *tbsCert, size_t tbsCertLen, const EddsaPrivateKey *privateKey, uint8_t *output, size_t *written) |
Ed25519 signature generation. More... | |
error_t | x509GenerateEd448Signature (const uint8_t *tbsCert, size_t tbsCertLen, const EddsaPrivateKey *privateKey, uint8_t *output, size_t *written) |
Ed448 signature generation. More... | |
error_t | x509VerifySignature (const uint8_t *tbsCert, size_t tbsCertLen, const X509SignatureAlgoId *signatureAlgoId, const X509SubjectPublicKeyInfo *publicKeyInfo, const X509SignatureValue *signatureValue) |
Certificate signature verification. More... | |
error_t | x509VerifyRsaSignature (const uint8_t *tbsCert, size_t tbsCertLen, const HashAlgo *hashAlgo, const X509SubjectPublicKeyInfo *publicKeyInfo, const X509SignatureValue *signatureValue) |
RSA signature verification. More... | |
error_t | x509VerifyRsaPssSignature (const uint8_t *tbsCert, size_t tbsCertLen, const HashAlgo *hashAlgo, size_t saltLen, const X509SubjectPublicKeyInfo *publicKeyInfo, const X509SignatureValue *signatureValue) |
RSA-PSS signature verification. More... | |
error_t | x509VerifyDsaSignature (const uint8_t *tbsCert, size_t tbsCertLen, const HashAlgo *hashAlgo, const X509SubjectPublicKeyInfo *publicKeyInfo, const X509SignatureValue *signatureValue) |
DSA signature verification. More... | |
error_t | x509VerifyEcdsaSignature (const uint8_t *tbsCert, size_t tbsCertLen, const HashAlgo *hashAlgo, const X509SubjectPublicKeyInfo *publicKeyInfo, const X509SignatureValue *signatureValue) |
ECDSA signature verification. More... | |
error_t | x509VerifyEd25519Signature (const uint8_t *tbsCert, size_t tbsCertLen, const X509SubjectPublicKeyInfo *publicKeyInfo, const X509SignatureValue *signatureValue) |
Ed25519 signature verification. More... | |
error_t | x509VerifyEd448Signature (const uint8_t *tbsCert, size_t tbsCertLen, const X509SubjectPublicKeyInfo *publicKeyInfo, const X509SignatureValue *signatureValue) |
Ed448 signature verification. More... | |
Detailed Description
RSA/DSA/ECDSA/EdDSA signature generation and verification.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2023 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.
- Version
- 2.2.2
Definition in file x509_signature.c.
Macro Definition Documentation
◆ TRACE_LEVEL
#define TRACE_LEVEL CRYPTO_TRACE_LEVEL |
Definition at line 32 of file x509_signature.c.
Function Documentation
◆ x509GenerateDsaSignature()
error_t x509GenerateDsaSignature | ( | const PrngAlgo * | prngAlgo, |
void * | prngContext, | ||
const uint8_t * | tbsCert, | ||
size_t | tbsCertLen, | ||
const HashAlgo * | hashAlgo, | ||
const DsaPrivateKey * | privateKey, | ||
uint8_t * | output, | ||
size_t * | written | ||
) |
DSA signature generation.
- Parameters
-
[in] prngAlgo PRNG algorithm [in] prngContext Pointer to the PRNG context [in] tbsCert Pointer to the TBSCertificate to be signed [in] tbsCertLen Length of the TBSCertificate, in bytes [in] hashAlgo Underlying hash function [in] privateKey Signer's private key [out] output Resulting signature [out] written Length of the resulting signature
- Returns
- Error code
Definition at line 313 of file x509_signature.c.
◆ x509GenerateEcdsaSignature()
error_t x509GenerateEcdsaSignature | ( | const PrngAlgo * | prngAlgo, |
void * | prngContext, | ||
const uint8_t * | tbsCert, | ||
size_t | tbsCertLen, | ||
const HashAlgo * | hashAlgo, | ||
const X509SubjectPublicKeyInfo * | publicKeyInfo, | ||
const EcPrivateKey * | privateKey, | ||
uint8_t * | output, | ||
size_t * | written | ||
) |
ECDSA signature generation.
- Parameters
-
[in] prngAlgo PRNG algorithm [in] prngContext Pointer to the PRNG context [in] tbsCert Pointer to the TBSCertificate to be signed [in] tbsCertLen Length of the TBSCertificate, in bytes [in] hashAlgo Underlying hash function [in] publicKeyInfo Signer's public key information [in] privateKey Signer's private key [out] output Resulting signature [out] written Length of the resulting signature
- Returns
- Error code
Definition at line 369 of file x509_signature.c.
◆ x509GenerateEd25519Signature()
error_t x509GenerateEd25519Signature | ( | const uint8_t * | tbsCert, |
size_t | tbsCertLen, | ||
const EddsaPrivateKey * | privateKey, | ||
uint8_t * | output, | ||
size_t * | written | ||
) |
Ed25519 signature generation.
- Parameters
-
[in] tbsCert Pointer to the TBSCertificate to be signed [in] tbsCertLen Length of the TBSCertificate, in bytes [in] privateKey Signer's private key [out] output Resulting signature [out] written Length of the resulting signature
- Returns
- Error code
Definition at line 447 of file x509_signature.c.
◆ x509GenerateEd448Signature()
error_t x509GenerateEd448Signature | ( | const uint8_t * | tbsCert, |
size_t | tbsCertLen, | ||
const EddsaPrivateKey * | privateKey, | ||
uint8_t * | output, | ||
size_t * | written | ||
) |
Ed448 signature generation.
- Parameters
-
[in] tbsCert Pointer to the TBSCertificate to be signed [in] tbsCertLen Length of the TBSCertificate, in bytes [in] privateKey Signer's private key [out] output Resulting signature [out] written Length of the resulting signature
- Returns
- Error code
Definition at line 498 of file x509_signature.c.
◆ x509GenerateRsaPssSignature()
error_t x509GenerateRsaPssSignature | ( | const PrngAlgo * | prngAlgo, |
void * | prngContext, | ||
const uint8_t * | tbsCert, | ||
size_t | tbsCertLen, | ||
const HashAlgo * | hashAlgo, | ||
size_t | saltLen, | ||
const RsaPrivateKey * | privateKey, | ||
uint8_t * | output, | ||
size_t * | written | ||
) |
RSA-PSS signature generation.
- Parameters
-
[in] prngAlgo PRNG algorithm [in] prngContext Pointer to the PRNG context [in] tbsCert Pointer to the TBSCertificate to be signed [in] tbsCertLen Length of the TBSCertificate, in bytes [in] hashAlgo Underlying hash function [in] saltLen Length of the salt, in bytes [in] privateKey Signer's private key [out] output Resulting signature [out] written Length of the resulting signature
- Returns
- Error code
Definition at line 271 of file x509_signature.c.
◆ x509GenerateRsaSignature()
error_t x509GenerateRsaSignature | ( | const uint8_t * | tbsCert, |
size_t | tbsCertLen, | ||
const HashAlgo * | hashAlgo, | ||
const RsaPrivateKey * | privateKey, | ||
uint8_t * | output, | ||
size_t * | written | ||
) |
RSA signature generation.
- Parameters
-
[in] tbsCert Pointer to the TBSCertificate to be signed [in] tbsCertLen Length of the TBSCertificate, in bytes [in] hashAlgo Underlying hash function [in] privateKey Signer's private key [out] output Resulting signature [out] written Length of the resulting signature
- Returns
- Error code
Definition at line 229 of file x509_signature.c.
◆ x509GenerateSignature()
error_t x509GenerateSignature | ( | const PrngAlgo * | prngAlgo, |
void * | prngContext, | ||
const uint8_t * | tbsCert, | ||
size_t | tbsCertLen, | ||
const X509SignatureAlgoId * | signatureAlgoId, | ||
const X509SubjectPublicKeyInfo * | publicKeyInfo, | ||
const void * | privateKey, | ||
uint8_t * | output, | ||
size_t * | written | ||
) |
Certificate signature generation.
- Parameters
-
[in] prngAlgo PRNG algorithm [in] prngContext Pointer to the PRNG context [in] tbsCert Pointer to the TBSCertificate to be signed [in] tbsCertLen Length of the TBSCertificate, in bytes [in] signatureAlgoId Signature algorithm identifier [in] publicKeyInfo Signer's public key information [in] privateKey Signer's private key [out] output Resulting signature [out] written Length of the resulting signature
- Returns
- Error code
Definition at line 108 of file x509_signature.c.
◆ x509RegisterSignGenCallback()
error_t x509RegisterSignGenCallback | ( | X509SignGenCallback | callback | ) |
Register signature generation callback function.
- Parameters
-
[in] callback Signature generation callback function
- Returns
- Error code
Definition at line 60 of file x509_signature.c.
◆ x509RegisterSignVerifyCallback()
error_t x509RegisterSignVerifyCallback | ( | X509SignVerifyCallback | callback | ) |
Register signature verification callback function.
- Parameters
-
[in] callback Signature verification callback function
- Returns
- Error code
Definition at line 80 of file x509_signature.c.
◆ x509VerifyDsaSignature()
error_t x509VerifyDsaSignature | ( | const uint8_t * | tbsCert, |
size_t | tbsCertLen, | ||
const HashAlgo * | hashAlgo, | ||
const X509SubjectPublicKeyInfo * | publicKeyInfo, | ||
const X509SignatureValue * | signatureValue | ||
) |
DSA signature verification.
- Parameters
-
[in] tbsCert TBSCertificate whose signature is to be verified [in] tbsCertLen Length of the TBSCertificate, in bytes [in] hashAlgo Underlying hash function [in] publicKeyInfo Issuer's public key [in] signatureValue Signature to be verified
- Returns
- Error code
Definition at line 802 of file x509_signature.c.
◆ x509VerifyEcdsaSignature()
error_t x509VerifyEcdsaSignature | ( | const uint8_t * | tbsCert, |
size_t | tbsCertLen, | ||
const HashAlgo * | hashAlgo, | ||
const X509SubjectPublicKeyInfo * | publicKeyInfo, | ||
const X509SignatureValue * | signatureValue | ||
) |
ECDSA signature verification.
- Parameters
-
[in] tbsCert TBSCertificate whose signature is to be verified [in] tbsCertLen Length of the TBSCertificate, in bytes [in] hashAlgo Underlying hash function [in] publicKeyInfo Issuer's public key [in] signatureValue Signature to be verified
- Returns
- Error code
Definition at line 881 of file x509_signature.c.
◆ x509VerifyEd25519Signature()
error_t x509VerifyEd25519Signature | ( | const uint8_t * | tbsCert, |
size_t | tbsCertLen, | ||
const X509SubjectPublicKeyInfo * | publicKeyInfo, | ||
const X509SignatureValue * | signatureValue | ||
) |
Ed25519 signature verification.
- Parameters
-
[in] tbsCert TBSCertificate whose signature is to be verified [in] tbsCertLen Length of the TBSCertificate, in bytes [in] publicKeyInfo Issuer's public key [in] signatureValue Signature to be verified
- Returns
- Error code
Definition at line 970 of file x509_signature.c.
◆ x509VerifyEd448Signature()
error_t x509VerifyEd448Signature | ( | const uint8_t * | tbsCert, |
size_t | tbsCertLen, | ||
const X509SubjectPublicKeyInfo * | publicKeyInfo, | ||
const X509SignatureValue * | signatureValue | ||
) |
Ed448 signature verification.
- Parameters
-
[in] tbsCert TBSCertificate whose signature is to be verified [in] tbsCertLen Length of the TBSCertificate, in bytes [in] publicKeyInfo Issuer's public key [in] signatureValue Signature to be verified
- Returns
- Error code
Definition at line 1017 of file x509_signature.c.
◆ x509VerifyRsaPssSignature()
error_t x509VerifyRsaPssSignature | ( | const uint8_t * | tbsCert, |
size_t | tbsCertLen, | ||
const HashAlgo * | hashAlgo, | ||
size_t | saltLen, | ||
const X509SubjectPublicKeyInfo * | publicKeyInfo, | ||
const X509SignatureValue * | signatureValue | ||
) |
RSA-PSS signature verification.
- Parameters
-
[in] tbsCert TBSCertificate whose signature is to be verified [in] tbsCertLen Length of the TBSCertificate, in bytes [in] hashAlgo Underlying hash function [in] saltLen Length of the salt, in bytes [in] publicKeyInfo Issuer's public key [in] signatureValue Signature to be verified
- Returns
- Error code
Definition at line 734 of file x509_signature.c.
◆ x509VerifyRsaSignature()
error_t x509VerifyRsaSignature | ( | const uint8_t * | tbsCert, |
size_t | tbsCertLen, | ||
const HashAlgo * | hashAlgo, | ||
const X509SubjectPublicKeyInfo * | publicKeyInfo, | ||
const X509SignatureValue * | signatureValue | ||
) |
RSA signature verification.
- Parameters
-
[in] tbsCert TBSCertificate whose signature is to be verified [in] tbsCertLen Length of the TBSCertificate, in bytes [in] hashAlgo Underlying hash function [in] publicKeyInfo Issuer's public key [in] signatureValue Signature to be verified
- Returns
- Error code
Definition at line 666 of file x509_signature.c.
◆ x509VerifySignature()
error_t x509VerifySignature | ( | const uint8_t * | tbsCert, |
size_t | tbsCertLen, | ||
const X509SignatureAlgoId * | signatureAlgoId, | ||
const X509SubjectPublicKeyInfo * | publicKeyInfo, | ||
const X509SignatureValue * | signatureValue | ||
) |
Certificate signature verification.
- Parameters
-
[in] tbsCert TBSCertificate whose signature is to be verified [in] tbsCertLen Length of the TBSCertificate, in bytes [in] signatureAlgoId Signature algorithm identifier [in] publicKeyInfo Issuer's public key [in] signatureValue Signature to be verified
- Returns
- Error code
Definition at line 549 of file x509_signature.c.