PolarSSL v1.2.10
pkcs5.h
Go to the documentation of this file.
1 
29 #ifndef POLARSSL_PKCS5_H
30 #define POLARSSL_PKCS5_H
31 
32 #include <string.h>
33 
34 #include "asn1.h"
35 #include "md.h"
36 
37 #ifdef _MSC_VER
38 #include <basetsd.h>
39 typedef UINT32 uint32_t;
40 #else
41 #include <inttypes.h>
42 #endif
43 
44 #define POLARSSL_ERR_PKCS5_BAD_INPUT_DATA -0x3f80
45 #define POLARSSL_ERR_PKCS5_INVALID_FORMAT -0x3f00
46 #define POLARSSL_ERR_PKCS5_FEATURE_UNAVAILABLE -0x3e80
47 #define POLARSSL_ERR_PKCS5_PASSWORD_MISMATCH -0x3e00
49 #define PKCS5_DECRYPT 0
50 #define PKCS5_ENCRYPT 1
51 
52 /*
53  * PKCS#5 OIDs
54  */
55 #define OID_PKCS5 "\x2a\x86\x48\x86\xf7\x0d\x01\x05"
56 #define OID_PKCS5_PBES2 OID_PKCS5 "\x0d"
57 #define OID_PKCS5_PBKDF2 OID_PKCS5 "\x0c"
58 
59 /*
60  * Encryption Algorithm OIDs
61  */
62 #define OID_DES_CBC "\x2b\x0e\x03\x02\x07"
63 #define OID_DES_EDE3_CBC "\x2a\x86\x48\x86\xf7\x0d\x03\x07"
64 
65 /*
66  * Digest Algorithm OIDs
67  */
68 #define OID_HMAC_SHA1 "\x2a\x86\x48\x86\xf7\x0d\x02\x07"
69 
70 #ifdef __cplusplus
71 extern "C" {
72 #endif
73 
87 int pkcs5_pbes2( asn1_buf *pbe_params, int mode,
88  const unsigned char *pwd, size_t pwdlen,
89  const unsigned char *data, size_t datalen,
90  unsigned char *output );
91 
106 int pkcs5_pbkdf2_hmac( md_context_t *ctx, const unsigned char *password,
107  size_t plen, const unsigned char *salt, size_t slen,
108  unsigned int iteration_count,
109  uint32_t key_length, unsigned char *output );
110 
116 int pkcs5_self_test( int verbose );
117 
118 #ifdef __cplusplus
119 }
120 #endif
121 
122 #endif /* pkcs5.h */
int pkcs5_self_test(int verbose)
Checkup routine.
int pkcs5_pbkdf2_hmac(md_context_t *ctx, const unsigned char *password, size_t plen, const unsigned char *salt, size_t slen, unsigned int iteration_count, uint32_t key_length, unsigned char *output)
PKCS#5 PBKDF2 using HMAC.
Generic ASN.1 parsing.
int pkcs5_pbes2(asn1_buf *pbe_params, int mode, const unsigned char *pwd, size_t pwdlen, const unsigned char *data, size_t datalen, unsigned char *output)
PKCS#5 PBES2 function.
Generic message digest wrapper.
Type-length-value structure that allows for ASN1 using DER.
Definition: asn1.h:108
Generic message digest context.
Definition: md.h:119