]>
git.saurik.com Git - apple/security.git/blob - Security/libsecurity_ocspd/common/ocspdUtils.h
2 * Copyright (c) 2000,2002,2011,2014 Apple Inc. All Rights Reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
25 * ocspUtils.h - common utilities for OCSPD
27 #ifndef _OCSPD_UTILS_H_
28 #define _OCSPD_UTILS_H_
34 #include <CommonCrypto/CommonDigest.h>
35 #include <Security/cssmtype.h>
36 #include <CoreFoundation/CoreFoundation.h>
39 * Compare two CSSM_DATAs, return CSSM_TRUE if identical.
41 CSSM_BOOL
ocspdCompareCssmData(
42 const CSSM_DATA
*data1
,
43 const CSSM_DATA
*data2
);
46 * Parse a GeneralizedTime string into a CFAbsoluteTime. Returns NULL_TIME on
47 * parse error. Fractional parts of a second are discarded.
51 CFAbsoluteTime
genTimeToCFAbsTime(
52 const CSSM_DATA
*strData
);
55 * Convert CFAbsoluteTime to generalized time string, GMT format (4 digit year,
56 * trailing 'Z'). Caller allocated the output which is GENERAL_TIME_STRLEN bytes plus
59 #define GENERAL_TIME_STRLEN 15 /* NOT including trailing NULL */
61 void cfAbsTimeToGgenTime(
62 CFAbsoluteTime absTime
,
65 #define OCSPD_MAX_DIGEST_LEN CC_SHA256_DIGEST_LENGTH
70 unsigned char *md
); // allocd by caller, CC_SHA1_DIGEST_LENGTH bytes
74 unsigned char *md
); // allocd by caller, CC_MD5_DIGEST_LENGTH bytes
78 unsigned char *md
); // allocd by caller, CC_MD4_DIGEST_LENGTH bytes
82 unsigned char *md
); // allocd by caller, CC_SHA256_DIGEST_LENGTH bytes
85 * How many items in a NULL-terminated array of pointers?
87 unsigned ocspdArraySize(
90 #define CFRELEASE(cf) \
99 #endif /* _OCSPD_UTILS_H_ */