]>
git.saurik.com Git - apple/security.git/blob - libsecurity_ocspd/common/ocspdUtils.h
2 * Copyright (c) 2002,2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
24 * ocspUtils.h - common utilities for OCSPD
26 #ifndef _OCSPD_UTILS_H_
27 #define _OCSPD_UTILS_H_
33 #include <CommonCrypto/CommonDigest.h>
34 #include <Security/cssmtype.h>
35 #include <CoreFoundation/CoreFoundation.h>
38 * Compare two CSSM_DATAs, return CSSM_TRUE if identical.
40 CSSM_BOOL
ocspdCompareCssmData(
41 const CSSM_DATA
*data1
,
42 const CSSM_DATA
*data2
);
45 * Parse a GeneralizedTime string into a CFAbsoluteTime. Returns NULL_TIME on
46 * parse error. Fractional parts of a second are discarded.
50 CFAbsoluteTime
genTimeToCFAbsTime(
51 const CSSM_DATA
*strData
);
54 * Convert CFAbsoluteTime to generalized time string, GMT format (4 digit year,
55 * trailing 'Z'). Caller allocated the output which is GENERAL_TIME_STRLEN bytes plus
58 #define GENERAL_TIME_STRLEN 15 /* NOT including trailing NULL */
60 void cfAbsTimeToGgenTime(
61 CFAbsoluteTime absTime
,
64 #define OCSPD_MAX_DIGEST_LEN CC_SHA256_DIGEST_LENGTH
69 unsigned char *md
); // allocd by caller, CC_SHA1_DIGEST_LENGTH bytes
73 unsigned char *md
); // allocd by caller, CC_MD5_DIGEST_LENGTH bytes
77 unsigned char *md
); // allocd by caller, CC_MD4_DIGEST_LENGTH bytes
81 unsigned char *md
); // allocd by caller, CC_SHA256_DIGEST_LENGTH bytes
84 * How many items in a NULL-terminated array of pointers?
86 unsigned ocspdArraySize(
89 #define CFRELEASE(cf) \
98 #endif /* _OCSPD_UTILS_H_ */