PKCS #7 message encryption. More...
#include "core/crypto.h"
#include "pkcs7/pkcs7_format.h"
#include "pkcs7/pkcs7_encrypt.h"
#include "cipher/cipher_algorithms.h"
#include "cipher_modes/cbc.h"
#include "pkix/x509_key_parse.h"
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | TRACE_LEVEL CRYPTO_TRACE_LEVEL |
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.
- Version
- 2.5.2
Definition in file pkcs7_encrypt.c.
Macro Definition Documentation
◆ TRACE_LEVEL
#define TRACE_LEVEL CRYPTO_TRACE_LEVEL |
Definition at line 32 of file pkcs7_encrypt.c.
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] encryptedContentInfo Pointer to the encryptedContentInfo structure [in] key Pointer to the encryption key [in] keyLen Length of the encryption key, in bytes [in] plaintext Pointer to the plaintext data to be encrypted [in] plaintextLen Length of the plaintext, in bytes [out] ciphertext Ciphertext resulting from the encryption operation [out] ciphertextLen Length 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] prngAlgo PRNG algorithm [in] prngContext Pointer to the PRNG context [in] recipientCertInfo Recipient's certificate [in] contentEncrAlgo Content encryption algorithm [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 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] prngAlgo PRNG algorithm [in] prngContext Pointer to the PRNG context [in] recipientCertInfo Recipient's certificate [in] plaintext Pointer to the key to be encrypted [in] plaintextLen Length of the key, in bytes [out] ciphertext Ciphertext resulting from the encryption operation [out] ciphertextLen Length of the resulting ciphertext
- Returns
- Error code
Definition at line 126 of file pkcs7_encrypt.c.