pkcs5_decrypt.h
Go to the documentation of this file.
1 /**
2  * @file pkcs5_decrypt.h
3  * @brief PKCS #5 decryption routines
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneCRYPTO Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.0
29  **/
30 
31 #ifndef _PKCS5_DECRYPT_H
32 #define _PKCS5_DECRYPT_H
33 
34 //Dependencies
35 #include "core/crypto.h"
36 #include "pkix/x509_common.h"
37 #include "pkix/pkcs5_common.h"
38 
39 //C++ guard
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 //PKCS #5 related functions
45 error_t pkcs5Decrypt(const X509AlgoId *encryptionAlgoId,
46  const char_t *password, const uint8_t *ciphertext, size_t ciphertextLen,
47  uint8_t *plaintext, size_t *plaintextLen);
48 
49 error_t pkcs5DecryptPbes1(const X509AlgoId *encryptionAlgoId,
50  const char_t *password, const uint8_t *ciphertext, size_t ciphertextLen,
51  uint8_t *plaintext, size_t *plaintextLen);
52 
53 error_t pkcs5DecryptPbes2(const X509AlgoId *encryptionAlgoId,
54  const char_t *password, const uint8_t *ciphertext, size_t ciphertextLen,
55  uint8_t *plaintext, size_t *plaintextLen);
56 
57 error_t pkcs5ParsePbes1Params(const uint8_t *data, size_t length,
58  Pkcs5Pbes1Params *pbes1Params);
59 
60 error_t pkcs5ParsePbes2Params(const uint8_t *data, size_t length,
61  Pkcs5Pbes2Params *pbes2Params);
62 
63 error_t pkcs5ParseKeyDerivationFunc(const uint8_t *data, size_t length,
64  size_t *totalLength, Pkcs5KeyDerivationFunc *keyDerivationFunc);
65 
66 error_t pkcs5ParsePbkdf2Params(const uint8_t *data, size_t length,
67  Pkcs5KeyDerivationFunc *keyDerivationFunc);
68 
69 error_t pkcs5ParseEncryptionScheme(const uint8_t *data, size_t length,
70  size_t *totalLength, Pkcs5EncryptionScheme *encryptionScheme);
71 
72 //C++ guard
73 #ifdef __cplusplus
74 }
75 #endif
76 
77 #endif
char char_t
Definition: compiler_port.h:48
General definitions for cryptographic algorithms.
error_t
Error codes.
Definition: error.h:43
uint8_t data[]
Definition: ethernet.h:222
uint16_t totalLength
Definition: ipv4.h:292
PKCS #5 common definitions.
error_t pkcs5DecryptPbes2(const X509AlgoId *encryptionAlgoId, const char_t *password, const uint8_t *ciphertext, size_t ciphertextLen, uint8_t *plaintext, size_t *plaintextLen)
PBES2 decryption operation.
error_t pkcs5ParseKeyDerivationFunc(const uint8_t *data, size_t length, size_t *totalLength, Pkcs5KeyDerivationFunc *keyDerivationFunc)
Parse KeyDerivationFunc structure.
error_t pkcs5DecryptPbes1(const X509AlgoId *encryptionAlgoId, const char_t *password, const uint8_t *ciphertext, size_t ciphertextLen, uint8_t *plaintext, size_t *plaintextLen)
PBES1 decryption operation.
error_t pkcs5ParsePbes1Params(const uint8_t *data, size_t length, Pkcs5Pbes1Params *pbes1Params)
Parse PBES1 parameters.
error_t pkcs5ParsePbkdf2Params(const uint8_t *data, size_t length, Pkcs5KeyDerivationFunc *keyDerivationFunc)
Parse PBKDF2 parameters.
error_t pkcs5ParsePbes2Params(const uint8_t *data, size_t length, Pkcs5Pbes2Params *pbes2Params)
Parse PBES2 parameters.
error_t pkcs5ParseEncryptionScheme(const uint8_t *data, size_t length, size_t *totalLength, Pkcs5EncryptionScheme *encryptionScheme)
Parse EncryptionScheme structure.
error_t pkcs5Decrypt(const X509AlgoId *encryptionAlgoId, const char_t *password, const uint8_t *ciphertext, size_t ciphertextLen, uint8_t *plaintext, size_t *plaintextLen)
PKCS #5 decryption operation.
Definition: pkcs5_decrypt.c:61
Encryption scheme.
Definition: pkcs5_common.h:203
Key derivation function.
Definition: pkcs5_common.h:189
PBES1 parameters.
Definition: pkcs5_common.h:178
PBES2 parameters.
Definition: pkcs5_common.h:214
Algorithm identifier.
Definition: x509_common.h:719
uint8_t length
Definition: tcp.h:368
X.509 common definitions.