]> git.saurik.com Git - apple/security.git/blob - libsecurity_keychain/lib/ExtendedAttribute.h
Security-55163.44.tar.gz
[apple/security.git] / libsecurity_keychain / lib / ExtendedAttribute.h
1 /*
2 * Copyright (c) 2002-2004 Apple Computer, 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 * ExtendedAttribute.h - Extended Keychain Item Attribute class.
26 *
27 * Created 9/6/06 by dmitch.
28 */
29
30 #ifndef _SECURITY_EXTENDED_ATTRIBUTE_H_
31 #define _SECURITY_EXTENDED_ATTRIBUTE_H_
32
33 #include <security_keychain/Item.h>
34 #include <security_cdsa_utilities/cssmdata.h>
35
36 /* this is not public */
37 typedef struct OpaqueSecExtendedAttributeRef *SecKeychainItemExtendedAttributeRef;
38
39 namespace Security
40 {
41
42 namespace KeychainCore
43 {
44
45 class ExtendedAttribute : public ItemImpl
46 {
47 NOCOPY(ExtendedAttribute)
48 public:
49 SECCFFUNCTIONS(ExtendedAttribute, SecKeychainItemExtendedAttributeRef,
50 errSecInvalidItemRef, gTypes().ExtendedAttribute)
51
52 /* construct new ExtendedAttr from API */
53 ExtendedAttribute(CSSM_DB_RECORDTYPE recordType,
54 const CssmData &itemID,
55 const CssmData attrName,
56 const CssmData attrValue);
57
58 private:
59 // db item contstructor
60 ExtendedAttribute(const Keychain &keychain,
61 const PrimaryKey &primaryKey,
62 const CssmClient::DbUniqueRecord &uniqueId);
63
64 // PrimaryKey item contstructor
65 ExtendedAttribute(const Keychain &keychain, const PrimaryKey &primaryKey);
66
67 public:
68 static ExtendedAttribute* make(const Keychain &keychain, const PrimaryKey &primaryKey, const CssmClient::DbUniqueRecord &uniqueId);
69 static ExtendedAttribute* make(const Keychain &keychain, const PrimaryKey &primaryKey);
70
71 ExtendedAttribute(ExtendedAttribute &extendedAttribute);
72
73 virtual ~ExtendedAttribute() throw();
74
75 virtual PrimaryKey add(Keychain &keychain);
76 bool operator == (const ExtendedAttribute &other) const;
77 private:
78 /* set up DB attrs based on member vars */
79 void setupAttrs();
80
81 CSSM_DB_RECORDTYPE mRecordType;
82 CssmAutoData mItemID;
83 CssmAutoData mAttrName;
84 CssmAutoData mAttrValue;
85 };
86
87 } // end namespace KeychainCore
88
89 } // end namespace Security
90
91 #endif /* _SECURITY_EXTENDED_ATTRIBUTES_H_ */