Commit | Line | Data |
---|---|---|
d8f41ccd A |
1 | /* |
2 | * bsafeUtils.h - common routines for CDSA/BSAFE compatibility testing | |
3 | */ | |
4 | ||
5 | /* | |
6 | * Clients of this module do not need to know about or see anything from the | |
7 | * BSAFE headers. | |
8 | */ | |
9 | #ifndef _BSAFE_UTILS_H_ | |
10 | #define _BSAFE_UTILS_H_ | |
11 | #include <Security/cssmtype.h> | |
12 | ||
13 | #ifdef __cplusplus | |
14 | extern "C" { | |
15 | #endif | |
16 | ||
17 | /* Actually the same as a B_KEY_OBJ, but our callers don't need to know that */ | |
18 | typedef void *BU_KEY; | |
19 | ||
20 | /* | |
21 | * Create a symmetric key. | |
22 | */ | |
23 | CSSM_RETURN buGenSymKey( | |
24 | uint32 keySizeInBits, | |
25 | const CSSM_DATA *keyData, | |
26 | BU_KEY *key); // RETURNED | |
27 | ||
28 | /* | |
29 | * Create asymmetric key pair. | |
30 | * FIXME - additional params (e.g. DSA params, RSA exponent)? | |
31 | */ | |
32 | CSSM_RETURN buGenKeyPair( | |
33 | uint32 keySizeInBits, | |
34 | CSSM_ALGORITHMS keyAlg, // CSSM_ALGID_{RSA,DSA} | |
35 | BU_KEY *pubKey, // RETURNED | |
36 | BU_KEY *privKey); // RETURNED | |
37 | ||
38 | /* | |
39 | * Free a key created in buGenSymKey or buGenKeyPair | |
40 | */ | |
41 | CSSM_RETURN buFreeKey( | |
42 | BU_KEY key); | |
43 | ||
44 | /* | |
45 | * encrypt/decrypt | |
46 | */ | |
47 | CSSM_RETURN buEncryptDecrypt( | |
48 | BU_KEY key, | |
49 | CSSM_BOOL forEncrypt, | |
50 | CSSM_ALGORITHMS encrAlg, | |
51 | CSSM_ENCRYPT_MODE mode, // CSSM_ALGMODE_CBC, etc. | |
52 |