|
1 /* |
|
2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: WIMI definitions used by WimServer and WimClient. |
|
15 * All WIMI.lib API functions are described in this file. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef WIMI_H |
|
21 #define WIMI_H |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <libc/stddef.h> // For size_t |
|
25 |
|
26 #ifdef __cplusplus |
|
27 extern "C" { |
|
28 #endif |
|
29 |
|
30 |
|
31 // CONSTANTS |
|
32 |
|
33 /* CDF of certificate */ |
|
34 const TUint WIMLIB_CERTIFICATES_CDF = 0x20; |
|
35 const TUint WIMLIB_TRUSTEDCERTS_CDF = 0x40; |
|
36 const TUint WIMLIB_USEFULCERTS_CDF = 0x80; |
|
37 |
|
38 /* PIN flags */ |
|
39 const TUint8 WIMI_PF_DisableAllowed = 0x10; |
|
40 const TUint8 WIMI_PF_UnblockDisabled = 0x20; |
|
41 const TUint8 WIMI_PF_ChangeDisabled = 0x40; |
|
42 const TUint8 WIMI_PF_Enabled = 0x80; |
|
43 |
|
44 |
|
45 /* Certificate usage */ |
|
46 const TUint WIMI_CU_Client = 0; |
|
47 const TUint WIMI_CU_CA = 1; |
|
48 |
|
49 /* Certificate type */ |
|
50 const TUint WIMI_CT_WTLS = 1; |
|
51 const TUint WIMI_CT_X509 = 2; |
|
52 const TUint WIMI_CT_X968 = 3; |
|
53 const TUint WIMI_CT_URL = 4; |
|
54 const TUint WIMI_CT_UNKNOWN = 255; |
|
55 |
|
56 /* APDU driver status codes */ |
|
57 const TUint8 WIMI_APDU_OK = 0; |
|
58 const TUint8 WIMI_APDU_TRANSMISSION_ERROR = 1; |
|
59 |
|
60 |
|
61 // DATA TYPES |
|
62 |
|
63 /* Return type for status codes */ |
|
64 typedef TUint16 WIMI_STAT; |
|
65 |
|
66 /* Reference types */ |
|
67 typedef void WIMI_Ref_t; |
|
68 typedef WIMI_Ref_t* WIMI_Ref_pt; |
|
69 |
|
70 /* Reference list */ |
|
71 typedef WIMI_Ref_pt* WIMI_RefList_t; |
|
72 |
|
73 /* Binary data */ |
|
74 typedef struct |
|
75 { |
|
76 TUint8* pb_buf; |
|
77 TUint16 ui_buf_length; |
|
78 TUint8 filler_byte[2]; /* filler byte to ensure alignment*/ |
|
79 } WIM_BIN_DATA; |
|
80 |
|
81 typedef WIM_BIN_DATA WIMI_BinData_t; |
|
82 |
|
83 /* Label list */ |
|
84 typedef WIMI_BinData_t* WIMI_labelptr_t; |
|
85 typedef WIMI_labelptr_t* WIMI_labellist_t; |
|
86 |
|
87 /* Hash context type */ |
|
88 typedef void WIMI_Hash_t; |
|
89 |
|
90 /* Transaction ID */ |
|
91 typedef void *WIMI_TransactId_t; |
|
92 |
|
93 /* WTLS Certificate info structure */ |
|
94 typedef struct |
|
95 { |
|
96 TUint16 ParsedLen; |
|
97 TUint8 SignAlg; |
|
98 TUint8* Issuer; |
|
99 TUint16 IssuerLen; |
|
100 TUint32 ValidNotBefore; |
|
101 TUint32 ValidNotAfter; |
|
102 TUint8* Subject; |
|
103 TUint16 SubjectLen; |
|
104 TUint8 PublicKeyType; |
|
105 TUint16 exponentlen; |
|
106 TUint8* exponent; |
|
107 TUint16 moduluslen; |
|
108 TUint8* modulus; |
|
109 TUint16 signaturelen; |
|
110 TUint8* signature; |
|
111 } WIMI_WTLS_CertInfo_t; |
|
112 |
|
113 /* File info structure for Provisioning files */ |
|
114 typedef struct |
|
115 { |
|
116 WIM_BIN_DATA t_label; |
|
117 WIM_BIN_DATA t_oid; |
|
118 WIM_BIN_DATA b_path; |
|
119 TUint16 ui_flags; /* bitmask */ |
|
120 TUint16 ui_file_size; |
|
121 TUint8 ui_pin_ref; |
|
122 TUint8 filler_byte[3]; /* filler byte to ensure alignment*/ |
|
123 } WIMI_File_Info; |
|
124 |
|
125 /* Status codes */ |
|
126 enum __WIMI_STATUS_CODES |
|
127 { |
|
128 WIMI_Ok = 0, |
|
129 WIMI_Err, |
|
130 WIMI_ERR_Internal, |
|
131 WIMI_ERR_OutOfMemory, |
|
132 WIMI_ERR_BadParameters, |
|
133 WIMI_ERR_ServerCertRejected, |
|
134 WIMI_ERR_WrongReference, |
|
135 WIMI_ERR_CipherNotSupported, |
|
136 WIMI_ERR_MACANotSupported, |
|
137 WIMI_ERR_SessionNotSet, |
|
138 WIMI_ERR_WrongKES, |
|
139 WIMI_ERR_DecodeError, |
|
140 WIMI_ERR_ExpiredReference, |
|
141 WIMI_ERR_NoKey, |
|
142 WIMI_ERR_CertNotYetValid, |
|
143 WIMI_ERR_CertExpired, |
|
144 WIMI_ERR_UnknownCA, |
|
145 WIMI_ERR_CertParseError, |
|
146 WIMI_ERR_UnsupportedCertificate, |
|
147 WIMI_ERR_SignCheckFailed, |
|
148 WIMI_ERR_NoWIM, |
|
149 WIMI_ERR_NoKES, |
|
150 WIMI_ERR_HashInitFailed, |
|
151 WIMI_ERR_HashUpdateFailed, |
|
152 WIMI_ERR_HashCopyFailed, |
|
153 WIMI_ERR_HashFinalFailed, |
|
154 WIMI_ERR_HashInvalidAlgorithm, |
|
155 WIMI_ERR_UnknownKeyId, |
|
156 WIMI_ERR_KeyStorageFull, |
|
157 WIMI_ERR_BadKey, |
|
158 WIMI_ERR_CertStorageFull, |
|
159 WIMI_ERR_BadCert, |
|
160 WIMI_ERR_PStorageError, |
|
161 WIMI_ERR_CertNotFound, |
|
162 WIMI_ERR_KeyNotFound, |
|
163 WIMI_ERR_BadReference, |
|
164 WIMI_ERR_OperNotSupported, |
|
165 WIMI_ERR_BadPIN, |
|
166 WIMI_ERR_CardDriverInitError, |
|
167 WIMI_ERR_CardIOError, |
|
168 WIMI_ERR_AlgorithmNotYetImplemented, |
|
169 WIMI_ERR_PINBlocked, |
|
170 WIMI_ERR_OperNotAllowed, |
|
171 WIMI_ERR_NoCert, |
|
172 WIMI_ERR_CAcertNotYetValid, |
|
173 WIMI_ERR_CAcertExpired, |
|
174 WIMI_ERR_BadCAcert, |
|
175 WIMI_ERR_UserCancelled = 0x8F |
|
176 }; |
|
177 |
|
178 /* Operation codes for some WIMI calls */ |
|
179 enum TWimiOpcodes |
|
180 { |
|
181 ENoOperation, // No operation |
|
182 EInitializationCertListHashing, // Cert hash |
|
183 EOMAProvContentSync // Synchronous OMA Provisioning file fetch |
|
184 }; |
|
185 |
|
186 |
|
187 // ============================================================================= |
|
188 // Callback functions. User of WIMI (WimServer) has to implement these |
|
189 // functions. |
|
190 // ============================================================================= |
|
191 |
|
192 /* ------------ WIMI initialization and closing --------------------------- */ |
|
193 /** |
|
194 WIMI init respond callback. |
|
195 aStatus - operation status |
|
196 **/ |
|
197 typedef void ( *WIMI_InitResp_t )( WIMI_STAT aStatus ); |
|
198 |
|
199 /** |
|
200 WIMI close respond callback |
|
201 aStatus - operation status |
|
202 **/ |
|
203 typedef void ( *WIMI_CloseDownResp_t )( WIMI_STAT aStatus ); |
|
204 |
|
205 /* ------------ Digital signature ----------------------------------------- */ |
|
206 /** |
|
207 Respond to the digital signature operation |
|
208 aTrId - transaction id |
|
209 aStatus - operation status |
|
210 aSignLen - signature length |
|
211 aSign - signature |
|
212 **/ |
|
213 typedef void ( *WIMI_SignResp_t )( WIMI_TransactId_t aTrId, |
|
214 WIMI_STAT aStatus, |
|
215 TUint8 aSignLen, |
|
216 TUint8* aSign ); |
|
217 |
|
218 /* ------------ Certificate management ------------------------------------ */ |
|
219 /** |
|
220 Respond to the certificate fetch operation |
|
221 aTrId - transaction id |
|
222 aStatus - operation status |
|
223 aCertRef - the reference to certificate that was fetched |
|
224 aCertLen - certificate content length |
|
225 aCert - certificate content |
|
226 **/ |
|
227 typedef void ( *WIMI_CertificateResp_t )( WIMI_TransactId_t aTrId, |
|
228 WIMI_STAT aStatus, |
|
229 WIMI_Ref_t* aCertRef, |
|
230 TUint16 aCertLen, |
|
231 TUint8* aCert ); |
|
232 |
|
233 /** |
|
234 Respond to the certificate delete operation |
|
235 aTrId - transaction id |
|
236 aStatus - operation status |
|
237 **/ |
|
238 typedef void ( *WIMI_CertificateDeleteResp_t )( WIMI_TransactId_t aTrId, |
|
239 WIMI_STAT aStatus ); |
|
240 |
|
241 /** |
|
242 Respond to the certificate store operation |
|
243 aTrId - transaction id |
|
244 aStatus - operation status |
|
245 aCertRef - the reference to certificate that was stored |
|
246 **/ |
|
247 typedef void ( *WIMI_CertificateStoreResp_t )( WIMI_TransactId_t aTrId, |
|
248 WIMI_STAT aStatus, |
|
249 WIMI_Ref_t* aCertRef ); |
|
250 |
|
251 |
|
252 /* ------------ PIN management -------------------------------------------- */ |
|
253 /** |
|
254 Respond to the Verify PIN operation |
|
255 aTrId - transaction id |
|
256 aStatus - operation status |
|
257 **/ |
|
258 typedef void ( *WIMI_VerifyPINResp_t )( WIMI_TransactId_t aTrId, |
|
259 WIMI_STAT aStatus ); |
|
260 |
|
261 /** |
|
262 Respond to the Change PIN operation |
|
263 aTrId - transaction id |
|
264 aStatus - operation status |
|
265 **/ |
|
266 typedef void ( *WIMI_ChangePINResp_t )( WIMI_TransactId_t aTrId, |
|
267 WIMI_STAT aStatus ); |
|
268 |
|
269 /** |
|
270 Respond to the Unblock PIN operation |
|
271 aTrId - transaction id |
|
272 aStatus - operation status |
|
273 **/ |
|
274 typedef void ( *WIMI_UnblockPINResp_t )( WIMI_TransactId_t aTrId, |
|
275 WIMI_STAT aStatus ); |
|
276 |
|
277 /** |
|
278 Respond to the Enable PIN operation |
|
279 aTrId - transaction id |
|
280 aStatus - operation status |
|
281 **/ |
|
282 typedef void ( *WIMI_EnablePINResp_t )( WIMI_TransactId_t aTrId, |
|
283 WIMI_STAT aStatus ); |
|
284 |
|
285 /* ------------ Hardware driver support ----------------------------------- */ |
|
286 /** |
|
287 Card inserted response |
|
288 aReader - reader ID |
|
289 aStatus - operation status |
|
290 aWimReg - WIM reference |
|
291 **/ |
|
292 typedef void ( *WIMI_CardInsertedResp_t )( TUint8 aReader, |
|
293 WIMI_STAT aStatus, |
|
294 WIMI_Ref_t* aWimRef ); |
|
295 |
|
296 /** |
|
297 Open WIM request (connection request) |
|
298 aReader - reader ID |
|
299 **/ |
|
300 typedef TUint8 ( *WIMI_Open_t )( TUint8 aReader ); |
|
301 |
|
302 /** |
|
303 Close WIM request (close connection) |
|
304 aReader - reader ID |
|
305 **/ |
|
306 typedef TUint8 ( *WIMI_Close_t )( TUint8 aReader ); |
|
307 |
|
308 /** |
|
309 APDU request |
|
310 aReader - reader ID |
|
311 aApdu - APDU |
|
312 aApduLen - length of APDU |
|
313 **/ |
|
314 typedef void ( *WIMI_APDUReq_t )( TUint8 aReader, |
|
315 TUint8* aApdu, |
|
316 TUint16 aApduLen ); |
|
317 |
|
318 /** |
|
319 Get ATR request |
|
320 aReader - reader ID |
|
321 **/ |
|
322 typedef void ( *WIMI_GetATRReq_t )( TUint8 aReader ); |
|
323 |
|
324 /** |
|
325 Get reader list request |
|
326 **/ |
|
327 typedef void ( *WIMI_GetReaderListReq_t )( void ); |
|
328 |
|
329 /** |
|
330 Read SIM file request |
|
331 aReader - reader ID |
|
332 aPath - path to read from |
|
333 aOffset - offset |
|
334 aSize - size to be read |
|
335 **/ |
|
336 typedef void ( *WIMI_ReadSimFileReq_t )( TUint8 aReader, |
|
337 TUint8* aPath, |
|
338 TUint16 aOffset, |
|
339 TUint16 aSize ); |
|
340 |
|
341 /** |
|
342 Provisioning file response |
|
343 aTrId - transaction ID |
|
344 aStatus - operation status |
|
345 aFileLen - lenght of file |
|
346 aFile - file content |
|
347 **/ |
|
348 typedef void (*WIMI_ProvSCFileResp_t)( WIMI_TransactId_t aTrId, |
|
349 WIMI_STAT aStatus, |
|
350 TUint16 aFileLen, |
|
351 TUint8* aFile ); |
|
352 |
|
353 /* WIMI Callbacks */ |
|
354 typedef struct __WIMI_CALLBACKS |
|
355 { |
|
356 WIMI_InitResp_t InitOkResp; |
|
357 WIMI_CloseDownResp_t CloseDownResp; |
|
358 WIMI_SignResp_t SignResp; |
|
359 WIMI_CertificateResp_t CertificateResp; |
|
360 WIMI_CertificateDeleteResp_t CertificateDeleteResp; |
|
361 WIMI_CertificateStoreResp_t CertificateStoreResp; |
|
362 WIMI_VerifyPINResp_t VerifyPINResp; |
|
363 WIMI_ChangePINResp_t ChangePINResp; |
|
364 WIMI_UnblockPINResp_t UnblockPINResp; |
|
365 WIMI_EnablePINResp_t EnablePINResp; |
|
366 WIMI_CardInsertedResp_t CardInsertedResp; |
|
367 WIMI_Open_t Open; |
|
368 WIMI_Close_t Close; |
|
369 WIMI_APDUReq_t APDUReq; |
|
370 WIMI_GetATRReq_t GetATRReq; |
|
371 WIMI_GetReaderListReq_t GetReaderListReq; |
|
372 WIMI_ReadSimFileReq_t ReadSimFileReq; |
|
373 WIMI_ProvSCFileResp_t ProvSCFileResp; |
|
374 } WIMI_Callbacks_t; |
|
375 |
|
376 /* ------------ Memory allocation/deallocation functions ------------------ */ |
|
377 |
|
378 /** |
|
379 Allocate memory block |
|
380 aMemorySize - size of memory block to be allocated |
|
381 **/ |
|
382 void* WSL_OS_Malloc( size_t aMemorySize ); |
|
383 |
|
384 /** |
|
385 Deallocate memory block |
|
386 aBuffer - Pointer to memory to be freed |
|
387 **/ |
|
388 void WSL_OS_Free( void* aBuffer ); |
|
389 |
|
390 /* ------------ WIMI initialization and closing --------------------------- */ |
|
391 |
|
392 /** |
|
393 WIMI initialization request. |
|
394 WIMI should be initialized before WIM operations. |
|
395 aCb parameter should point to the temporary structure |
|
396 which can be deallocated after function call |
|
397 **/ |
|
398 WIMI_STAT WIMI_InitializeReq( WIMI_Callbacks_t* aCb ); |
|
399 |
|
400 /** |
|
401 WIMI close request. |
|
402 **/ |
|
403 WIMI_STAT WIMI_CloseDownReq( void ); |
|
404 |
|
405 /* ------------ Referencies ----------------------------------------------- */ |
|
406 /** |
|
407 Copy and dealloc references |
|
408 Creates a copy of reference. Function doesn't check reference validity. |
|
409 Returns NULL in case of memory allocation failure. |
|
410 aRef - reference to be copied |
|
411 **/ |
|
412 WIMI_Ref_t* copy_WIMI_Ref_t( WIMI_Ref_t* aRef ); |
|
413 |
|
414 /* Deallocates memory occupied by reference. |
|
415 aRef - reference to be freed |
|
416 **/ |
|
417 void free_WIMI_Ref_t( WIMI_Ref_t* aRef ); |
|
418 |
|
419 /** |
|
420 Creates a copy of reference list. Function doesn't check references |
|
421 validity. Returns NULL in case of memory allocation failure. |
|
422 aList - reference list to be copied |
|
423 **/ |
|
424 WIMI_RefList_t copy_WIMI_RefList_t( WIMI_RefList_t aList ); |
|
425 |
|
426 /** |
|
427 Deallocates memory occupied by reference list. |
|
428 aList - reference list to be freed |
|
429 **/ |
|
430 void free_WIMI_RefList_t( WIMI_RefList_t aList ); |
|
431 |
|
432 /* ------------ Digital signature ----------------------------------------- */ |
|
433 /** |
|
434 Digital signature request. Signed data is returned in callback. |
|
435 aTrId - transaction id. |
|
436 User application data that will be provided in respond callback |
|
437 to match request/response. |
|
438 aHash - SHA1 hash of data to be signed. |
|
439 aHashLen - length of hash |
|
440 aKeyRef - key reference which should be used for sign operaition. |
|
441 aPin - PIN code for the referenced key. |
|
442 **/ |
|
443 WIMI_STAT WIMI_SignReq( WIMI_TransactId_t aTrId, |
|
444 TUint8* aHash, |
|
445 TUint8 aHashLen, |
|
446 WIMI_Ref_t* aKeyRef, |
|
447 WIMI_BinData_t* aPin ); |
|
448 |
|
449 /* ------------ Label list ------------------------------------------------ */ |
|
450 /** |
|
451 Returns label list for specified reference list. |
|
452 All references in a list should be of one type. |
|
453 Possible reference types are: PIN, KEY or Certificate. |
|
454 aElNum - IN - number of elements |
|
455 aRefList - IN - list of references |
|
456 aLabelList - OUT - string list. Should be freed by caller. |
|
457 **/ |
|
458 WIMI_STAT WIMI_GetLabelList( TUint8 aElNum, |
|
459 WIMI_RefList_t aRefList, |
|
460 WIMI_labellist_t* aLabelList ); |
|
461 |
|
462 /* ------------ Key management -------------------------------------------- */ |
|
463 /** |
|
464 Returns key list for one WIM. |
|
465 aWimRef - IN - WIM reference |
|
466 aKeyNum - OUT - number of returned keys |
|
467 aRefList - OUT - key list. Should be freed by caller. |
|
468 **/ |
|
469 WIMI_STAT WIMI_GetKeyListByWIM( WIMI_Ref_t* aWimRef, |
|
470 TUint16* aKeyNum, |
|
471 WIMI_RefList_t* aRefList ); |
|
472 |
|
473 /** |
|
474 Returns key reference by given key hash. |
|
475 aHash - IN - SHA1 hash of the public key. |
|
476 aKeyRef - OUT - Allocated key reference. Should be freed by caller. |
|
477 **/ |
|
478 WIMI_STAT WIMI_GetKeyByHash( TUint8* aHash, |
|
479 WIMI_Ref_t** aKeyRef ); |
|
480 |
|
481 /** |
|
482 Returns info for referenced key. |
|
483 aKeyRef - IN - key reference |
|
484 aWimRef - OUT - reference to WIM where certificate reside. Freed by caller |
|
485 aPin - OUT - PIN code that protects key |
|
486 aKeyType - OUT - key type (1 = RSA, 2 = ECC) |
|
487 aKeyNumber - OUT - the number of current key |
|
488 aPinNumber - OUT - PIN number |
|
489 aUsage - OUT - PKCS15 key usage flags. See #defines in wimi_types.h |
|
490 aKeyId - OUT - hash of public key. Should be deallocated by caller. |
|
491 aLabel - OUT - key label. Should be deallocated by caller |
|
492 aKeyLength - OUT - key length in bits |
|
493 **/ |
|
494 WIMI_STAT WIMI_GetKeyInfo( WIMI_Ref_t* aKeyRef, |
|
495 WIMI_Ref_t** aWimRef, |
|
496 WIMI_Ref_t** aPin, |
|
497 TUint8* aKeyType, |
|
498 TUint8* aKeyNumber, |
|
499 TUint8* aPinNumber, |
|
500 TUint16* aUsage, |
|
501 WIMI_BinData_t* aKeyId, |
|
502 WIMI_BinData_t* aLabel, |
|
503 TUint16* aKeyLength ); /* in bits */ |
|
504 |
|
505 |
|
506 /* ------------ Certificate management ------------------------------------ */ |
|
507 /** |
|
508 Returns list of referencies to client certificates on all WIMs with |
|
509 the same client key reference. |
|
510 aKeyRef - IN - key reference |
|
511 aCertCount - OUT - certificate number |
|
512 aRefList - OUT - allocated reference list. Should be freed by caller |
|
513 **/ |
|
514 WIMI_STAT WIMI_GetClCertificateListByKey( WIMI_Ref_t* aKeyRef, |
|
515 TUint8* aCertCount, |
|
516 WIMI_RefList_t* aRefList ); |
|
517 |
|
518 /** |
|
519 Returns list of referencies to certificates on all WIMs with the same |
|
520 public key (hash). |
|
521 aHash - IN - key hash |
|
522 aUsage - IN - certificate purpose (0 = client, 1 = CA) |
|
523 aCertCount - OUT - certificate count |
|
524 aRefList - OUT - allocated reference list. Should be freed by caller |
|
525 **/ |
|
526 WIMI_STAT WIMI_GetCertificateListByKeyHash( TUint8* aHash, |
|
527 TUint8 aUsage, |
|
528 TUint8* aCertCount, |
|
529 WIMI_RefList_t* aRefList ); |
|
530 |
|
531 /** |
|
532 Returns list of referencies to certificates on all WIMs with the same |
|
533 public key (hash). |
|
534 aCAHash - IN - key hash |
|
535 aUsage - IN - certificate purpose |
|
536 aCertNum - OUT - certificate number |
|
537 aRefList - OUT - allocated reference list. Should be freed by caller |
|
538 **/ |
|
539 WIMI_STAT WIMI_GetCertificateListByCAKeyHash( TUint8* aCAHash, |
|
540 TUint8 aUsage, |
|
541 TUint8* aCertNum, |
|
542 WIMI_RefList_t* aRefList ); |
|
543 |
|
544 /** |
|
545 Returns list of referencies to certificates on a WIM. |
|
546 aWimRef - IN - WIM reference |
|
547 aUsage - IN - Certificate usage (0 = client, 1 = CA) |
|
548 aCertNum - OUT - certificate number |
|
549 aRefList - OUT - allocated reference list. Should be freed by caller |
|
550 **/ |
|
551 WIMI_STAT WIMI_GetCertificateListByWIM( WIMI_Ref_t* aWimRef, |
|
552 TUint8 aUsage, |
|
553 TUint8* aCertNum, |
|
554 WIMI_RefList_t* aRefList ); |
|
555 |
|
556 /** |
|
557 Returns information about certificate stored in WIM |
|
558 aCert - IN - cert. reference. |
|
559 aWimRef - OUT - reference to WIM where cert is stored. Freed by caller |
|
560 aLabel - OUT - certificate label. pb_buf pointer in structure |
|
561 points to allocated buffer that should be deallocated by caller |
|
562 aKeyId - OUT - hash of public key. pb_buf pointer in WIMI_BinData_t struct |
|
563 points to allocated buffer that should be deallocated by caller |
|
564 aCAId - OUT - hash of issuer public key. pb_buf pointer in WIMI_BinData_t |
|
565 structure points to allocated buffer that should be deallocated by caller |
|
566 aTrustedUsage - OUT - trusted usage OID's for this certificate |
|
567 aCDFRefs - OUT - information about the CDF that the certificate was |
|
568 referenced. Possible values: WIMLIB_CERTIFICATES_CDF, |
|
569 WIMLIB_TRUSTEDCERTS_CDF, WIMLIB_USEFULCERTS_CDF |
|
570 aUsage - OUT - 0 = client, 1 = CA |
|
571 aType - OUT - WTLSCert(1), X509Cert(2), X968Cert(3), CertURL(4) |
|
572 aCertlen - OUT - length of certificate content |
|
573 **/ |
|
574 WIMI_STAT WIMI_GetCertificateInfo( WIMI_Ref_t* aCert, |
|
575 WIMI_Ref_t** aWimRef, |
|
576 WIMI_BinData_t* aLabel, |
|
577 WIMI_BinData_t* aKeyID, |
|
578 WIMI_BinData_t* aCAId, |
|
579 WIMI_BinData_t* aIssuerNameHash, |
|
580 WIMI_BinData_t* aTrustedUsage, |
|
581 TUint8* aCDFRefs, |
|
582 TUint8* aUsage, |
|
583 TUint8* aType, |
|
584 TUint16* aCertLen, |
|
585 TUint8* aModifiable ); |
|
586 |
|
587 /** |
|
588 Requests certificate contents from WIM. |
|
589 aTrId - transaction id. |
|
590 User application data that will be provided in respond callback |
|
591 to match request/response. |
|
592 aCertRef - certificate reference |
|
593 aCert - retrieved certificate |
|
594 **/ |
|
595 WIMI_STAT WIMI_CertificateReqT( WIMI_TransactId_t aTrId, |
|
596 WIMI_Ref_t* aCertRef, |
|
597 WIMI_BinData_t* aCert ); |
|
598 |
|
599 /** |
|
600 Requests certificate contents from WIM. |
|
601 aTrId - transaction id. |
|
602 User application data that will be provided in respond callback |
|
603 to match request/response. |
|
604 aCertRef - certificate reference |
|
605 **/ |
|
606 WIMI_STAT WIMI_CertificateReq( WIMI_TransactId_t aTrId, |
|
607 WIMI_Ref_t* aCertRef ); |
|
608 |
|
609 /** |
|
610 Requests certificate to be deleted from WIM. |
|
611 aTrId - transaction id. |
|
612 User application data that will be provided in respond callback |
|
613 to match request/response. |
|
614 aCertRef - certificate reference |
|
615 **/ |
|
616 WIMI_STAT WIMI_CertificateDeleteReq( WIMI_TransactId_t aTrId, |
|
617 WIMI_Ref_t* aCertRef ); |
|
618 /** |
|
619 Requests certificate to be stored to WIM. |
|
620 aTrId - transaction id. |
|
621 User application data that will be provided in respond callback |
|
622 to match request/response. |
|
623 aWimRef - WIM reference where to store the certificate |
|
624 aLabel - certificate label |
|
625 aKeyId - hash of public key. |
|
626 aCAId - hash of issuer public key. |
|
627 aIssuerNameHash - Issuer name hash |
|
628 aSubjectNameHash - Subject name hash |
|
629 aUsage - 0 = client, 1 = CA |
|
630 aType - WTLSCert(1), X509Cert(2), X968Cert(3), CertURL(4) |
|
631 aCertLen - certificate contents len |
|
632 aCert - certificate contents |
|
633 **/ |
|
634 WIMI_STAT WIMI_CertificateStoreReq( WIMI_TransactId_t aTrId, |
|
635 WIMI_Ref_t* aWimRef, |
|
636 WIMI_BinData_t* aLabel, |
|
637 WIMI_BinData_t* aKeyId, |
|
638 WIMI_BinData_t* aCAId, |
|
639 WIMI_BinData_t* aIssuerNameHash, |
|
640 WIMI_BinData_t* aSubjectNameHash, |
|
641 TUint8 aUsage, |
|
642 TUint8 aType, |
|
643 TUint16 aCertLen, |
|
644 TUint8* aCert ); |
|
645 |
|
646 /* ------------ PIN management -------------------------------------------- */ |
|
647 /** |
|
648 Returns status of PIN |
|
649 aPinRef - IN - PIN reference |
|
650 aWimRef - OUT - WIM reference. Should be freed by caller. |
|
651 aFlags - OUT - bitmask WIMI_PF_Enabled, WIMI_PF_ChangeDisabled, |
|
652 WIMI_PF_UnblockDisabled and WIMI_PF_DisableAllowed |
|
653 minlength - OUT - minimal PIN length |
|
654 aPinNumber - OUT - the number of the pin |
|
655 aLabel - OUT - PIN label - Should be deallocated by caller. |
|
656 **/ |
|
657 WIMI_STAT WIMI_GetPINStatus( WIMI_Ref_t* aPinRef, |
|
658 WIMI_Ref_t** aWimRef, |
|
659 TUint8* aFlags, |
|
660 TUint8* aMinlength, |
|
661 TUint8* aPinNumber, |
|
662 WIMI_BinData_t* aLabel ); |
|
663 |
|
664 /** |
|
665 Returns Info of Authobj |
|
666 pWIMref -IN WIM reference |
|
667 authId -IN Authobj Id |
|
668 pt_lable -OUT |
|
669 flags -OUT |
|
670 pinnumber -OUT |
|
671 minlength -OUT |
|
672 maxlength -OUT |
|
673 pinType -OUT |
|
674 storedlength -OUT |
|
675 pinReference -OUT |
|
676 padChar -OUT |
|
677 **/ |
|
678 WIMI_STAT WIMI_GetAuthObjInfo( WIMI_Ref_t* pWIMref, |
|
679 TUint32* authId, |
|
680 WIMI_BinData_t* pt_label, |
|
681 TUint16* flags, |
|
682 TUint8* pinnumber, |
|
683 TUint8* minLength, |
|
684 TUint8* maxLength, |
|
685 TUint8* pinType, |
|
686 TUint8* storedLength, |
|
687 TUint8* pinReference, |
|
688 TUint8* padChar ); |
|
689 |
|
690 /** |
|
691 Returns the PINs list for one WIM. |
|
692 If aWimRef is NULL, then returns the list for all WIMs. |
|
693 aWimRef - IN - WIMI reference |
|
694 aPinNum - OUT - number of PIN in list |
|
695 aRefList - OUT - allocated PIN list. Should be freed by caller. |
|
696 **/ |
|
697 WIMI_STAT WIMI_GetPINList( WIMI_Ref_t* aWimRef, |
|
698 TUint16* aPinNum, |
|
699 WIMI_RefList_t* aRefList ); |
|
700 |
|
701 /** |
|
702 PIN verify request. If WIM general PIN is given then WIM becomes open after |
|
703 successful verify operation |
|
704 aTrId - transaction id. |
|
705 User application data that will be provided in respond callback to |
|
706 match request/response. |
|
707 aPinRrf - PIN reference |
|
708 aPinLen - entered PIN length |
|
709 aPin - entered PIN data |
|
710 **/ |
|
711 WIMI_STAT WIMI_VerifyPINReq( WIMI_TransactId_t aTrId, |
|
712 WIMI_Ref_t* aPinRef, |
|
713 TUint8 aPinLen, |
|
714 TUint8* aPin ); |
|
715 |
|
716 /** |
|
717 PIN change request. |
|
718 aTrId - transaction id. |
|
719 User application data that will be provided in respond callback |
|
720 to match request/response. |
|
721 aPinRef - PIN reference |
|
722 aOldPinLen - old PIN length |
|
723 aOldPin - old PIN for granting operation permission |
|
724 aNewPinLen - new PIN length |
|
725 aNewPin - new PIN that should replace old |
|
726 **/ |
|
727 WIMI_STAT WIMI_ChangePINReq( WIMI_TransactId_t aTrId, |
|
728 WIMI_Ref_t* aPinRef, |
|
729 TUint8 aOldPinLen, |
|
730 TUint8* aOldPin, |
|
731 TUint8 aNewPinLen, |
|
732 TUint8* aNewPin ); |
|
733 |
|
734 /** |
|
735 PIN unblock request. |
|
736 aTrId - transaction id. |
|
737 User application data that will be provided in respond |
|
738 callback to match request/response. |
|
739 aPinRef - PIN reference |
|
740 aUnblockPinLen - length of unblocking code |
|
741 aUnblockPin - unblocking code |
|
742 aNewPinLen - new PIN length |
|
743 aNewPin - new PIN that should replace old after unblocking |
|
744 **/ |
|
745 WIMI_STAT WIMI_UnblockPINReq( WIMI_TransactId_t aTrId, |
|
746 WIMI_Ref_t* aPinRef, |
|
747 TUint8 aUnblockPinLen, |
|
748 TUint8* aUnblockPin, |
|
749 TUint8 aNewPinLen, |
|
750 TUint8* aNewPin ); |
|
751 |
|
752 /** |
|
753 Enable or disable PIN request. |
|
754 aTrId - transaction id. |
|
755 User application data that will be provided in respond callback |
|
756 to match request/response. |
|
757 aPinRef - PIN reference |
|
758 aPinLen - PIN length |
|
759 aPin - PIN for granting operation permission |
|
760 aEnable - if TRUE then enable else disable |
|
761 **/ |
|
762 WIMI_STAT WIMI_EnablePINReq( WIMI_TransactId_t aTrId, |
|
763 WIMI_Ref_t* aPinRef, |
|
764 TUint8 aPinLen, |
|
765 TUint8* aPin, |
|
766 TBool aEnable ); |
|
767 |
|
768 /* ------------ Hardware driver support ----------------------------------- */ |
|
769 /** |
|
770 Returns WIM information. |
|
771 aWimRef - IN - WIM reference. |
|
772 aFlags - OUT - reserved for future use |
|
773 aSESet - OUT - security environments bitset. See WIMI_SE_ constants |
|
774 aWimId - OUT - WIM serial number - pb_buf pointer in WIMI_BinData_t |
|
775 should be deallocated by caller |
|
776 aManufacturerId - OUT - manufacturer info - Should be |
|
777 deallocated by caller |
|
778 aLabel - OUT - WIM label - pb_buf pointer in WIMI_BinData_t structure |
|
779 should be deallocated by caller |
|
780 aReader - OUT - reader ID |
|
781 aPinG - OUT - reference to PIN-G |
|
782 aSim - OUT - if TRUE then WIM is SIM only |
|
783 aVersion - OUT - version |
|
784 **/ |
|
785 WIMI_STAT WIMI_GetWIMInfo( WIMI_Ref_t* aWimRef, |
|
786 TUint16* aFlags, |
|
787 TUint8* aSESet, |
|
788 WIMI_BinData_t* aWimId, |
|
789 WIMI_BinData_t* aManufacturerId, |
|
790 WIMI_BinData_t* aLabel, |
|
791 TUint8* aReader, |
|
792 WIMI_Ref_t** aPinG, |
|
793 TBool* aSim, |
|
794 TUint8* aVersion); |
|
795 |
|
796 /** |
|
797 Returns TRUE if WIM is already opened by general PIN |
|
798 aWimRef - WIM reference |
|
799 **/ |
|
800 TUint8 WIMI_IsWIMOpened( WIMI_Ref_t* aWimRef ); |
|
801 |
|
802 /** |
|
803 Closes the WIM. WIM can be reopened with VerifyPIN operation. |
|
804 aWimRef - WIM reference |
|
805 **/ |
|
806 WIMI_STAT WIMI_CloseWIM( WIMI_Ref_t* aWimRef ); |
|
807 |
|
808 /** |
|
809 Returns the reference of WIM currently associated with reader. |
|
810 Returns valid reference if WIM card is inserted and initialized, |
|
811 other case NULL. |
|
812 aReader - reader number - 0-7 |
|
813 **/ |
|
814 WIMI_Ref_t* WIMI_GetWIMRef( TUint8 aReader ); |
|
815 |
|
816 /** |
|
817 Starts the initialization of newly inserted card. |
|
818 aReader - reader number - 0-7 |
|
819 **/ |
|
820 WIMI_STAT WIMI_CardInsertedReq( TUint8 aReader ); |
|
821 |
|
822 /** |
|
823 Informs WIMI that card was removed from reader. |
|
824 aReader - reader number - 0-7 |
|
825 **/ |
|
826 WIMI_STAT WIMI_CardRemoved( TUint8 aReader ); |
|
827 |
|
828 /** |
|
829 APDU respond from smartcard driver processing. |
|
830 aReader - reader number - 0-7 |
|
831 aStatus - WIMI_APDU_ codes |
|
832 aAPDU - received APDU |
|
833 aSw - status word for APDU codec support |
|
834 **/ |
|
835 void WIMI_APDUResp( TUint8 aReader, |
|
836 TUint8 aStatus, |
|
837 WIMI_BinData_t* aAPDU, |
|
838 TUint16 aSw ); |
|
839 |
|
840 /** |
|
841 ATR respond from smartcard driver processing. |
|
842 aReader - reader number - 0-7 |
|
843 aStatus - WIMI_APDU_ codes |
|
844 aATR - ATR |
|
845 **/ |
|
846 void WIMI_GetATRResp( TUint8 aReader, |
|
847 TUint8 aStatus, |
|
848 WIMI_BinData_t* aATR ); |
|
849 |
|
850 /** |
|
851 Respond for a reader list request. |
|
852 aStatus - WIMI_APDU_ codes |
|
853 aList - list of card reader statuses |
|
854 Status = 0 \ |
|
855 1 ) CardReaderIdentity 0-7 |
|
856 2 / |
|
857 3 Card reader is not removable |
|
858 4 Card reader is present |
|
859 5 Card reader is ID-1 size |
|
860 6 Card is present in reader |
|
861 7 Card in reader is powered on |
|
862 **/ |
|
863 void WIMI_GetReaderListResp( TUint8 aStatus, |
|
864 WIMI_BinData_t* aList ); |
|
865 |
|
866 /** |
|
867 Free memory |
|
868 aMem - Pointer to memory area to be freed |
|
869 **/ |
|
870 void WIMI_Free( void* aMem ); |
|
871 |
|
872 /** |
|
873 Respond to ReadSimFileReq |
|
874 aReader - reader number |
|
875 aStatus - error code for file reading |
|
876 aData - content of read file |
|
877 **/ |
|
878 void WIMI_SIM_ReadFileResp( TUint8 aReader, |
|
879 TUint8 aStatus, |
|
880 WIMI_BinData_t* aData ); |
|
881 |
|
882 /** |
|
883 Return information of OMA Provisioning file on card |
|
884 aWimRef - IN - WIM reference |
|
885 aFileInfos - OUT - File info structure |
|
886 aFileCount - OUT - Count of provisioning files |
|
887 **/ |
|
888 WIMI_STAT WIMI_OMAFileInfo( WIMI_Ref_t* aWimRef, |
|
889 WIMI_File_Info** aFileInfos, |
|
890 TUint16* aFileCount ); |
|
891 |
|
892 /** |
|
893 Return information of Java Provisioning file on card |
|
894 aWimRef - IN - WIM reference |
|
895 aFileInfos - OUT - File info structure |
|
896 aFileCount - OUT - Count of provisioning files |
|
897 **/ |
|
898 WIMI_STAT WIMI_JAVAFileInfo( WIMI_Ref_t* aWIMref, |
|
899 WIMI_File_Info** aFileInfos, |
|
900 TUint16* aFileCount ); |
|
901 /** |
|
902 Get WIM count |
|
903 aWimRef - IN - WIM reference. |
|
904 aWimCount - OUT - count of WIMs |
|
905 **/ |
|
906 WIMI_STAT WIMI_GetWIMCount( WIMI_Ref_t* aWimRef, TUint8* aWimCount ); |
|
907 |
|
908 /** |
|
909 Get content of OMA Provisioning file. Content is returned by callback. |
|
910 aTrId - IN - Transaction ID |
|
911 aWimRef - IN - WIM reference |
|
912 aFileSize - IN - File size |
|
913 aPath - IN - File path |
|
914 **/ |
|
915 WIMI_STAT WIMI_GetOMAFile( WIMI_TransactId_t aTrId, |
|
916 WIMI_Ref_t* aWimRef, |
|
917 TUint16 aFileSize, |
|
918 WIM_BIN_DATA* aPath ); |
|
919 |
|
920 /** |
|
921 Get content of OMA Provisioning file. Synchronous version. |
|
922 aTrId - IN - Transaction ID |
|
923 aWimRef - IN - WIM reference |
|
924 aPath - IN - File path |
|
925 aFileMaxSize - IN - Not used |
|
926 aFileContent - OUT - File content. Buffer allocated by WIMI, must be freed |
|
927 by caller. |
|
928 **/ |
|
929 WIMI_STAT WIMI_GetOMAFileSync( WIMI_TransactId_t aTrId, |
|
930 WIMI_Ref_t* aWimRef, |
|
931 WIM_BIN_DATA* aPath, |
|
932 TUint16 aFileMaxSize, |
|
933 WIM_BIN_DATA* aFileContent ); |
|
934 |
|
935 |
|
936 /** |
|
937 Return content of JAVA Provisioning file on card |
|
938 pWimRef - IN - WIM reference |
|
939 pt_path - IN - File path |
|
940 pt_file_content - OUT |
|
941 **/ |
|
942 WIMI_STAT WIMI_GetJAVAFile( WIMI_Ref_t* pWIMref, |
|
943 WIM_BIN_DATA* pt_path, |
|
944 WIM_BIN_DATA* pt_file_content ); |
|
945 |
|
946 |
|
947 /** |
|
948 Return content of WIM label and path |
|
949 pWimRef - IN - WIM reference |
|
950 path - OUT - File path |
|
951 label - OUT |
|
952 **/ |
|
953 WIMI_STAT WIMI_GetLabelAndPath(WIMI_Ref_t* pWIMref, |
|
954 WIM_BIN_DATA* path, |
|
955 WIM_BIN_DATA* label ); |
|
956 |
|
957 #ifdef __cplusplus |
|
958 } |
|
959 #endif |
|
960 |
|
961 #endif // WIMI_H |
|
962 |
|
963 // End of File |