1/*
2 * Copyright (c) 2002-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/*
20	File:		 cuDbUtils.h
21
22	Description: CDSA DB access utilities
23
24	Author:		 dmitch
25*/
26
27#ifndef	_CU_DB_UTILS_H_
28#define _CU_DB_UTILS_H_
29
30#include <Security/cssm.h>
31
32#ifdef	__cplusplus
33extern "C" {
34#endif
35
36/*
37 * Add a certificate to an open DLDB.
38 */
39CSSM_RETURN cuAddCertToDb(
40	CSSM_DL_DB_HANDLE	dlDbHand,
41	const CSSM_DATA		*cert,
42	CSSM_CERT_TYPE		certType,
43	CSSM_CERT_ENCODING	certEncoding,
44	const char			*printName,			// C string
45	const CSSM_DATA		*publicKeyHash); 	// ??
46
47/*
48 * Add a CRL to an open DL/DB.
49 */
50CSSM_RETURN cuAddCrlToDb(
51	CSSM_DL_DB_HANDLE	dlDbHand,
52	CSSM_CL_HANDLE		clHand,
53	const CSSM_DATA		*crl,
54	const CSSM_DATA		*URI);				// optional
55
56/*
57 * Search DB for all records of type CRL or cert, calling appropriate
58 * parse/print routine for each record.
59 */
60CSSM_RETURN cuDumpCrlsCerts(
61	CSSM_DL_DB_HANDLE	dlDbHand,
62	CSSM_CL_HANDLE		clHand,
63	CSSM_BOOL			isCert,
64	unsigned			&numItems,		// returned
65	CSSM_BOOL			verbose);
66
67#ifdef	__cplusplus
68}
69#endif
70
71#endif	/* _CU_DB_UTILS_H_ */
72