PolarSSL v1.2.9
pkcs12.h
Go to the documentation of this file.
1 
27 #ifndef POLARSSL_PKCS12_H
28 #define POLARSSL_PKCS12_H
29 
30 #include <string.h>
31 
32 #include "md.h"
33 #include "cipher.h"
34 #include "asn1.h"
35 
36 #define POLARSSL_ERR_PKCS12_BAD_INPUT_DATA -0x1F80
37 #define POLARSSL_ERR_PKCS12_FEATURE_UNAVAILABLE -0x1F00
38 #define POLARSSL_ERR_PKCS12_PBE_INVALID_FORMAT -0x1E80
39 #define POLARSSL_ERR_PKCS12_PASSWORD_MISMATCH -0x1E00
41 #define PKCS12_DERIVE_KEY 1 /*< encryption/decryption key */
42 #define PKCS12_DERIVE_IV 2 /*< initialization vector */
43 #define PKCS12_DERIVE_MAC_KEY 3 /*< integrity / MAC key */
44 
45 #define PKCS12_PBE_DECRYPT 0
46 #define PKCS12_PBE_ENCRYPT 1
47 
48 /*
49  * PKCS#12 PBE types
50  */
51 #define OID_PKCS12 "\x2a\x86\x48\x86\xf7\x0d\x01\x0c"
52 #define OID_PKCS12_PBE_SHA1_RC4_128 OID_PKCS12 "\x01\x01"
53 #define OID_PKCS12_PBE_SHA1_DES3_EDE_CBC OID_PKCS12 "\x01\x03"
54 #define OID_PKCS12_PBE_SHA1_DES2_EDE_CBC OID_PKCS12 "\x01\x04"
55 
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59 
74 int pkcs12_pbe_sha1_rc4_128( asn1_buf *pbe_params, int mode,
75  const unsigned char *pwd, size_t pwdlen,
76  const unsigned char *input, size_t len,
77  unsigned char *output );
78 
95 int pkcs12_pbe( asn1_buf *pbe_params, int mode,
96  cipher_type_t cipher_type, md_type_t md_type,
97  const unsigned char *pwd, size_t pwdlen,
98  const unsigned char *input, size_t len,
99  unsigned char *output );
100 
122 int pkcs12_derivation( unsigned char *data, size_t datalen,
123  const unsigned char *pwd, size_t pwdlen,
124  const unsigned char *salt, size_t saltlen,
125  md_type_t md, int id, int iterations );
126 
127 #ifdef __cplusplus
128 }
129 #endif
130 
131 #endif /* pkcs12.h */
int md(const md_info_t *md_info, const unsigned char *input, size_t ilen, unsigned char *output)
Output = message_digest( input buffer )
int pkcs12_pbe(asn1_buf *pbe_params, int mode, cipher_type_t cipher_type, md_type_t md_type, const unsigned char *pwd, size_t pwdlen, const unsigned char *input, size_t len, unsigned char *output)
PKCS12 Password Based function (encryption / decryption) for cipher-based and md-based PBE&#39;s...
md_type_t
Definition: md.h:47
Generic ASN.1 parsing.
cipher_type_t
Definition: cipher.h:59
int pkcs12_derivation(unsigned char *data, size_t datalen, const unsigned char *pwd, size_t pwdlen, const unsigned char *salt, size_t saltlen, md_type_t md, int id, int iterations)
The PKCS#12 derivation function uses a password and a salt to produce pseudo-random bits for a partic...
Generic cipher wrapper.
Generic message digest wrapper.
Type-length-value structure that allows for ASN1 using DER.
Definition: asn1.h:108
int pkcs12_pbe_sha1_rc4_128(asn1_buf *pbe_params, int mode, const unsigned char *pwd, size_t pwdlen, const unsigned char *input, size_t len, unsigned char *output)
PKCS12 Password Based function (encryption / decryption) for pbeWithSHAAnd128BitRC4.