2 * Copyright (c) 2002-2004 Apple Computer, 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@
25 * ExtendedAttribute.h - Extended Keychain Item Attribute class.
27 * Created 9/6/06 by dmitch.
30 #ifndef _SECURITY_EXTENDED_ATTRIBUTE_H_
31 #define _SECURITY_EXTENDED_ATTRIBUTE_H_
33 #include <security_keychain/Item.h>
34 #include <security_cdsa_utilities/cssmdata.h>
36 /* this is not public */
37 typedef struct OpaqueSecExtendedAttributeRef
*SecKeychainItemExtendedAttributeRef
;
42 namespace KeychainCore
45 class ExtendedAttribute
: public ItemImpl
47 NOCOPY(ExtendedAttribute
)
49 SECCFFUNCTIONS(ExtendedAttribute
, SecKeychainItemExtendedAttributeRef
,
50 errSecInvalidItemRef
, gTypes().ExtendedAttribute
)
52 /* construct new ExtendedAttr from API */
53 ExtendedAttribute(CSSM_DB_RECORDTYPE recordType
,
54 const CssmData
&itemID
,
55 const CssmData attrName
,
56 const CssmData attrValue
);
59 // db item contstructor
60 ExtendedAttribute(const Keychain
&keychain
,
61 const PrimaryKey
&primaryKey
,
62 const CssmClient::DbUniqueRecord
&uniqueId
);
64 // PrimaryKey item contstructor
65 ExtendedAttribute(const Keychain
&keychain
, const PrimaryKey
&primaryKey
);
68 static ExtendedAttribute
* make(const Keychain
&keychain
, const PrimaryKey
&primaryKey
, const CssmClient::DbUniqueRecord
&uniqueId
);
69 static ExtendedAttribute
* make(const Keychain
&keychain
, const PrimaryKey
&primaryKey
);
71 ExtendedAttribute(ExtendedAttribute
&extendedAttribute
);
73 virtual ~ExtendedAttribute() throw();
75 virtual PrimaryKey
add(Keychain
&keychain
);
76 bool operator == (const ExtendedAttribute
&other
) const;
78 /* set up DB attrs based on member vars */
81 CSSM_DB_RECORDTYPE mRecordType
;
83 CssmAutoData mAttrName
;
84 CssmAutoData mAttrValue
;
87 } // end namespace KeychainCore
89 } // end namespace Security
91 #endif /* _SECURITY_EXTENDED_ATTRIBUTES_H_ */