]> git.saurik.com Git - apple/security.git/blob - sec/Security/SecPolicy.h
Security-55178.0.1.tar.gz
[apple/security.git] / sec / Security / SecPolicy.h
1 /*
2 * Copyright (c) 2007-2010 Apple Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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
11 * file.
12 *
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.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 /*!
25 @header SecPolicy
26 The functions provided in SecPolicy.h provide an interface to various
27 X.509 certificate trust policies.
28 */
29
30 #ifndef _SECURITY_SECPOLICY_H_
31 #define _SECURITY_SECPOLICY_H_
32
33 #include <Security/SecBase.h>
34 #include <CoreFoundation/CFBase.h>
35
36 #if defined(__cplusplus)
37 extern "C" {
38 #endif
39
40 /*!
41 @typedef SecPolicyRef
42 @abstract CFType representing a X.509 certificate trust policy.
43 */
44 typedef struct __SecPolicy *SecPolicyRef;
45
46 /*!
47 @function SecPolicyGetTypeID
48 @abstract Returns the type identifier of SecPolicy instances.
49 @result The CFTypeID of SecPolicy instances.
50 */
51 CFTypeID SecPolicyGetTypeID(void)
52 __OSX_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_2_0);
53
54 /*!
55 @function SecPolicyCreateBasicX509
56 @abstract Returns a policy object for the default X.509 policy.
57 @result A policy object. The caller is responsible for calling CFRelease
58 on this when it is no longer needed.
59 */
60 SecPolicyRef SecPolicyCreateBasicX509(void)
61 __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_2_0);
62
63 /*!
64 @function SecPolicyCreateSSL
65 @abstract Returns a policy object for evaluating SSL certificate chains.
66 @param server Passing true for this parameter create a policy for SSL
67 server certificates.
68 @param hostname Optional; if present, the policy will require the specified
69 hostname to match the hostname in the leaf certificate.
70 @result A policy object. The caller is responsible for calling CFRelease
71 on this when it is no longer needed.
72 */
73 SecPolicyRef SecPolicyCreateSSL(Boolean server, CFStringRef hostname)
74 __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_2_0);
75
76 #if defined(__cplusplus)
77 }
78 #endif
79
80 #endif /* !_SECURITY_SECPOLICY_H_ */