Mbed TLS v3.6.3
pkcs12.h
Go to the documentation of this file.
1 
6 /*
7  * Copyright The Mbed TLS Contributors
8  * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
9  */
10 #ifndef MBEDTLS_PKCS12_H
11 #define MBEDTLS_PKCS12_H
12 
13 #include "mbedtls/build_info.h"
14 
15 #include "mbedtls/md.h"
16 #include "mbedtls/cipher.h"
17 #include "mbedtls/asn1.h"
18 
19 #include <stddef.h>
20 
22 #define MBEDTLS_ERR_PKCS12_BAD_INPUT_DATA -0x1F80
24 #define MBEDTLS_ERR_PKCS12_FEATURE_UNAVAILABLE -0x1F00
26 #define MBEDTLS_ERR_PKCS12_PBE_INVALID_FORMAT -0x1E80
28 #define MBEDTLS_ERR_PKCS12_PASSWORD_MISMATCH -0x1E00
29 
30 #define MBEDTLS_PKCS12_DERIVE_KEY 1
31 #define MBEDTLS_PKCS12_DERIVE_IV 2
32 #define MBEDTLS_PKCS12_DERIVE_MAC_KEY 3
34 #define MBEDTLS_PKCS12_PBE_DECRYPT MBEDTLS_DECRYPT
35 #define MBEDTLS_PKCS12_PBE_ENCRYPT MBEDTLS_ENCRYPT
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 #if defined(MBEDTLS_ASN1_PARSE_C) && defined(MBEDTLS_CIPHER_C)
42 
43 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
90  mbedtls_cipher_type_t cipher_type,
91  mbedtls_md_type_t md_type,
92  const unsigned char *pwd, size_t pwdlen,
93  const unsigned char *data, size_t len,
94  unsigned char *output);
95 #endif /* MBEDTLS_DEPRECATED_REMOVED */
96 
97 #if defined(MBEDTLS_CIPHER_PADDING_PKCS7)
98 
139 int mbedtls_pkcs12_pbe_ext(mbedtls_asn1_buf *pbe_params, int mode,
140  mbedtls_cipher_type_t cipher_type, mbedtls_md_type_t md_type,
141  const unsigned char *pwd, size_t pwdlen,
142  const unsigned char *data, size_t len,
143  unsigned char *output, size_t output_size,
144  size_t *output_len);
145 
146 #endif /* MBEDTLS_CIPHER_PADDING_PKCS7 */
147 
148 #endif /* MBEDTLS_ASN1_PARSE_C && MBEDTLS_CIPHER_C */
149 
177 int mbedtls_pkcs12_derivation(unsigned char *data, size_t datalen,
178  const unsigned char *pwd, size_t pwdlen,
179  const unsigned char *salt, size_t saltlen,
180  mbedtls_md_type_t mbedtls_md, int id, int iterations);
181 
182 #ifdef __cplusplus
183 }
184 #endif
185 
186 #endif /* pkcs12.h */
Generic ASN.1 parsing.
This file contains an abstraction interface for use with the cipher primitives provided by the librar...
mbedtls_cipher_type_t
Supported {cipher type, cipher mode} pairs.
Definition: cipher.h:84
Build-time configuration info.
This file contains the generic functions for message-digest (hashing) and HMAC.
mbedtls_md_type_t
Supported message digests.
Definition: md.h:47
int mbedtls_md(const mbedtls_md_info_t *md_info, const unsigned char *input, size_t ilen, unsigned char *output)
This function calculates the message-digest of a buffer, with respect to a configurable message-diges...
int mbedtls_pkcs12_derivation(unsigned char *data, size_t datalen, const unsigned char *pwd, size_t pwdlen, const unsigned char *salt, size_t saltlen, mbedtls_md_type_t mbedtls_md, int id, int iterations)
The PKCS#12 derivation function uses a password and a salt to produce pseudo-random bits for a partic...
int MBEDTLS_DEPRECATED mbedtls_pkcs12_pbe(mbedtls_asn1_buf *pbe_params, int mode, mbedtls_cipher_type_t cipher_type, mbedtls_md_type_t md_type, const unsigned char *pwd, size_t pwdlen, const unsigned char *data, size_t len, unsigned char *output)
PKCS12 Password Based function (encryption / decryption) for cipher-based and mbedtls_md-based PBE's.
int mbedtls_pkcs12_pbe_ext(mbedtls_asn1_buf *pbe_params, int mode, mbedtls_cipher_type_t cipher_type, mbedtls_md_type_t md_type, const unsigned char *pwd, size_t pwdlen, const unsigned char *data, size_t len, unsigned char *output, size_t output_size, size_t *output_len)
PKCS12 Password Based function (encryption / decryption) for cipher-based and mbedtls_md-based PBE's.
#define MBEDTLS_DEPRECATED
Definition: platform_util.h:37