2 * Copyright (c) 2002-2004,2011-2012,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@
28 #ifndef _SECURITY_POLICY_H_
29 #define _SECURITY_POLICY_H_
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"
40 namespace KeychainCore
43 using namespace CssmClient
;
46 // A Policy[Impl] represents a particular
47 // CSSM "policy" managed by a particular TP.
49 class Policy
: public SecCFObject
53 SECCFFUNCTIONS(Policy
, SecPolicyRef
, errSecInvalidItemRef
, gTypes().Policy
)
55 Policy(TP supportingTp
, const CssmOid
&policyOid
);
58 virtual ~Policy() _NOEXCEPT
;
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
; }
66 void setValue(const CssmData
&value
);
67 void setProperties(CFDictionaryRef properties
);
68 CFDictionaryRef
properties();
70 bool operator < (const Policy
& other
) const;
71 bool operator == (const Policy
& other
) const;
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
81 } // end namespace KeychainCore
83 } // end namespace Security
85 #endif // !_SECURITY_POLICY_H_