PKCS #7 message formatting. More...
Go to the source code of this file.
Functions | |
error_t | pkcs7FormatContentInfo (const Pkcs7ContentInfo *contentInfo, uint8_t *output, size_t *written) |
Format contentInfo structure. More... | |
error_t | pkcs7FormatSignedData (const PrngAlgo *prngAlgo, void *prngContext, const Pkcs7SignedData *signedData, const void *signerPrivateKey, uint8_t *output, size_t *written) |
Format signed-data content. More... | |
error_t | pkcs7FormatEnvelopedData (const PrngAlgo *prngAlgo, void *prngContext, const X509CertInfo *recipientCertInfo, const Pkcs7EnvelopedData *envelopedData, const uint8_t *plaintext, size_t plaintextLen, uint8_t *output, size_t *written) |
Format enveloped-data content. More... | |
error_t | pkcs7FormatDigestAlgos (const Pkcs7DigestAlgos *digestAlgos, uint8_t *output, size_t *written) |
Format digestAlgos structure. More... | |
error_t | pkcs7FormatCertificates (const Pkcs7Certificates *certificates, uint8_t *output, size_t *written) |
Format certificates. More... | |
error_t | pkcs7FormatCrls (const Pkcs7Crls *crls, uint8_t *output, size_t *written) |
Format CRLs. More... | |
error_t | pkcs7FormatSignerInfos (const PrngAlgo *prngAlgo, void *prngContext, const Pkcs7SignerInfos *signerInfos, const void *signerPrivateKey, uint8_t *output, size_t *written) |
Format SignerInfos structure. More... | |
error_t | pkcs7FormatSignerInfo (const PrngAlgo *prngAlgo, void *prngContext, const Pkcs7SignerInfo *signerInfo, const void *signerPrivateKey, uint8_t *output, size_t *written) |
Format SignerInfo structure. More... | |
error_t | pkcs7FormatIssuerAndSerialNumber (const Pkcs7IssuerAndSerialNumber *issuerAndSerialNumber, uint8_t *output, size_t *written) |
Format IssuerAndSerialNumber structure. More... | |
error_t | pkcs7FormatAuthenticatedAttributes (const Pkcs7AuthenticatedAttributes *authenticatedAttributes, uint8_t *output, size_t *written) |
Format authenticatedAttributes structure. More... | |
error_t | pkcs7FormatDigestEncryptionAlgo (const X509SignAlgoId *digestEncryptionAlgo, uint8_t *output, size_t *written) |
Format digestEncryptionAlgorithm structure. More... | |
error_t | pkcs7FormatEncryptedDigest (const PrngAlgo *prngAlgo, void *prngContext, const uint8_t *digest, const Pkcs7SignerInfo *signerInfo, const void *signerPrivateKey, uint8_t *output, size_t *written) |
Format encryptedDigest structure. More... | |
error_t | pkcs7FormatUnauthenticatedAttributes (const Pkcs7UnauthenticatedAttributes *unauthenticatedAttributes, uint8_t *output, size_t *written) |
Format unauthenticatedAttributes structure. More... | |
error_t | pkcs7FormatAttribute (const Pkcs7Attribute *attribute, uint8_t *output, size_t *written) |
Format attribute. More... | |
error_t | pkcs7AddAttribute (const Pkcs7Attribute *attribute, uint8_t *attributes, size_t *length) |
Add attribute. More... | |
error_t | pkcs7FormatRecipientInfos (const PrngAlgo *prngAlgo, void *prngContext, const Pkcs7RecipientInfos *recipientInfos, const X509CertInfo *recipientCertInfo, const uint8_t *key, size_t keyLen, uint8_t *output, size_t *written) |
Format recipientInfos structure. More... | |
error_t | pkcs7FormatRecipientInfo (const PrngAlgo *prngAlgo, void *prngContext, const Pkcs7RecipientInfo *recipientInfo, const X509CertInfo *recipientCertInfo, const uint8_t *key, size_t keyLen, uint8_t *output, size_t *written) |
Format RecipientInfo structure. More... | |
error_t | pkcs7FormatEncryptedKey (const PrngAlgo *prngAlgo, void *prngContext, const X509CertInfo *recipientCertInfo, const uint8_t *key, size_t keyLen, uint8_t *output, size_t *written) |
Format encryptedKey structure. More... | |
error_t | pkcs7FormatEncryptedContentInfo (const Pkcs7EncryptedContentInfo *encryptedContentInfo, const uint8_t *key, size_t keyLen, const uint8_t *plaintext, size_t plaintextLen, uint8_t *output, size_t *written) |
Format encryptedContentInfo structure. More... | |
error_t | pkcs7FormatContentEncrAlgo (const Pkcs7ContentEncrAlgo *contentEncrAlgo, uint8_t *output, size_t *written) |
Format contentEncryptionAlgorithm structure. More... | |
error_t | pkcs7FormatAlgoId (const X509AlgoId *algoId, uint8_t *output, size_t *written) |
Format AlgorithmIdentifier structure. More... | |
Detailed Description
PKCS #7 message formatting.
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.
- Version
- 2.5.2
Definition in file pkcs7_format.h.
Function Documentation
◆ pkcs7AddAttribute()
error_t pkcs7AddAttribute | ( | const Pkcs7Attribute * | attribute, |
uint8_t * | attributes, | ||
size_t * | length | ||
) |
Add attribute.
- Parameters
-
[in] attribute Pointer to the attribute to add [in] attributes Pointer to the list of attributes [in,out] length Actual length of the list of attributes
- Returns
- Error code
Definition at line 1408 of file pkcs7_format.c.
◆ pkcs7FormatAlgoId()
error_t pkcs7FormatAlgoId | ( | const X509AlgoId * | algoId, |
uint8_t * | output, | ||
size_t * | written | ||
) |
Format AlgorithmIdentifier structure.
- Parameters
-
[in] algoId Pointer to the structure to format [out] output Buffer where to format the ASN.1 structure [out] written Length of the resulting ASN.1 structure
- Returns
- Error code
Definition at line 1865 of file pkcs7_format.c.
◆ pkcs7FormatAttribute()
error_t pkcs7FormatAttribute | ( | const Pkcs7Attribute * | attribute, |
uint8_t * | output, | ||
size_t * | written | ||
) |
Format attribute.
- Parameters
-
[in] attribute Pointer to the attribute to format [out] output Buffer where to format the ASN.1 structure [out] written Length of the resulting ASN.1 structure
- Returns
- Error code
Definition at line 1321 of file pkcs7_format.c.
◆ pkcs7FormatAuthenticatedAttributes()
error_t pkcs7FormatAuthenticatedAttributes | ( | const Pkcs7AuthenticatedAttributes * | authenticatedAttributes, |
uint8_t * | output, | ||
size_t * | written | ||
) |
Format authenticatedAttributes structure.
- Parameters
-
[in] authenticatedAttributes Pointer to the structure to format [out] output Buffer where to format the ASN.1 structure [out] written Length of the resulting ASN.1 structure
- Returns
- Error code
Definition at line 962 of file pkcs7_format.c.
◆ pkcs7FormatCertificates()
error_t pkcs7FormatCertificates | ( | const Pkcs7Certificates * | certificates, |
uint8_t * | output, | ||
size_t * | written | ||
) |
Format certificates.
- Parameters
-
[in] certificates Pointer to the structure to format [out] output Buffer where to format the ASN.1 structure [out] written Length of the resulting ASN.1 structure
- Returns
- Error code
Definition at line 525 of file pkcs7_format.c.
◆ pkcs7FormatContentEncrAlgo()
error_t pkcs7FormatContentEncrAlgo | ( | const Pkcs7ContentEncrAlgo * | contentEncrAlgo, |
uint8_t * | output, | ||
size_t * | written | ||
) |
Format contentEncryptionAlgorithm structure.
- Parameters
-
[in] contentEncrAlgo Pointer to the structure to format [out] output Buffer where to format the ASN.1 structure [out] written Length of the resulting ASN.1 structure
- Returns
- Error code
Definition at line 1789 of file pkcs7_format.c.
◆ pkcs7FormatContentInfo()
error_t pkcs7FormatContentInfo | ( | const Pkcs7ContentInfo * | contentInfo, |
uint8_t * | output, | ||
size_t * | written | ||
) |
Format contentInfo structure.
- Parameters
-
[in] contentInfo Pointer to the structure to format [out] output Buffer where to format the ASN.1 structure [out] written Length of the resulting ASN.1 structure
- Returns
- Error code
Definition at line 57 of file pkcs7_format.c.
◆ pkcs7FormatCrls()
Format CRLs.
- Parameters
-
[in] crls Pointer to the structure to format [out] output Buffer where to format the ASN.1 structure [out] written Length of the resulting ASN.1 structure
- Returns
- Error code
Definition at line 610 of file pkcs7_format.c.
◆ pkcs7FormatDigestAlgos()
error_t pkcs7FormatDigestAlgos | ( | const Pkcs7DigestAlgos * | digestAlgos, |
uint8_t * | output, | ||
size_t * | written | ||
) |
Format digestAlgos structure.
- Parameters
-
[in] digestAlgos Pointer to the structure to format [out] output Buffer where to format the ASN.1 structure [out] written Length of the resulting ASN.1 structure
- Returns
- Error code
Definition at line 466 of file pkcs7_format.c.
◆ pkcs7FormatDigestEncryptionAlgo()
error_t pkcs7FormatDigestEncryptionAlgo | ( | const X509SignAlgoId * | digestEncryptionAlgo, |
uint8_t * | output, | ||
size_t * | written | ||
) |
Format digestEncryptionAlgorithm structure.
- Parameters
-
[in] digestEncryptionAlgo Pointer to the structure to format [out] output Buffer where to format the ASN.1 structure [out] written Length of the resulting ASN.1 structure
- Returns
- Error code
Definition at line 1096 of file pkcs7_format.c.
◆ pkcs7FormatEncryptedContentInfo()
error_t pkcs7FormatEncryptedContentInfo | ( | const Pkcs7EncryptedContentInfo * | encryptedContentInfo, |
const uint8_t * | key, | ||
size_t | keyLen, | ||
const uint8_t * | plaintext, | ||
size_t | plaintextLen, | ||
uint8_t * | output, | ||
size_t * | written | ||
) |
Format encryptedContentInfo structure.
- Parameters
-
[in] encryptedContentInfo Pointer to the structure to format [in] key Pointer to the encryption key [in] keyLen Length of the encryption key, in bytes [in] plaintext Pointer to the message to be encrypted [in] plaintextLen Length of the message, in bytes [out] output Buffer where to format the ASN.1 structure [out] written Length of the resulting ASN.1 structure
- Returns
- Error code
Definition at line 1689 of file pkcs7_format.c.
◆ pkcs7FormatEncryptedDigest()
error_t pkcs7FormatEncryptedDigest | ( | const PrngAlgo * | prngAlgo, |
void * | prngContext, | ||
const uint8_t * | digest, | ||
const Pkcs7SignerInfo * | signerInfo, | ||
const void * | signerPrivateKey, | ||
uint8_t * | output, | ||
size_t * | written | ||
) |
Format encryptedDigest structure.
- Parameters
-
[in] prngAlgo PRNG algorithm [in] prngContext Pointer to the PRNG context [in] digest Message digest [in] signerInfo Pointer to the signer information [in] signerPrivateKey Pointer to the signer's private key [out] output Buffer where to format the ASN.1 structure [out] written Length of the resulting ASN.1 structure
- Returns
- Error code
Definition at line 1215 of file pkcs7_format.c.
◆ pkcs7FormatEncryptedKey()
error_t pkcs7FormatEncryptedKey | ( | const PrngAlgo * | prngAlgo, |
void * | prngContext, | ||
const X509CertInfo * | recipientCertInfo, | ||
const uint8_t * | key, | ||
size_t | keyLen, | ||
uint8_t * | output, | ||
size_t * | written | ||
) |
Format encryptedKey structure.
- Parameters
-
[in] prngAlgo PRNG algorithm [in] prngContext Pointer to the PRNG context [in] recipientCertInfo Recipient's certificate [in] key Pointer to the encryption key [in] keyLen Length of the encryption key, in bytes [out] output Buffer where to format the ASN.1 structure [out] written Length of the resulting ASN.1 structure
- Returns
- Error code
Definition at line 1641 of file pkcs7_format.c.
◆ pkcs7FormatEnvelopedData()
error_t pkcs7FormatEnvelopedData | ( | const PrngAlgo * | prngAlgo, |
void * | prngContext, | ||
const X509CertInfo * | recipientCertInfo, | ||
const Pkcs7EnvelopedData * | envelopedData, | ||
const uint8_t * | plaintext, | ||
size_t | plaintextLen, | ||
uint8_t * | output, | ||
size_t * | written | ||
) |
Format enveloped-data content.
- Parameters
-
[in] prngAlgo PRNG algorithm [in] prngContext Pointer to the PRNG context [in] recipientCertInfo Recipient's certificate [in] envelopedData Pointer to the structure to format [in] plaintext Pointer to the message to be encrypted [in] plaintextLen Length of the message, in bytes [out] output Buffer where to format the ASN.1 structure [out] written Length of the resulting ASN.1 structure
- Returns
- Error code
Definition at line 349 of file pkcs7_format.c.
◆ pkcs7FormatIssuerAndSerialNumber()
error_t pkcs7FormatIssuerAndSerialNumber | ( | const Pkcs7IssuerAndSerialNumber * | issuerAndSerialNumber, |
uint8_t * | output, | ||
size_t * | written | ||
) |
Format IssuerAndSerialNumber structure.
- Parameters
-
[in] issuerAndSerialNumber Pointer to the structure to format [out] output Buffer where to format the ASN.1 structure [out] written Length of the resulting ASN.1 structure
- Returns
- Error code
Definition at line 899 of file pkcs7_format.c.
◆ pkcs7FormatRecipientInfo()
error_t pkcs7FormatRecipientInfo | ( | const PrngAlgo * | prngAlgo, |
void * | prngContext, | ||
const Pkcs7RecipientInfo * | recipientInfo, | ||
const X509CertInfo * | recipientCertInfo, | ||
const uint8_t * | key, | ||
size_t | keyLen, | ||
uint8_t * | output, | ||
size_t * | written | ||
) |
Format RecipientInfo structure.
- Parameters
-
[in] prngAlgo PRNG algorithm [in] prngContext Pointer to the PRNG context [in] recipientInfo Pointer to the structure to format [in] recipientCertInfo Recipient's certificate [in] key Pointer to the encryption key [in] keyLen Length of the encryption key, in bytes [out] output Buffer where to format the ASN.1 structure [out] written Length of the resulting ASN.1 structure
- Returns
- Error code
Definition at line 1552 of file pkcs7_format.c.
◆ pkcs7FormatRecipientInfos()
error_t pkcs7FormatRecipientInfos | ( | const PrngAlgo * | prngAlgo, |
void * | prngContext, | ||
const Pkcs7RecipientInfos * | recipientInfos, | ||
const X509CertInfo * | recipientCertInfo, | ||
const uint8_t * | key, | ||
size_t | keyLen, | ||
uint8_t * | output, | ||
size_t * | written | ||
) |
Format recipientInfos structure.
- Parameters
-
[in] prngAlgo PRNG algorithm [in] prngContext Pointer to the PRNG context [in] recipientInfos Pointer to the structure to format [in] recipientCertInfo Recipient's certificate [in] key Pointer to the encryption key [in] keyLen Length of the encryption key, in bytes [out] output Buffer where to format the ASN.1 structure [out] written Length of the resulting ASN.1 structure
- Returns
- Error code
Definition at line 1486 of file pkcs7_format.c.
◆ pkcs7FormatSignedData()
error_t pkcs7FormatSignedData | ( | const PrngAlgo * | prngAlgo, |
void * | prngContext, | ||
const Pkcs7SignedData * | signedData, | ||
const void * | signerPrivateKey, | ||
uint8_t * | output, | ||
size_t * | written | ||
) |
Format signed-data content.
- Parameters
-
[in] prngAlgo PRNG algorithm [in] prngContext Pointer to the PRNG context [in] signedData Pointer to the structure to format [in] signerPrivateKey Pointer to the signer's private key [out] output Buffer where to format the ASN.1 structure [out] written Length of the resulting ASN.1 structure
- Returns
- Error code
Definition at line 205 of file pkcs7_format.c.
◆ pkcs7FormatSignerInfo()
error_t pkcs7FormatSignerInfo | ( | const PrngAlgo * | prngAlgo, |
void * | prngContext, | ||
const Pkcs7SignerInfo * | signerInfo, | ||
const void * | signerPrivateKey, | ||
uint8_t * | output, | ||
size_t * | written | ||
) |
Format SignerInfo structure.
- Parameters
-
[in] prngAlgo PRNG algorithm [in] prngContext Pointer to the PRNG context [in] signerInfo Pointer to the structure to format [in] signerPrivateKey Pointer to the signer's private key [out] output Buffer where to format the ASN.1 structure [out] written Length of the resulting ASN.1 structure
- Returns
- Error code
Definition at line 761 of file pkcs7_format.c.
◆ pkcs7FormatSignerInfos()
error_t pkcs7FormatSignerInfos | ( | const PrngAlgo * | prngAlgo, |
void * | prngContext, | ||
const Pkcs7SignerInfos * | signerInfos, | ||
const void * | signerPrivateKey, | ||
uint8_t * | output, | ||
size_t * | written | ||
) |
Format SignerInfos structure.
- Parameters
-
[in] prngAlgo PRNG algorithm [in] prngContext Pointer to the PRNG context [in] signerInfos Pointer to the structure to format [in] signerPrivateKey Pointer to the signer's private key [out] output Buffer where to format the ASN.1 structure [out] written Length of the resulting ASN.1 structure
- Returns
- Error code
Definition at line 697 of file pkcs7_format.c.
◆ pkcs7FormatUnauthenticatedAttributes()
error_t pkcs7FormatUnauthenticatedAttributes | ( | const Pkcs7UnauthenticatedAttributes * | unauthenticatedAttributes, |
uint8_t * | output, | ||
size_t * | written | ||
) |
Format unauthenticatedAttributes structure.
- Parameters
-
[in] unauthenticatedAttributes Pointer to the structure to format [out] output Buffer where to format the ASN.1 structure [out] written Length of the resulting ASN.1 structure
- Returns
- Error code
Definition at line 1260 of file pkcs7_format.c.