1 /***************************************************************************
2     begin       : Wed Mar 16 2005
3     copyright   : (C) 2005-2010 by Martin Preuss
4     email       : martin@libchipcard.de
5 
6  ***************************************************************************
7  *          Please see toplevel file COPYING for license details           *
8  ***************************************************************************/
9 
10 
11 #ifndef GWEN_CRYPT_TOKEN_FILE_BE_H
12 #define GWEN_CRYPT_TOKEN_FILE_BE_H
13 
14 
15 #include <gwenhywfar/ct_be.h>
16 
17 
18 
19 
20 typedef int GWENHYWFAR_CB
21 (*GWEN_CRYPT_TOKEN_FILE_READ_FN)(GWEN_CRYPT_TOKEN *ct, int fd, uint32_t gid);
22 
23 typedef int GWENHYWFAR_CB
24 (*GWEN_CRYPT_TOKEN_FILE_WRITE_FN)(GWEN_CRYPT_TOKEN *ct, int fd, int cre, uint32_t gid);
25 
26 
27 
28 /**
29  * Key ids: The left 16 bits contain the context index, the right 16 bits contain the
30  * key number:
31  * <ul>
32  *  <li>xx01=localSignKey</li>
33  *  <li>xx02=localCryptKey</li>
34  *  <li>xx03=remoteSignKey</li>
35  *  <li>xx04=remoteCryptKey</li>
36  *  <li>xx05=localAuthKey</li>
37  *  <li>xx06=remoteAuthKey</li>
38  *  <li>xx07=tempLocalSignKey</li>
39  * </ul>
40  */
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 
47 GWENHYWFAR_API
48 GWEN_CRYPT_TOKEN *GWEN_Crypt_TokenFile_new(const char *typeName,
49                                            const char *tokenName);
50 
51 GWENHYWFAR_API
52 GWEN_CRYPT_TOKEN_FILE_READ_FN GWEN_Crypt_TokenFile_SetReadFn(GWEN_CRYPT_TOKEN *ct,
53                                                              GWEN_CRYPT_TOKEN_FILE_READ_FN f);
54 GWENHYWFAR_API
55 GWEN_CRYPT_TOKEN_FILE_WRITE_FN GWEN_Crypt_TokenFile_SetWriteFn(GWEN_CRYPT_TOKEN *ct,
56                                                                GWEN_CRYPT_TOKEN_FILE_WRITE_FN f);
57 
58 GWENHYWFAR_API
59 void GWEN_Crypt_TokenFile_AddContext(GWEN_CRYPT_TOKEN *ct, GWEN_CRYPT_TOKEN_CONTEXT *ctx);
60 
61 GWENHYWFAR_API
62 GWEN_CRYPT_TOKEN_CONTEXT *GWEN_Crypt_TokenFile_GetContext(GWEN_CRYPT_TOKEN *ct, int idx);
63 
64 
65 #ifdef __cplusplus
66 }
67 #endif
68 
69 
70 #endif
71