2 * Copyright (c) 2000-2004,2011,2014 Apple Inc. All Rights Reserved.
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
20 // mds_standard - standard-defined MDS record types
22 #include <security_cdsa_client/dl_standard.h>
23 #include <security_cdsa_client/dlquery.h>
27 namespace CssmClient
{
31 // CDSA Common relation (one record per module)
33 static const char * const commonAttributes
[] = {
38 DLCommonFields::DLCommonFields(const char * const * names
)
39 : Record(commonAttributes
)
44 string
DLCommonFields::printName() const { return mAttributes
[0]; }
45 string
DLCommonFields::alias() const
46 { return mAttributes
[1].size() ? string(mAttributes
[1]) : "(no value)"; }
50 // The all-record-types pseudo-record
52 AllDLRecords::AllDLRecords()
53 : DLCommonFields(NULL
)
58 // CDSA Generic record attributes
60 static const char * const genericAttributes
[] = {
63 GenericRecord::GenericRecord()
64 : DLCommonFields(genericAttributes
)
70 // Apple "Generic Password" records
72 static const char * const genericPasswordAttributes
[] = {
73 // if you find yourself here, you should add the attributes and their functions
76 GenericPasswordRecord::GenericPasswordRecord()
77 : DLCommonFields(genericPasswordAttributes
)
83 // Common key attributes
85 static const char * const keyAttributes
[] = {
109 KeyRecord::KeyRecord()
110 : DLCommonFields(keyAttributes
)
114 uint32
KeyRecord::keyClass() const { return mAttributes
[2]; }
115 uint32
KeyRecord::type() const { return mAttributes
[3]; }
116 uint32
KeyRecord::size() const { return mAttributes
[4]; }
117 uint32
KeyRecord::effectiveSize() const { return mAttributes
[5]; }
118 const CssmData
&KeyRecord::label() const { return mAttributes
[6]; }
119 const CssmData
&KeyRecord::applicationTag() const { return mAttributes
[7]; }
120 bool KeyRecord::isPermanent() const { return mAttributes
[8]; }
121 bool KeyRecord::isPrivate() const { return mAttributes
[9]; }
122 bool KeyRecord::isModifiable() const { return mAttributes
[10]; }
123 bool KeyRecord::isSensitive() const { return mAttributes
[11]; }
124 bool KeyRecord::wasAlwaysSensitive() const { return mAttributes
[12]; }
125 bool KeyRecord::isExtractable() const { return mAttributes
[13]; }
126 bool KeyRecord::wasNeverExtractable() const { return mAttributes
[14]; }
127 bool KeyRecord::canEncrypt() const { return mAttributes
[15]; }
128 bool KeyRecord::canDecrypt() const { return mAttributes
[16]; }
129 bool KeyRecord::canDerive() const { return mAttributes
[17]; }
130 bool KeyRecord::canSign() const { return mAttributes
[18]; }
131 bool KeyRecord::canVerify() const { return mAttributes
[19]; }
132 bool KeyRecord::canWrap() const { return mAttributes
[20]; }
133 bool KeyRecord::canUnwrap() const { return mAttributes
[21]; }
137 // Certificate attributes
139 static const char * const certAttributes
[] = {
145 "SubjectKeyIdentifier",
150 X509CertRecord::X509CertRecord()
151 : DLCommonFields(certAttributes
)
155 CSSM_CERT_TYPE
X509CertRecord::type() const { return mAttributes
[2]; }
156 CSSM_CERT_ENCODING
X509CertRecord::encoding() const { return mAttributes
[3]; }
157 const CssmData
&X509CertRecord::subject() const { return mAttributes
[4]; }
158 const CssmData
&X509CertRecord::issuer() const { return mAttributes
[5]; }
159 const CssmData
&X509CertRecord::serial() const { return mAttributes
[6]; }
160 const CssmData
&X509CertRecord::subjectKeyIdentifier() const { return mAttributes
[7]; }
161 const CssmData
&X509CertRecord::publicKeyHash() const { return mAttributes
[8]; }
165 // UnlockReferral attributes
167 static const char * const unlockReferralAttributes
[] = {
179 UnlockReferralRecord::UnlockReferralRecord()
180 : DLCommonFields(unlockReferralAttributes
)
184 uint32
UnlockReferralRecord::type() const { return mAttributes
[2]; }
185 string
UnlockReferralRecord::dbName() const { return mAttributes
[3]; }
186 const CssmData
&UnlockReferralRecord::dbNetname() const { return mAttributes
[4]; }
187 const Guid
&UnlockReferralRecord::dbGuid() const { return mAttributes
[5]; }
188 uint32
UnlockReferralRecord::dbSSID() const { return mAttributes
[6]; }
189 uint32
UnlockReferralRecord::dbSSType() const { return mAttributes
[7]; }
190 const CssmData
&UnlockReferralRecord::keyLabel() const { return mAttributes
[8]; }
191 const CssmData
&UnlockReferralRecord::keyApplicationTag() const { return mAttributes
[9]; }
194 } // end namespace CssmClient
195 } // end namespace Security