pkcs7_sign_generate.c File Reference

PKCS #7 signature generation. More...

#include "core/crypto.h"
#include "pkcs7/pkcs7_format.h"
#include "pkcs7/pkcs7_sign_generate.h"
#include "encoding/oid.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   CRYPTO_TRACE_LEVEL
 

Functions

error_t pkcs7GenerateSignedData (const PrngAlgo *prngAlgo, void *prngContext, const uint8_t *content, size_t contentLen, const X509CertInfo *signerCertInfo, const Pkcs7AuthenticatedAttributes *authenticatedAttributes, const Pkcs7UnauthenticatedAttributes *unauthenticatedAttributes, const X509SignAlgoId *signatureAlgo, const void *signerPrivateKey, uint8_t *output, size_t *written)
 Generate signed-data content. More...
 
error_t pkcs7GenerateSignature (const PrngAlgo *prngAlgo, void *prngContext, const uint8_t *digest, const Pkcs7SignerInfo *signerInfo, const void *privateKey, uint8_t *output, size_t *written)
 Signature generation. More...
 
error_t pkcs7GenerateRsaSignature (const uint8_t *digest, const Pkcs7SignerInfo *signerInfo, const RsaPrivateKey *privateKey, uint8_t *output, size_t *written)
 RSA signature generation. More...
 

Detailed Description

PKCS #7 signature generation.

License

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

Copyright (C) 2010-2025 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.5.2

Definition in file pkcs7_sign_generate.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   CRYPTO_TRACE_LEVEL

Definition at line 32 of file pkcs7_sign_generate.c.

Function Documentation

◆ pkcs7GenerateRsaSignature()

error_t pkcs7GenerateRsaSignature ( const uint8_t *  digest,
const Pkcs7SignerInfo signerInfo,
const RsaPrivateKey privateKey,
uint8_t *  output,
size_t *  written 
)

RSA signature generation.

Parameters
[in]digestMessage digest
[in]signerInfoPointer to the signer information
[in]privateKeySigner's private key
[out]outputResulting signature
[out]writtenLength of the resulting signature
Returns
Error code

Definition at line 215 of file pkcs7_sign_generate.c.

◆ pkcs7GenerateSignature()

error_t pkcs7GenerateSignature ( const PrngAlgo prngAlgo,
void *  prngContext,
const uint8_t *  digest,
const Pkcs7SignerInfo signerInfo,
const void *  privateKey,
uint8_t *  output,
size_t *  written 
)

Signature generation.

Parameters
[in]prngAlgoPRNG algorithm
[in]prngContextPointer to the PRNG context
[in]digestMessage digest
[in]signerInfoPointer to the signer information
[in]privateKeySigner's private key
[out]outputResulting signature
[out]writtenLength of the resulting signature
Returns
Error code

Definition at line 167 of file pkcs7_sign_generate.c.

◆ pkcs7GenerateSignedData()

error_t pkcs7GenerateSignedData ( const PrngAlgo prngAlgo,
void *  prngContext,
const uint8_t *  content,
size_t  contentLen,
const X509CertInfo signerCertInfo,
const Pkcs7AuthenticatedAttributes authenticatedAttributes,
const Pkcs7UnauthenticatedAttributes unauthenticatedAttributes,
const X509SignAlgoId signatureAlgo,
const void *  signerPrivateKey,
uint8_t *  output,
size_t *  written 
)

Generate signed-data content.

Parameters
[in]prngAlgoPRNG algorithm
[in]prngContextPointer to the PRNG context
[in]contentPointer to the message to be signed
[in]contentLenLength of the message, in bytes
[in]signerCertInfoSigner's certificate
[in]authenticatedAttributesCollection of attributes that are signed
[in]unauthenticatedAttributesCollection of attributes that are not signed
[in]signatureAlgoSignature algorithm
[in]signerPrivateKeyPointer to the signer's private key
[out]outputBuffer where to format the ASN.1 structure
[out]writtenLength of the resulting ASN.1 structure
Returns
Error code

Definition at line 61 of file pkcs7_sign_generate.c.