2 * Copyright (c) 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 // dl_standard - standard-defined DL record types.
22 // These are the C++ record types corresponding to standard and Apple-defined
23 // DL relations. Note that not all standard fields are included; only those
24 // of particular interest to the implementation. Feel free to add field functions
28 #ifndef _H_CDSA_CLIENT_DL_STANDARD
29 #define _H_CDSA_CLIENT_DL_STANDARD
31 #include <security_cdsa_client/dlclient.h>
35 namespace CssmClient
{
39 // All CDSA standard DL schemas contain these fields
41 class DLCommonFields
: public Record
{
43 DLCommonFields(const char * const * names
);
45 string
printName() const;
51 // A record type for all records in a DL, with PrintName (only)
53 class AllDLRecords
: public DLCommonFields
{
60 // The CDSA-standard "generic record" table
62 class GenericRecord
: public DLCommonFields
{
65 static const CSSM_DB_RECORDTYPE recordType
= CSSM_DL_DB_RECORD_GENERIC
;
70 // Generic password records (Apple specific)
72 class GenericPasswordRecord
: public DLCommonFields
{
74 GenericPasswordRecord();
75 static const CSSM_DB_RECORDTYPE recordType
= CSSM_DL_DB_RECORD_GENERIC_PASSWORD
;
82 class KeyRecord
: public DLCommonFields
{
85 static const CSSM_DB_RECORDTYPE recordType
= CSSM_DL_DB_RECORD_ALL_KEYS
;
87 uint32
keyClass() const;
90 uint32
effectiveSize() const;
91 const CssmData
&label() const;
92 const CssmData
&applicationTag() const;
94 // boolean attributes for classification
95 bool isPermanent() const;
96 bool isPrivate() const;
97 bool isModifiable() const;
98 bool isSensitive() const;
99 bool wasAlwaysSensitive() const;
100 bool isExtractable() const;
101 bool wasNeverExtractable() const;
102 bool canEncrypt() const;
103 bool canDecrypt() const;
104 bool canDerive() const;
105 bool canSign() const;
106 bool canVerify() const;
107 bool canWrap() const;
108 bool canUnwrap() const;
111 class PrivateKeyRecord
: public KeyRecord
{
113 static const CSSM_DB_RECORDTYPE recordType
= CSSM_DL_DB_RECORD_PRIVATE_KEY
;
116 class PublicKeyRecord
: public KeyRecord
{
118 static const CSSM_DB_RECORDTYPE recordType
= CSSM_DL_DB_RECORD_PUBLIC_KEY
;
121 class SymmetricKeyRecord
: public KeyRecord
{
123 static const CSSM_DB_RECORDTYPE recordType
= CSSM_DL_DB_RECORD_SYMMETRIC_KEY
;
128 // X509 Certificate records
130 class X509CertRecord
: public DLCommonFields
{
133 static const CSSM_DB_RECORDTYPE recordType
= CSSM_DL_DB_RECORD_X509_CERTIFICATE
;
135 CSSM_CERT_TYPE
type() const;
136 CSSM_CERT_ENCODING
encoding() const;
137 const CssmData
&subject() const;
138 const CssmData
&issuer() const;
139 const CssmData
&serial() const;
140 const CssmData
&subjectKeyIdentifier() const;
141 const CssmData
&publicKeyHash() const;
146 // Unlock referral records
148 class UnlockReferralRecord
: public DLCommonFields
{
150 UnlockReferralRecord();
151 static const CSSM_DB_RECORDTYPE recordType
= CSSM_DL_DB_RECORD_UNLOCK_REFERRAL
;
154 string
dbName() const;
155 const CssmData
&dbNetname() const;
156 const Guid
&dbGuid() const;
157 uint32
dbSSID() const;
158 uint32
dbSSType() const;
159 const CssmData
&keyLabel() const;
160 const CssmData
&keyApplicationTag() const;
164 } // end namespace CssmClient
165 } // end namespace Security
167 #endif // _H_CDSA_CLIENT_DL_STANDARD