]>
Commit | Line | Data |
---|---|---|
b1ab9ed8 | 1 | /* |
427c49bc A |
2 | * Copyright (c) 2002-2004,2012 Apple Inc. All Rights Reserved. |
3 | * | |
b1ab9ed8 | 4 | * @APPLE_LICENSE_HEADER_START@ |
427c49bc | 5 | * |
b1ab9ed8 A |
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. | |
427c49bc | 12 | * |
b1ab9ed8 A |
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. | |
427c49bc | 20 | * |
b1ab9ed8 A |
21 | * @APPLE_LICENSE_HEADER_END@ |
22 | */ | |
23 | ||
24 | ||
25 | // | |
26 | // Policies.h | |
27 | // | |
28 | #ifndef _SECURITY_POLICY_H_ | |
29 | #define _SECURITY_POLICY_H_ | |
30 | ||
31 | #include <Security/SecPolicy.h> | |
32 | #include <security_cdsa_utilities/cssmdata.h> | |
33 | #include <security_cdsa_client/tpclient.h> | |
34 | #include <security_utilities/seccfobject.h> | |
35 | #include "SecCFTypes.h" | |
36 | ||
37 | namespace Security | |
38 | { | |
39 | ||
40 | namespace KeychainCore | |
41 | { | |
42 | ||
43 | using namespace CssmClient; | |
44 | ||
45 | // | |
46 | // A Policy[Impl] represents a particular | |
47 | // CSSM "policy" managed by a particular TP. | |
48 | // | |
49 | class Policy : public SecCFObject | |
50 | { | |
51 | NOCOPY(Policy) | |
52 | public: | |
53 | SECCFFUNCTIONS(Policy, SecPolicyRef, errSecInvalidItemRef, gTypes().Policy) | |
54 | ||
55 | Policy(TP supportingTp, const CssmOid &policyOid); | |
427c49bc | 56 | |
b1ab9ed8 A |
57 | public: |
58 | virtual ~Policy() throw(); | |
427c49bc | 59 | |
b1ab9ed8 A |
60 | TP &tp() { return mTp; } |
61 | const TP &tp() const { return mTp; } | |
62 | const CssmOid &oid() const { return mOid; } | |
63 | const CssmData &value() const { return mValue; } | |
64 | CssmOwnedData &value() { return mValue; } | |
427c49bc | 65 | |
b1ab9ed8 A |
66 | void setValue(const CssmData &value); |
67 | void setProperties(CFDictionaryRef properties); | |
68 | CFDictionaryRef properties(); | |
427c49bc | 69 | |
b1ab9ed8 A |
70 | bool operator < (const Policy& other) const; |
71 | bool operator == (const Policy& other) const; | |
72 | ||
b1ab9ed8 A |
73 | private: |
74 | TP mTp; // TP module for this Policy | |
75 | CssmAutoData mOid; // OID for this policy | |
76 | CssmAutoData mValue; // value for this policy | |
77 | CssmAutoData mAuxValue; // variable-length value data for this policy | |
78 | Mutex mMutex; | |
79 | }; | |
80 | ||
81 | } // end namespace KeychainCore | |
82 | ||
83 | } // end namespace Security | |
84 | ||
85 | #endif // !_SECURITY_POLICY_H_ |