2 * Copyright (c) 2000-2001 Apple Computer, 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.
21 // a class interface to the CSSM_SAMPLEGROUP structure
23 // Here are the relevant structures:
25 // typedef struct cssm_samplegroup {
26 // uint32 NumberOfSamples;
27 // const CSSM_SAMPLE *Samples;
28 // } CSSM_SAMPLEGROUP, *CSSM_SAMPLEGROUP_PTR;
30 // typedef struct cssm_sample {
31 // CSSM_LIST TypedSample;
32 // const CSSM_SUBSERVICE_UID *Verifier;
33 // } CSSM_SAMPLE, *CSSM_SAMPLE_PTR;
35 // typedef struct cssm_list {
36 // CSSM_LIST_TYPE ListType; /* type of this list */
37 // CSSM_LIST_ELEMENT_PTR Head; /* head of the list */
38 // CSSM_LIST_ELEMENT_PTR Tail; /* tail of the list */
39 // } CSSM_LIST, *CSSM_LIST_PTR;
41 // typedef uint32 CSSM_LIST_TYPE, *CSSM_LIST_TYPE_PTR;
43 // CSSM_LIST_TYPE_UNKNOWN = 0,
44 // CSSM_LIST_TYPE_CUSTOM = 1,
45 // CSSM_LIST_TYPE_SEXPR = 2
48 // typedef struct cssm_list_element {
49 // struct cssm_list_element *NextElement; /* next list element */
50 // CSSM_WORDID_TYPE WordID; /* integer identifier associated */
51 // /* with a Word value */
52 // CSSM_LIST_ELEMENT_TYPE ElementType;
54 // CSSM_LIST Sublist; /* sublist */
55 // CSSM_DATA Word; /* a byte-string */
57 // } CSSM_LIST_ELEMENT;
61 #ifndef __SAMPLEGROUP__
62 #define __SAMPLEGROUP__
64 #include <cdsa/cssmtype.h>
65 #include <cdsa_utilities/utilities.h>
66 #include <cdsa_utilities/cssm_adt_utils.h>
73 class CssmSample
: public PodWrapper
<CssmSample
, CSSM_SAMPLE
> {
76 CssmSample( CSSM_LIST
&list
, CSSM_SUBSERVICE_UID
*verifier
);
79 CssmSample
* operator = (CssmSample
& sample
);
81 void SetSubserviceUID( CSSM_SUBSERVICE_UID
*verifier
) { Verifier
= verifier
; }
82 void SetList( CSSM_LIST
*list
) { TypedSample
.ListType
= list
->ListType
; TypedSample
.Head
= list
->Head
; TypedSample
.Tail
= list
->Tail
; }
84 // CSSM_SAMPLE_TYPE_PASSWORD = CSSM_WORDID_PASSWORD,
85 CSSM_RETURN
AddPasswordImmediate( char* password
, CSSM_SUBSERVICE_UID
*optionalVerifier
); // provide password without callback or reply to callback
86 CSSM_RETURN
AddPasswordCallback( ); // triggers a callback that will acquire the password
88 // CSSM_SAMPLE_TYPE_HASHED_PASSWORD = CSSM_WORDID_HASHED_PASSWORD,
89 CSSM_RETURN
AddHashedPassword( char* password
, CSSM_SUBSERVICE_UID
*optionalVerifier
); // this is always in reply to a callback
91 // CSSM_SAMPLE_TYPE_PROTECTED_PASSWORD = CSSM_WORDID_PROTECTED_PASSWORD,
92 CSSM_RETURN
AddProtectedPasword(CSSM_SUBSERVICE_UID
*optionalVerifier
); // this always provokes a callback, Verifier is optional
94 // CSSM_SAMPLE_TYPE_PROMPTED_PASSWORD = CSSM_WORDID_PROMPTED_PASSWORD,
95 CSSM_RETURN
AddPromptedPassword( char* promptedPassword
, CSSM_SUBSERVICE_UID
*optionalVerifier
); // this is always in reply to a callback
97 // CSSM_SAMPLE_TYPE_SIGNED_NONCE = CSSM_WORDID_SIGNED_NONCE,
98 CSSM_RETURN
AddSignedNonceForCallback( CSSM_SUBSERVICE_UID
*requiredVerifier
);
99 CSSM_RETURN
AddSignedNonceReply( CSSM_DATA_PTR signedNonce
, CSSM_SUBSERVICE_UID
*requiredVerifier
); // used to reply to the callback for a signed nonce
101 // CSSM_SAMPLE_TYPE_SIGNED_SECRET = CSSM_WORDID_SIGNED_SECRET,
102 CSSM_RETURN
AddSignedSecretForCallback( CSSM_SUBSERVICE_UID
*requiredVerifier
); // will provoke a callback to fill in the actual signed secret
103 CSSM_RETURN
AddSignedSecretImmediate( CSSM_DATA_PTR signedSecret
, CSSM_SUBSERVICE_UID
*requiredVerifier
); // use as the original request or as a response to a callback
105 // CSSM_SAMPLE_TYPE_BIOMETRIC = CSSM_WORDID_BIOMETRIC,
106 CSSM_RETURN
AddBiometricCallback( CSSM_SUBSERVICE_UID
*requiredVerifier
);
107 CSSM_RETURN
AddBiometricImmediate( CSSM_DATA_PTR biometricData
, CSSM_SUBSERVICE_UID
*requiredVerifier
); // reply to callback or provide sample without callback
109 // CSSM_SAMPLE_TYPE_PROTECTED_BIOMETRIC = CSSM_WORDID_PROTECTED_BIOMETRIC,
110 CSSM_RETURN
AddProtectedBiometric( CSSM_SUBSERVICE_UID
*requiredVerifier
); // request for a callback for biometric data
112 // CSSM_SAMPLE_TYPE_PROMPTED_BIOMETRIC = CSSM_WORDID_PROMPTED_BIOMETRIC,
113 CSSM_RETURN
AddPromptedBiometric( CSSM_DATA_PTR biometricData
, CSSM_SUBSERVICE_UID
*requiredVerifier
); // reply to callback only
115 // CSSM_SAMPLE_TYPE_THRESHOLD = CSSM_WORDID_THRESHOLD
116 CSSM_RETURN
AddThreshold();
120 class CssmSampleGroup
: public PodWrapper
<CssmSampleGroup
, CSSM_SAMPLEGROUP
>
124 CssmSampleGroup( uint32 sampleCount
, CSSM_SAMPLE
*samples
);
127 CSSM_RETURN
AddSample(CSSM_SAMPLE
* sample
);
129 CSSM_SAMPLE
* GetIthSample(uint32 sampleIndex
);
131 uint32
GetSampleCount() { return NumberOfSamples
; }
137 #ifdef _CPP_UTILITIES
141 #endif // __SAMPLEGROUP__