bump product version to 4.1.6.2
[LibreOffice.git] / libxmlsec / include / tokens.h
blobc7c0fa1ed5002d0deb290c35bda5ec774ce0824d
1 /**
2 * XMLSec library
4 * This is free software; see Copyright file in the source
5 * distribution for preciese wording.
7 * Copyright (c) 2003 Sun Microsystems, Inc. All rights reserved.
9 * Contributor(s): _____________________________
12 #ifndef __XMLSEC_NSS_TOKENS_H__
13 #define __XMLSEC_NSS_TOKENS_H__
15 #include <string.h>
17 #include <nss.h>
18 #include <pk11func.h>
20 #include <xmlsec/xmlsec.h>
21 #include <xmlsec/list.h>
23 #ifdef __cplusplus
24 extern "C" {
25 #endif /* __cplusplus */
27 /**
28 * xmlSecNssKeySlotListId
30 * The crypto mechanism list klass
32 #define xmlSecNssKeySlotListId xmlSecNssKeySlotListGetKlass()
33 XMLSEC_CRYPTO_EXPORT xmlSecPtrListId xmlSecNssKeySlotListGetKlass( void ) ;
35 /*******************************************
36 * KeySlot interfaces
37 *******************************************/
38 /**
39 * Internal NSS key slot data
40 * @mechanismList: the mechanisms that the slot bound with.
41 * @slot: the pkcs slot
43 * This context is located after xmlSecPtrList
45 typedef struct _xmlSecNssKeySlot xmlSecNssKeySlot ;
46 typedef struct _xmlSecNssKeySlot* xmlSecNssKeySlotPtr ;
48 struct _xmlSecNssKeySlot {
49 CK_MECHANISM_TYPE_PTR mechanismList ; /* mech. array, NULL ternimated */
50 PK11SlotInfo* slot ;
51 } ;
53 XMLSEC_CRYPTO_EXPORT int
54 xmlSecNssKeySlotSetMechList(
55 xmlSecNssKeySlotPtr keySlot ,
56 CK_MECHANISM_TYPE_PTR mechanismList
57 ) ;
59 XMLSEC_CRYPTO_EXPORT int
60 xmlSecNssKeySlotEnableMech(
61 xmlSecNssKeySlotPtr keySlot ,
62 CK_MECHANISM_TYPE mechanism
63 ) ;
65 XMLSEC_CRYPTO_EXPORT int
66 xmlSecNssKeySlotDisableMech(
67 xmlSecNssKeySlotPtr keySlot ,
68 CK_MECHANISM_TYPE mechanism
69 ) ;
71 XMLSEC_CRYPTO_EXPORT CK_MECHANISM_TYPE_PTR
72 xmlSecNssKeySlotGetMechList(
73 xmlSecNssKeySlotPtr keySlot
74 ) ;
76 XMLSEC_CRYPTO_EXPORT int
77 xmlSecNssKeySlotSetSlot(
78 xmlSecNssKeySlotPtr keySlot ,
79 PK11SlotInfo* slot
80 ) ;
82 XMLSEC_CRYPTO_EXPORT int
83 xmlSecNssKeySlotInitialize(
84 xmlSecNssKeySlotPtr keySlot ,
85 PK11SlotInfo* slot
86 ) ;
88 XMLSEC_CRYPTO_EXPORT void
89 xmlSecNssKeySlotFinalize(
90 xmlSecNssKeySlotPtr keySlot
91 ) ;
93 XMLSEC_CRYPTO_EXPORT PK11SlotInfo*
94 xmlSecNssKeySlotGetSlot(
95 xmlSecNssKeySlotPtr keySlot
96 ) ;
98 XMLSEC_CRYPTO_EXPORT xmlSecNssKeySlotPtr
99 xmlSecNssKeySlotCreate() ;
101 XMLSEC_CRYPTO_EXPORT int
102 xmlSecNssKeySlotCopy(
103 xmlSecNssKeySlotPtr newKeySlot ,
104 xmlSecNssKeySlotPtr keySlot
107 XMLSEC_CRYPTO_EXPORT xmlSecNssKeySlotPtr
108 xmlSecNssKeySlotDuplicate(
109 xmlSecNssKeySlotPtr keySlot
112 XMLSEC_CRYPTO_EXPORT void
113 xmlSecNssKeySlotDestroy(
114 xmlSecNssKeySlotPtr keySlot
117 XMLSEC_CRYPTO_EXPORT int
118 xmlSecNssKeySlotBindMech(
119 xmlSecNssKeySlotPtr keySlot ,
120 CK_MECHANISM_TYPE type
123 XMLSEC_CRYPTO_EXPORT int
124 xmlSecNssKeySlotSupportMech(
125 xmlSecNssKeySlotPtr keySlot ,
126 CK_MECHANISM_TYPE type
130 /************************************************************************
131 * PKCS#11 crypto token interfaces
133 * A PKCS#11 slot repository will be defined internally. From the
134 * repository, a user can specify a particular slot for a certain crypto
135 * mechanism.
137 * In some situation, some cryptographic operation should act in a user
138 * designated devices. The interfaces defined here provide the way. If
139 * the user do not initialize the repository distinctly, the interfaces
140 * use the default functions provided by NSS itself.
142 ************************************************************************/
144 * Initialize NSS pkcs#11 slot repository
146 * Returns 0 if success or -1 if an error occurs.
148 XMLSEC_CRYPTO_EXPORT int xmlSecNssSlotInitialize( void ) ;
151 * Shutdown and destroy NSS pkcs#11 slot repository
153 XMLSEC_CRYPTO_EXPORT void xmlSecNssSlotShutdown() ;
156 * Get PKCS#11 slot handler
157 * @type the mechanism that the slot must support.
159 * Returns a pointer to PKCS#11 slot or NULL if an error occurs.
161 * Notes: The returned handler must be destroied distinctly.
163 XMLSEC_CRYPTO_EXPORT PK11SlotInfo* xmlSecNssSlotGet( CK_MECHANISM_TYPE type ) ;
166 * Adopt a pkcs#11 slot with a mechanism into the repository
167 * @slot: the pkcs#11 slot.
168 * @mech: the mechanism.
170 * If @mech is available( @mech != CKM_INVALID_MECHANISM ), every operation with
171 * this mechanism only can perform on the @slot.
173 * Returns 0 if success or -1 if an error occurs.
175 XMLSEC_CRYPTO_EXPORT int xmlSecNssSlotAdopt( PK11SlotInfo* slot, CK_MECHANISM_TYPE mech ) ;
177 #ifdef __cplusplus
179 #endif /* __cplusplus */
181 #endif /* __XMLSEC_NSS_TOKENS_H__ */