]> git.saurik.com Git - apple/security.git/blob - SecurityTests/clxutils/p12Parse/pkcs12Utils.h
Security-57336.1.9.tar.gz
[apple/security.git] / SecurityTests / clxutils / p12Parse / pkcs12Utils.h
1 #ifndef _PKCS12_UTILS_H_
2 #define _PKCS12_UTILS_H_
3
4 #include <Security/cssmtype.h>
5 #include <CoreFoundation/CFString.h>
6 #include <security_pkcs12/pkcs12Templates.h>
7
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11
12 /* CSSM_DATA --> uint32. Returns true if OK. */
13 bool p12DataToInt(
14 const CSSM_DATA &cdata,
15 uint32 &u);
16
17 typedef enum {
18 PW_None, /* not comprehended */
19 PW_PKCS5_v1_5, /* PKCS5 v1.5 */
20 PW_PKCS5_v2, /* PKCS5 v2.0, not used by this module but parsed here */
21 PW_PKCS12 /* PKCS12 */
22 } PKCS_Which;
23
24 /* returns false if OID not found */
25 bool pkcsOidToParams(
26 const CSSM_OID *oid,
27 CSSM_ALGORITHMS &keyAlg, // e.g., CSSM_ALGID_DES
28 CSSM_ALGORITHMS &encrAlg, // e.g., CSSM_ALGID_3DES_3KEY_EDE
29 CSSM_ALGORITHMS &pbeHashAlg, // SHA1 or MD5
30 uint32 &keySizeInBits,
31 uint32 &blockSizeInBytes, // for IV, optional
32 CSSM_PADDING &padding, // CSSM_PADDING_PKCS7, etc.
33 CSSM_ENCRYPT_MODE &mode, // CSSM_ALGMODE_CBCPadIV8, etc.
34 PKCS_Which &pkcs); // PW_PKCS5_v1_5 or PW_PKCS12
35
36 const char *p12BagTypeStr(
37 NSS_P12_SB_Type type);
38 const char *p7ContentInfoTypeStr(
39 NSS_P7_CI_Type type);
40
41 #ifdef __cplusplus
42 }
43 #endif
44
45 #endif /* _PKCS12_UTILS_H_ */