1 /***************************************************************************
2  $RCSfile$
3                              -------------------
4     cvs         : $Id: crypttoken.h 1113 2007-01-10 09:14:16Z martin $
5     begin       : Wed Mar 16 2005
6     copyright   : (C) 2005 by Martin Preuss
7     email       : martin@libchipcard.de
8 
9  ***************************************************************************
10  *          Please see toplevel file COPYING for license details           *
11  ***************************************************************************/
12 
13 
14 #ifndef GWEN_CRYPT_TOKEN_PLUGIN_H
15 #define GWEN_CRYPT_TOKEN_PLUGIN_H
16 
17 
18 #include <gwenhywfar/gwenhywfarapi.h>
19 #include <gwenhywfar/plugin.h>
20 #include <gwenhywfar/ct.h>
21 
22 
23 
24 #define GWEN_CRYPT_TOKEN_PLUGIN_TYPENAME "ct"
25 #define GWEN_CRYPT_TOKEN_FOLDER "ct"
26 
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 
33 GWENHYWFAR_API GWEN_CRYPT_TOKEN *GWEN_Crypt_Token_Plugin_CreateToken(GWEN_PLUGIN *pl, const char *name);
34 
35 
36 
37 /**
38  * <p>This function is used to let a crypt token plugin check whether it
39  * supports a given plugin.</p>
40  * <p>Initially the given buffers may contain some values to narrow the
41  * search. For chip cards the <i>name</i> argument may contain the serial
42  * number of the card (if known). For file based crypt tokens this argument
43  * must contain the path to the file to check.</p>
44  *
45  * This function should return one of the following error codes:
46  * <ul>
47  *  <li>GWEN_SUCCESS: CryptToken is supported by this plugin, the buffers
48  *   for typeName, subTypeName and name are updated accordingly</li>
49  *  <li>GWEN_ERROR_CT_NOT_IMPLEMENTED: function not implmented</li>
50  *  <li>GWEN_ERROR_CT_NOT_SUPPORTED: medium not supported by this plugin</li>
51  *  <li>GWEN_ERROR_CT_BAD_NAME: Medium is supported but the name doesn't
52  *      match that of the currently checked medium</li>
53  *  <li>GWEN_ERROR_CT_IO_ERROR: any type of IO error occurred</li>
54  *  <li>other codes as appropriate</li>
55  * </ul>
56  */
57 GWENHYWFAR_API int GWEN_Crypt_Token_Plugin_CheckToken(GWEN_PLUGIN *pl, GWEN_BUFFER *name);
58 
59 GWENHYWFAR_API GWEN_CRYPT_TOKEN_DEVICE GWEN_Crypt_Token_Plugin_GetDeviceType(const GWEN_PLUGIN *pl);
60 
61 
62 
63 
64 
65 /** @name CryptManager
66  *
67  */
68 /*@{*/
69 
70 /**
71  * This function tries to find a token plugin which is able to handle the
72  * token given by the device type and name.
73  */
74 GWENHYWFAR_API int GWEN_Crypt_Token_PluginManager_CheckToken(GWEN_PLUGIN_MANAGER *cm,
75                                                              GWEN_CRYPT_TOKEN_DEVICE devt,
76                                                              GWEN_BUFFER *typeName,
77                                                              GWEN_BUFFER *tokenName,
78                                                              uint32_t guiid);
79 
80 GWENHYWFAR_API
81 GWEN_PLUGIN_DESCRIPTION_LIST2 *GWEN_Crypt_Token_PluginManager_GetPluginDescrs(GWEN_PLUGIN_MANAGER *pm,
82                                                                               GWEN_CRYPT_TOKEN_DEVICE devt);
83 
84 /*@}*/
85 
86 
87 #ifdef __cplusplus
88 }
89 #endif
90 
91 
92 
93 #endif
94 
95 
96