2 * Copyright (c) 2002-2004,2011,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@
25 * ExtendedAttribute.h - Extended Keychain Item Attribute class.
29 #ifndef _SECURITY_EXTENDED_ATTRIBUTE_H_
30 #define _SECURITY_EXTENDED_ATTRIBUTE_H_
32 #include <security_keychain/Item.h>
33 #include <security_cdsa_utilities/cssmdata.h>
35 /* this is not public */
36 typedef struct OpaqueSecExtendedAttributeRef
*SecKeychainItemExtendedAttributeRef
;
41 namespace KeychainCore
44 class ExtendedAttribute
: public ItemImpl
46 NOCOPY(ExtendedAttribute
)
48 SECCFFUNCTIONS(ExtendedAttribute
, SecKeychainItemExtendedAttributeRef
,
49 errSecInvalidItemRef
, gTypes().ExtendedAttribute
)
51 /* construct new ExtendedAttr from API */
52 ExtendedAttribute(CSSM_DB_RECORDTYPE recordType
,
53 const CssmData
&itemID
,
54 const CssmData attrName
,
55 const CssmData attrValue
);
58 // db item contstructor
59 ExtendedAttribute(const Keychain
&keychain
,
60 const PrimaryKey
&primaryKey
,
61 const CssmClient::DbUniqueRecord
&uniqueId
);
63 // PrimaryKey item contstructor
64 ExtendedAttribute(const Keychain
&keychain
, const PrimaryKey
&primaryKey
);
67 static ExtendedAttribute
* make(const Keychain
&keychain
, const PrimaryKey
&primaryKey
, const CssmClient::DbUniqueRecord
&uniqueId
);
68 static ExtendedAttribute
* make(const Keychain
&keychain
, const PrimaryKey
&primaryKey
);
70 ExtendedAttribute(ExtendedAttribute
&extendedAttribute
);
72 virtual ~ExtendedAttribute() _NOEXCEPT
;
74 virtual PrimaryKey
add(Keychain
&keychain
);
75 bool operator == (const ExtendedAttribute
&other
) const;
77 /* set up DB attrs based on member vars */
80 CSSM_DB_RECORDTYPE mRecordType
;
82 CssmAutoData mAttrName
;
83 CssmAutoData mAttrValue
;
86 } // end namespace KeychainCore
88 } // end namespace Security
90 #endif /* _SECURITY_EXTENDED_ATTRIBUTES_H_ */