pkcs11-helper
pkcs11h-token.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2005-2018 Alon Bar-Lev <alon.barlev@gmail.com>
3  *
4  * This software is available to you under a choice of one of two
5  * licenses. You may choose to be licensed under the terms of the GNU
6  * General Public License (GPL) Version 2, or the BSD license.
7  *
8  * GNU General Public License (GPL) Version 2
9  * ===========================================
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License version 2
12  * as published by the Free Software Foundation.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program (see the file COPYING.GPL included with this
21  * distribution); if not, write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  *
24  * BSD License
25  * ============
26  * Redistribution and use in source and binary forms, with or without
27  * modification, are permitted provided that the following conditions are met:
28  *
29  * o Redistributions of source code must retain the above copyright notice,
30  * this list of conditions and the following disclaimer.
31  * o Redistributions in binary form must reproduce the above copyright
32  * notice, this list of conditions and the following disclaimer in the
33  * documentation and/or other materials provided with the distribution.
34  * o Neither the name of the Alon Bar-Lev nor the names of its
35  * contributors may be used to endorse or promote products derived from
36  * this software without specific prior written permission.
37  *
38  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
39  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
41  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
42  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
43  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
44  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
45  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
46  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
47  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
48  * POSSIBILITY OF SUCH DAMAGE.
49  */
50 
66 #ifndef __PKCS11H_TOKEN_H
67 #define __PKCS11H_TOKEN_H
68 
70 
71 #if defined(__cplusplus)
72 extern "C" {
73 #endif
74 
76 
81 
90 };
91 
97 CK_RV
99  IN pkcs11h_token_id_t token_id
100 );
101 
109 CK_RV
111  OUT pkcs11h_token_id_t * const to,
112  IN const pkcs11h_token_id_t from
113 );
114 
121 PKCS11H_BOOL
123  IN const pkcs11h_token_id_t a,
124  IN const pkcs11h_token_id_t b
125 );
126 
132 CK_RV
134  IN const pkcs11h_token_id_t token_id
135 );
136 
144 CK_RV
146  IN const pkcs11h_token_id_t token_id,
147  IN const PKCS11H_BOOL readonly,
148  IN const char * const pin
149 );
150 
158 CK_RV
160  IN const pkcs11h_token_id_t token_id,
161  IN void * const user_data,
162  IN const unsigned mask_prompt
163 );
164 
170 CK_RV
172  IN const pkcs11h_token_id_list_t token_id_list
173 );
174 
183 CK_RV
185  IN const unsigned method,
186  OUT pkcs11h_token_id_list_t * const p_token_id_list
187 );
188 
197 CK_RV
199  OUT char * const sz,
200  IN OUT size_t *max,
201  IN const pkcs11h_token_id_t token_id
202 );
203 
212 CK_RV
214  OUT pkcs11h_token_id_t *p_token_id,
215  IN const char * const sz
216 );
217 
218 #ifdef __cplusplus
219 }
220 #endif
221 
224 #endif /* __PKCS11H_TOKEN_H */
CK_RV pkcs11h_token_enumTokenIds(IN const unsigned method, OUT pkcs11h_token_id_list_t *const p_token_id_list)
Enumerate available tokens.
CK_RV pkcs11h_token_duplicateTokenId(OUT pkcs11h_token_id_t *const to, IN const pkcs11h_token_id_t from)
Duplicate token_id object.
CK_RV pkcs11h_token_login(IN const pkcs11h_token_id_t token_id, IN const PKCS11H_BOOL readonly, IN const char *const pin)
Force login, avoid hooks.
PKCS11H_BOOL pkcs11h_token_sameTokenId(IN const pkcs11h_token_id_t a, IN const pkcs11h_token_id_t b)
Returns TRUE if same token id.
CK_RV pkcs11h_token_logout(IN const pkcs11h_token_id_t token_id)
Force logout.
CK_RV pkcs11h_token_freeTokenIdList(IN const pkcs11h_token_id_list_t token_id_list)
Free certificate_id list.
CK_RV pkcs11h_token_serializeTokenId(OUT char *const sz, IN OUT size_t *max, IN const pkcs11h_token_id_t token_id)
Serialize token_id into string.
CK_RV pkcs11h_token_deserializeTokenId(OUT pkcs11h_token_id_t *p_token_id, IN const char *const sz)
Deserialize token_id from string.
CK_RV pkcs11h_token_ensureAccess(IN const pkcs11h_token_id_t token_id, IN void *const user_data, IN const unsigned mask_prompt)
Ensure token is accessible.
struct pkcs11h_token_id_list_s * pkcs11h_token_id_list_t
Token identifier list.
Definition: pkcs11h-token.h:80
CK_RV pkcs11h_token_freeTokenId(IN pkcs11h_token_id_t token_id)
Free token_id object.
pkcs11-helper core.
Token identifier list.
Definition: pkcs11h-token.h:85
pkcs11h_token_id_t token_id
Definition: pkcs11h-token.h:89
pkcs11h_token_id_list_t next
Definition: pkcs11h-token.h:87
Token identifier.
Definition: pkcs11h-core.h:268

pkcs11-helper, Copyright (C) Alon Bar-Lev <alon.barlev@gmail.com>OpenSC-Project.org Logo