pkcs5_common.c File Reference

PKCS #5 common definitions. More...

#include "core/crypto.h"
#include "pkix/pkcs5_common.h"
#include "encoding/oid.h"
#include "cipher/cipher_algorithms.h"
#include "mac/hmac.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   CRYPTO_TRACE_LEVEL
 

Functions

const HashAlgopkcs5GetPbes1HashAlgo (const uint8_t *oid, size_t length)
 Get the hash algorithm to be used for PBES1 operation. More...
 
const HashAlgopkcs5GetPbes2HashAlgo (const uint8_t *oid, size_t length)
 Get the hash algorithm to be used for PBES2 operation. More...
 
const CipherAlgopkcs5GetPbes1CipherAlgo (const uint8_t *oid, size_t length)
 Get the cipher algorithm to be used for PBES1 operation. More...
 
const CipherAlgopkcs5GetPbes2CipherAlgo (const uint8_t *oid, size_t length)
 Get the cipher algorithm to be used for PBES2 operation. More...
 
uint_t pkcs5GetPbes2KeyLength (const uint8_t *oid, size_t length)
 Get the encryption key length to be used for PBES2 operation. More...
 

Variables

const uint8_t PBE_WITH_MD2_AND_DES_CBC_OID [9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x05, 0x01}
 
const uint8_t PBE_WITH_MD5_AND_DES_CBC_OID [9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x05, 0x03}
 
const uint8_t PBE_WITH_MD2_AND_RC2_CBC_OID [9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x05, 0x04}
 
const uint8_t PBE_WITH_MD5_AND_RC2_CBC_OID [9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x05, 0x06}
 
const uint8_t PBE_WITH_SHA1_AND_DES_CBC_OID [9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x05, 0x0A}
 
const uint8_t PBE_WITH_SHA1_AND_RC2_CBC_OID [9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x05, 0x0B}
 
const uint8_t PBES2_OID [9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x05, 0x0D}
 

Detailed Description

PKCS #5 common definitions.

License

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

Copyright (C) 2010-2024 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.4.0

Definition in file pkcs5_common.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   CRYPTO_TRACE_LEVEL

Definition at line 32 of file pkcs5_common.c.

Function Documentation

◆ pkcs5GetPbes1CipherAlgo()

const CipherAlgo* pkcs5GetPbes1CipherAlgo ( const uint8_t *  oid,
size_t  length 
)

Get the cipher algorithm to be used for PBES1 operation.

Parameters
[in]oidEncryption algorithm identifier
[in]lengthLength of the encryption algorithm identifier, in bytes
Returns
Cipher algorithm

Definition at line 222 of file pkcs5_common.c.

◆ pkcs5GetPbes1HashAlgo()

const HashAlgo* pkcs5GetPbes1HashAlgo ( const uint8_t *  oid,
size_t  length 
)

Get the hash algorithm to be used for PBES1 operation.

Parameters
[in]oidEncryption algorithm identifier
[in]lengthLength of the encryption algorithm identifier, in bytes
Returns
Hash algorithm

Definition at line 69 of file pkcs5_common.c.

◆ pkcs5GetPbes2CipherAlgo()

const CipherAlgo* pkcs5GetPbes2CipherAlgo ( const uint8_t *  oid,
size_t  length 
)

Get the cipher algorithm to be used for PBES2 operation.

Parameters
[in]oidEncryption algorithm identifier
[in]lengthLength of the encryption algorithm identifier, in bytes
Returns
Cipher algorithm

Definition at line 285 of file pkcs5_common.c.

◆ pkcs5GetPbes2HashAlgo()

const HashAlgo* pkcs5GetPbes2HashAlgo ( const uint8_t *  oid,
size_t  length 
)

Get the hash algorithm to be used for PBES2 operation.

Parameters
[in]oidKDF algorithm identifier
[in]lengthLength of the KDF algorithm identifier, in bytes
Returns
Hash algorithm

Definition at line 135 of file pkcs5_common.c.

◆ pkcs5GetPbes2KeyLength()

uint_t pkcs5GetPbes2KeyLength ( const uint8_t *  oid,
size_t  length 
)

Get the encryption key length to be used for PBES2 operation.

Parameters
[in]oidEncryption algorithm identifier
[in]lengthLength of the encryption algorithm identifier, in bytes
Returns
Encryption key length

Definition at line 384 of file pkcs5_common.c.

Variable Documentation

◆ PBE_WITH_MD2_AND_DES_CBC_OID

const uint8_t PBE_WITH_MD2_AND_DES_CBC_OID[9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x05, 0x01}

Definition at line 46 of file pkcs5_common.c.

◆ PBE_WITH_MD2_AND_RC2_CBC_OID

const uint8_t PBE_WITH_MD2_AND_RC2_CBC_OID[9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x05, 0x04}

Definition at line 50 of file pkcs5_common.c.

◆ PBE_WITH_MD5_AND_DES_CBC_OID

const uint8_t PBE_WITH_MD5_AND_DES_CBC_OID[9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x05, 0x03}

Definition at line 48 of file pkcs5_common.c.

◆ PBE_WITH_MD5_AND_RC2_CBC_OID

const uint8_t PBE_WITH_MD5_AND_RC2_CBC_OID[9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x05, 0x06}

Definition at line 52 of file pkcs5_common.c.

◆ PBE_WITH_SHA1_AND_DES_CBC_OID

const uint8_t PBE_WITH_SHA1_AND_DES_CBC_OID[9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x05, 0x0A}

Definition at line 54 of file pkcs5_common.c.

◆ PBE_WITH_SHA1_AND_RC2_CBC_OID

const uint8_t PBE_WITH_SHA1_AND_RC2_CBC_OID[9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x05, 0x0B}

Definition at line 56 of file pkcs5_common.c.

◆ PBES2_OID

const uint8_t PBES2_OID[9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x05, 0x0D}

Definition at line 59 of file pkcs5_common.c.