]>
git.saurik.com Git - apple/security.git/blob - OSX/include/security_ocspd/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 <Security/SecAsn1Coder.h>
37 #include <CoreFoundation/CoreFoundation.h>
40 * Compare two CSSM_DATAs, return CSSM_TRUE if identical.
42 CSSM_BOOL
ocspdCompareCssmData(
43 const CSSM_DATA
*data1
,
44 const CSSM_DATA
*data2
);
47 * Parse a GeneralizedTime string into a CFAbsoluteTime. Returns NULL_TIME on
48 * parse error. Fractional parts of a second are discarded.
52 CFAbsoluteTime
genTimeToCFAbsTime(
53 const CSSM_DATA
*strData
);
56 * Convert CFAbsoluteTime to generalized time string, GMT format (4 digit year,
57 * trailing 'Z'). Caller allocated the output which is GENERAL_TIME_STRLEN bytes plus
60 #define GENERAL_TIME_STRLEN 15 /* NOT including trailing NULL */
62 void cfAbsTimeToGgenTime(
63 CFAbsoluteTime absTime
,
66 #define OCSPD_MAX_DIGEST_LEN CC_SHA256_DIGEST_LENGTH
71 unsigned char *md
); // allocd by caller, CC_SHA1_DIGEST_LENGTH bytes
75 unsigned char *md
); // allocd by caller, CC_MD5_DIGEST_LENGTH bytes
79 unsigned char *md
); // allocd by caller, CC_MD4_DIGEST_LENGTH bytes
83 unsigned char *md
); // allocd by caller, CC_SHA256_DIGEST_LENGTH bytes
86 * How many items in a NULL-terminated array of pointers?
88 unsigned ocspdArraySize(
92 * Fill out a CSSM_DATA with the subset of public key bytes from the given
93 * CSSM_KEY_PTR which should be hashed to produce the issuerKeyHash field
94 * of a CertID in an OCSP request.
96 CSSM_RETURN
ocspdGetPublicKeyBytes(
97 SecAsn1CoderRef coder
,
98 CSSM_KEY_PTR publicKey
,
99 CSSM_DATA
&publicKeyBytes
); // filled out by this function
102 #define CFRELEASE(cf) \
111 #endif /* _OCSPD_UTILS_H_ */