Go to the documentation of this file.
31 #ifndef _PEM_DECRYPT_H
32 #define _PEM_DECRYPT_H
39 #ifndef PEM_ENCRYPTED_KEY_SUPPORT
40 #define PEM_ENCRYPTED_KEY_SUPPORT DISABLED
41 #elif (PEM_ENCRYPTED_KEY_SUPPORT != ENABLED && PEM_ENCRYPTED_KEY_SUPPORT != DISABLED)
42 #error PEM_ENCRYPTED_KEY_SUPPORT parameter is not valid
46 #ifndef PEM_DES_SUPPORT
47 #define PEM_DES_SUPPORT DISABLED
48 #elif (PEM_DES_SUPPORT != ENABLED && PEM_DES_SUPPORT != DISABLED)
49 #error PEM_DES_SUPPORT parameter is not valid
53 #ifndef PEM_3DES_SUPPORT
54 #define PEM_3DES_SUPPORT DISABLED
55 #elif (PEM_3DES_SUPPORT != ENABLED && PEM_3DES_SUPPORT != DISABLED)
56 #error PEM_3DES_SUPPORT parameter is not valid
60 #ifndef PEM_AES_SUPPORT
61 #define PEM_AES_SUPPORT ENABLED
62 #elif (PEM_AES_SUPPORT != ENABLED && PEM_AES_SUPPORT != DISABLED)
63 #error PEM_AES_SUPPORT parameter is not valid
67 #ifndef PEM_CAMELLIA_SUPPORT
68 #define PEM_CAMELLIA_SUPPORT DISABLED
69 #elif (PEM_CAMELLIA_SUPPORT != ENABLED && PEM_CAMELLIA_SUPPORT != DISABLED)
70 #error PEM_CAMELLIA_SUPPORT parameter is not valid
74 #ifndef PEM_ARIA_SUPPORT
75 #define PEM_ARIA_SUPPORT DISABLED
76 #elif (PEM_ARIA_SUPPORT != ENABLED && PEM_ARIA_SUPPORT != DISABLED)
77 #error PEM_ARIA_SUPPORT parameter is not valid
81 #ifndef PEM_SM4_SUPPORT
82 #define PEM_SM4_SUPPORT DISABLED
83 #elif (PEM_SM4_SUPPORT != ENABLED && PEM_SM4_SUPPORT != DISABLED)
84 #error PEM_SM4_SUPPORT parameter is not valid
94 const char_t *password,
char_t *output,
size_t *outputLen);
97 const uint8_t *ciphertext,
size_t ciphertextLen, uint8_t *plaintext,
98 size_t *plaintextLen);
103 uint8_t *dk,
size_t dkLen);
const CipherAlgo * pemGetCipherAlgo(const PemString *algo)
Get the cipher algorithm to be used for PEM encryption/decryption.
error_t pemFormatIv(const PemHeader *header, uint8_t *iv, size_t ivLen)
Extract the IV from the PEM encapsulated header.
error_t pemDecryptPrivateKey(const char_t *input, size_t inputLen, const char_t *password, char_t *output, size_t *outputLen)
PEM private key decryption.
General definitions for cryptographic algorithms.
error_t pemKdf(const char_t *p, size_t pLen, const uint8_t *s, size_t sLen, uint8_t *dk, size_t dkLen)
Key derivation function.
Common interface for encryption algorithms.
error_t pemDecryptMessage(const PemHeader *header, const char_t *password, const uint8_t *ciphertext, size_t ciphertextLen, uint8_t *plaintext, size_t *plaintextLen)
PEM message decryption.
uint_t pemGetKeyLength(const PemString *algo)
Get the encryption key length to be used for PEM encryption/decryption.