PKCS #7 common definitions. More...
#include "core/crypto.h"
#include "pkcs7/pkcs7_common.h"
#include "hash/hash_algorithms.h"
#include "cipher/cipher_algorithms.h"
#include "pkc/rsa.h"
#include "encoding/asn1.h"
#include "encoding/oid.h"
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | TRACE_LEVEL CRYPTO_TRACE_LEVEL |
Functions | |
const HashAlgo * | pkcs7GetHashAlgo (const uint8_t *oid, size_t length) |
Get the hash algorithm that matches the specified OID. More... | |
const HashAlgo * | pkcs7GetSignHashAlgo (const uint8_t *oid, size_t length) |
Get the signature hash algorithm that matches the specified OID. More... | |
const CipherAlgo * | pkcs7GetCipherAlgo (const uint8_t *oid, size_t length) |
Get the cipher algorithm that matches the specified OID. More... | |
uint_t | pkcs7GetKeyLength (const uint8_t *oid, size_t length) |
Get the encryption key length to be used for PBES2 operation. More... | |
int_t | pkcs7CompAttributes (const uint8_t *attribute1, size_t attributeLen1, const uint8_t *attribute2, size_t attributeLen2) |
Compare attributes. More... | |
error_t | pkcs7DigestAuthenticatedAttributes (const Pkcs7SignerInfo *signerInfo, const uint8_t *data, size_t length, uint8_t *digest) |
Digest the DER encoding of the authenticatedAttributes field. More... | |
Variables | |
const uint8_t | PKCS7_OID [8] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07} |
const uint8_t | PKCS7_DATA_OID [9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x01} |
const uint8_t | PKCS7_SIGNED_DATA_OID [9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x02} |
const uint8_t | PKCS7_ENVELOPED_DATA_OID [9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x03} |
const uint8_t | PKCS7_SIGNED_AND_ENVELOPED_DATA_OID [9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x04} |
const uint8_t | PKCS7_DIGESTED_DATA_OID [9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x05} |
const uint8_t | PKCS7_ENCRYPTED_DATA_OID [9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x06} |
const uint8_t | PKCS9_CONTENT_TYPE_OID [9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x03} |
const uint8_t | PKCS9_MESSAGE_DIGEST_OID [9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x04} |
const uint8_t | PKCS9_SIGNING_TIME_OID [9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x05} |
Detailed Description
PKCS #7 common definitions.
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_common.c.
Macro Definition Documentation
◆ TRACE_LEVEL
#define TRACE_LEVEL CRYPTO_TRACE_LEVEL |
Definition at line 32 of file pkcs7_common.c.
Function Documentation
◆ pkcs7CompAttributes()
int_t pkcs7CompAttributes | ( | const uint8_t * | attribute1, |
size_t | attributeLen1, | ||
const uint8_t * | attribute2, | ||
size_t | attributeLen2 | ||
) |
Compare attributes.
- Parameters
-
[in] attribute1 Pointer to the first attribute [in] attributeLen1 Length of the first attribute [in] attribute2 Pointer to the second attribute [in] attributeLen2 Length of the second attribute
- Return values
-
0 Attributes are equal -1 The first attribute precedes the second attribute 1 The second attribute precedes the first attribute
Definition at line 329 of file pkcs7_common.c.
◆ pkcs7DigestAuthenticatedAttributes()
error_t pkcs7DigestAuthenticatedAttributes | ( | const Pkcs7SignerInfo * | signerInfo, |
const uint8_t * | data, | ||
size_t | length, | ||
uint8_t * | digest | ||
) |
Digest the DER encoding of the authenticatedAttributes field.
- Parameters
-
[in] signerInfo Pointer to the signer information [in] data Content octets of authenticatedAttributes field [in] length Length of the content octets [out] digest Resulting message digest
- Returns
- Error code
Definition at line 382 of file pkcs7_common.c.
◆ pkcs7GetCipherAlgo()
const CipherAlgo* pkcs7GetCipherAlgo | ( | const uint8_t * | oid, |
size_t | length | ||
) |
Get the cipher algorithm that matches the specified OID.
- Parameters
-
[in] oid Algorithm identifier [in] length Length of the algorithm identifier, in bytes
- Returns
- Cipher algorithm
Definition at line 215 of file pkcs7_common.c.
◆ pkcs7GetHashAlgo()
const HashAlgo* pkcs7GetHashAlgo | ( | const uint8_t * | oid, |
size_t | length | ||
) |
Get the hash algorithm that matches the specified OID.
- Parameters
-
[in] oid Algorithm identifier [in] length Length of the algorithm identifier, in bytes
- Returns
- Hash algorithm
Definition at line 77 of file pkcs7_common.c.
◆ pkcs7GetKeyLength()
uint_t pkcs7GetKeyLength | ( | const uint8_t * | oid, |
size_t | length | ||
) |
Get the encryption key length to be used for PBES2 operation.
- Parameters
-
[in] oid Encryption algorithm identifier [in] length Length of the encryption algorithm identifier, in bytes
- Returns
- Encryption key length
Definition at line 270 of file pkcs7_common.c.
◆ pkcs7GetSignHashAlgo()
const HashAlgo* pkcs7GetSignHashAlgo | ( | const uint8_t * | oid, |
size_t | length | ||
) |
Get the signature hash algorithm that matches the specified OID.
- Parameters
-
[in] oid Algorithm identifier [in] length Length of the algorithm identifier, in bytes
- Returns
- Hash algorithm
Definition at line 146 of file pkcs7_common.c.
Variable Documentation
◆ PKCS7_DATA_OID
const uint8_t PKCS7_DATA_OID[9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x01} |
Definition at line 50 of file pkcs7_common.c.
◆ PKCS7_DIGESTED_DATA_OID
const uint8_t PKCS7_DIGESTED_DATA_OID[9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x05} |
Definition at line 58 of file pkcs7_common.c.
◆ PKCS7_ENCRYPTED_DATA_OID
const uint8_t PKCS7_ENCRYPTED_DATA_OID[9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x06} |
Definition at line 60 of file pkcs7_common.c.
◆ PKCS7_ENVELOPED_DATA_OID
const uint8_t PKCS7_ENVELOPED_DATA_OID[9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x03} |
Definition at line 54 of file pkcs7_common.c.
◆ PKCS7_OID
const uint8_t PKCS7_OID[8] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07} |
Definition at line 48 of file pkcs7_common.c.
◆ PKCS7_SIGNED_AND_ENVELOPED_DATA_OID
const uint8_t PKCS7_SIGNED_AND_ENVELOPED_DATA_OID[9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x04} |
Definition at line 56 of file pkcs7_common.c.
◆ PKCS7_SIGNED_DATA_OID
const uint8_t PKCS7_SIGNED_DATA_OID[9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x02} |
Definition at line 52 of file pkcs7_common.c.
◆ PKCS9_CONTENT_TYPE_OID
const uint8_t PKCS9_CONTENT_TYPE_OID[9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x03} |
Definition at line 63 of file pkcs7_common.c.
◆ PKCS9_MESSAGE_DIGEST_OID
const uint8_t PKCS9_MESSAGE_DIGEST_OID[9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x04} |
Definition at line 65 of file pkcs7_common.c.
◆ PKCS9_SIGNING_TIME_OID
const uint8_t PKCS9_SIGNING_TIME_OID[9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x05} |
Definition at line 67 of file pkcs7_common.c.