pkcs7_encrypt.h File Reference

PKCS #7 message encryption. More...

#include "core/crypto.h"
#include "pkcs7/pkcs7_common.h"

Go to the source code of this file.

Functions

error_t pkcs7EncryptEnvelopedData (const PrngAlgo *prngAlgo, void *prngContext, const X509CertInfo *recipientCertInfo, const Pkcs7ContentEncrAlgo *contentEncrAlgo, const uint8_t *plaintext, size_t plaintextLen, uint8_t *output, size_t *written)
 Encrypt enveloped-data content. More...
 
error_t pkcs7EncryptKey (const PrngAlgo *prngAlgo, void *prngContext, const X509CertInfo *recipientCertInfo, const uint8_t *plaintext, size_t plaintextLen, uint8_t *ciphertext, size_t *ciphertextLen)
 Perform key encryption. More...
 
error_t pkcs7EncryptData (const Pkcs7EncryptedContentInfo *encryptedContentInfo, const uint8_t *key, size_t keyLen, const uint8_t *plaintext, size_t plaintextLen, uint8_t *ciphertext, size_t *ciphertextLen)
 Perform data encryption. More...
 

Detailed Description

PKCS #7 message encryption.

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_encrypt.h.

Function Documentation

◆ pkcs7EncryptData()

error_t pkcs7EncryptData ( const Pkcs7EncryptedContentInfo encryptedContentInfo,
const uint8_t *  key,
size_t  keyLen,
const uint8_t *  plaintext,
size_t  plaintextLen,
uint8_t *  ciphertext,
size_t *  ciphertextLen 
)

Perform data encryption.

Parameters
[in]encryptedContentInfoPointer to the encryptedContentInfo structure
[in]keyPointer to the encryption key
[in]keyLenLength of the encryption key, in bytes
[in]plaintextPointer to the plaintext data to be encrypted
[in]plaintextLenLength of the plaintext, in bytes
[out]ciphertextCiphertext resulting from the encryption operation
[out]ciphertextLenLength of the resulting ciphertext
Returns
Error code

Definition at line 183 of file pkcs7_encrypt.c.

◆ pkcs7EncryptEnvelopedData()

error_t pkcs7EncryptEnvelopedData ( const PrngAlgo prngAlgo,
void *  prngContext,
const X509CertInfo recipientCertInfo,
const Pkcs7ContentEncrAlgo contentEncrAlgo,
const uint8_t *  plaintext,
size_t  plaintextLen,
uint8_t *  output,
size_t *  written 
)

Encrypt enveloped-data content.

Parameters
[in]prngAlgoPRNG algorithm
[in]prngContextPointer to the PRNG context
[in]recipientCertInfoRecipient's certificate
[in]contentEncrAlgoContent encryption algorithm
[in]plaintextPointer to the message to be encrypted
[in]plaintextLenLength of the message, in bytes
[out]outputBuffer where to format the ASN.1 structure
[out]writtenLength of the resulting ASN.1 structure
Returns
Error code

Definition at line 60 of file pkcs7_encrypt.c.

◆ pkcs7EncryptKey()

error_t pkcs7EncryptKey ( const PrngAlgo prngAlgo,
void *  prngContext,
const X509CertInfo recipientCertInfo,
const uint8_t *  plaintext,
size_t  plaintextLen,
uint8_t *  ciphertext,
size_t *  ciphertextLen 
)

Perform key encryption.

Parameters
[in]prngAlgoPRNG algorithm
[in]prngContextPointer to the PRNG context
[in]recipientCertInfoRecipient's certificate
[in]plaintextPointer to the key to be encrypted
[in]plaintextLenLength of the key, in bytes
[out]ciphertextCiphertext resulting from the encryption operation
[out]ciphertextLenLength of the resulting ciphertext
Returns
Error code

Definition at line 126 of file pkcs7_encrypt.c.