1/*
2 * Copyright (c) 2003 Apple Computer, Inc. All Rights Reserved.
3 *
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please
7 * obtain a copy of the License at http://www.apple.com/publicsource and
8 * read it before using this file.
9 *
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
12 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
13 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
14 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
15 * Please see the License for the specific language governing rights and
16 * limitations under the License.
17 */
18/*
19 * p12pbe.h - PKCS12 PBE routine. App space reference version.
20 */
21
22#ifndef	_P12_PBE_H_
23#define _P12_PBE_H_
24
25#include <Security/cssmtype.h>
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31/* specify which flavor of bits to generate */
32typedef enum {
33	PBE_ID_Key 	= 1,
34	PBE_ID_IV  	= 2,
35	PBE_ID_Mac	= 3
36} P12_PBE_ID;
37
38/*
39 * PBE generator per PKCS12 v.1 section B.2.
40 */
41CSSM_RETURN p12PbeGen_app(
42	const CSSM_DATA	&pwd,		// unicode, double null terminated
43	const unsigned char *salt,
44	unsigned saltLen,
45	unsigned iterCount,
46	P12_PBE_ID pbeId,
47	CSSM_ALGORITHMS hashAlg,	// MS5 or SHA1 only
48	CSSM_CSP_HANDLE cspHand,
49
50	/* result goes here, mallocd by caller */
51	unsigned char *outbuf,
52	unsigned outbufLen);
53
54#ifdef __cplusplus
55}
56#endif
57
58#endif	/* _P12_PBE_H_ */
59
60