]> git.saurik.com Git - apple/securityd.git/blob - src/acl_keychain.h
764b931410595cf5a9fd742d16dc74b603f2bce3
[apple/securityd.git] / src / acl_keychain.h
1 /*
2 * Copyright (c) 2000-2004 Apple Computer, Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25
26
27 //
28 // acl_keychain - a subject type for the protected-path
29 // keychain prompt interaction model.
30 //
31 #ifndef _ACL_KEYCHAIN
32 #define _ACL_KEYCHAIN
33
34 #include <security_cdsa_utilities/cssmacl.h>
35 #include <security_agent_client/agentclient.h>
36 #include <string>
37
38
39 //
40 // This is the actual subject implementation class
41 //
42 class KeychainPromptAclSubject : public SimpleAclSubject {
43 static const Version pumaVersion = 0; // 10.0, 10.1 -> default selector (not stored)
44 static const Version jaguarVersion = 1; // 10.2 et al -> first version selector
45 public:
46 bool validate(const AclValidationContext &baseCtx, const TypedList &sample) const;
47 CssmList toList(Allocator &alloc) const;
48
49 KeychainPromptAclSubject(string description, const CSSM_ACL_KEYCHAIN_PROMPT_SELECTOR &selector);
50
51 void exportBlob(Writer::Counter &pub, Writer::Counter &priv);
52 void exportBlob(Writer &pub, Writer &priv);
53
54 IFDUMP(void debugDump() const);
55
56 class Maker : public AclSubject::Maker {
57 public:
58 Maker(CSSM_ACL_SUBJECT_TYPE type = CSSM_ACL_SUBJECT_TYPE_KEYCHAIN_PROMPT)
59 : AclSubject::Maker(type) { }
60 KeychainPromptAclSubject *make(const TypedList &list) const;
61 KeychainPromptAclSubject *make(Version version, Reader &pub, Reader &priv) const;
62 };
63
64 private:
65 CSSM_ACL_KEYCHAIN_PROMPT_SELECTOR selector; // selector structure
66 string description; // description blob (string)
67
68 private:
69 static CSSM_ACL_KEYCHAIN_PROMPT_SELECTOR defaultSelector;
70
71 typedef uint32 VersionMarker;
72 static const VersionMarker currentVersion = 0x3BD5910D;
73
74 bool isLegacyCompatible() const;
75 };
76
77
78 #endif //_ACL_KEYCHAIN