pkcs11-helper-1.0/pkcs11h-token.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2005-2007 Alon Bar-Lev <alon.barlev@gmail.com>
00003  * All rights reserved.
00004  *
00005  * This software is available to you under a choice of one of two
00006  * licenses.  You may choose to be licensed under the terms of the GNU
00007  * General Public License (GPL) Version 2, or the BSD license.
00008  *
00009  * GNU General Public License (GPL) Version 2
00010  * ===========================================
00011  * This program is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License version 2
00013  * as published by the Free Software Foundation.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program (see the file COPYING.GPL included with this
00022  * distribution); if not, write to the Free Software Foundation, Inc.,
00023  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00024  *
00025  * BSD License
00026  * ============
00027  * Redistribution and use in source and binary forms, with or without
00028  * modification, are permitted provided that the following conditions are met:
00029  *
00030  *     o Redistributions of source code must retain the above copyright notice,
00031  *       this list of conditions and the following disclaimer.
00032  *     o Redistributions in binary form must reproduce the above copyright
00033  *       notice, this list of conditions and the following disclaimer in the
00034  *       documentation and/or other materials provided with the distribution.
00035  *     o Neither the name of the <ORGANIZATION> nor the names of its
00036  *       contributors may be used to endorse or promote products derived from
00037  *       this software without specific prior written permission.
00038  *
00039  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00040  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00041  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00042  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00043  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00044  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00045  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00046  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00047  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00048  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00049  * POSSIBILITY OF SUCH DAMAGE.
00050  */
00051 
00067 #ifndef __PKCS11H_TOKEN_H
00068 #define __PKCS11H_TOKEN_H
00069 
00070 #include <pkcs11-helper-1.0/pkcs11h-core.h>
00071 
00072 #if defined(__cplusplus)
00073 extern "C" {
00074 #endif
00075 
00076 struct pkcs11h_token_id_list_s;
00077 
00081 typedef struct pkcs11h_token_id_list_s *pkcs11h_token_id_list_t;
00082 
00086 struct pkcs11h_token_id_list_s {
00088         pkcs11h_token_id_list_t next;
00090         pkcs11h_token_id_t token_id;
00091 };
00092 
00098 CK_RV
00099 pkcs11h_token_freeTokenId (
00100         IN pkcs11h_token_id_t token_id
00101 );
00102 
00110 CK_RV
00111 pkcs11h_token_duplicateTokenId (
00112         OUT pkcs11h_token_id_t * const to,
00113         IN const pkcs11h_token_id_t from
00114 );
00115 
00122 PKCS11H_BOOL
00123 pkcs11h_token_sameTokenId (
00124         IN const pkcs11h_token_id_t a,
00125         IN const pkcs11h_token_id_t b
00126 );
00127 
00133 CK_RV
00134 pkcs11h_token_logout (
00135         IN const pkcs11h_token_id_t token_id
00136 );
00137 
00145 CK_RV
00146 pkcs11h_token_login (
00147         IN const pkcs11h_token_id_t token_id,
00148         IN const PKCS11H_BOOL readonly,
00149         IN const char * const pin
00150 );
00151 
00159 CK_RV
00160 pkcs11h_token_ensureAccess (
00161         IN const pkcs11h_token_id_t token_id,
00162         IN void * const user_data,
00163         IN const unsigned mask_prompt
00164 );
00165 
00171 CK_RV
00172 pkcs11h_token_freeTokenIdList (
00173         IN const pkcs11h_token_id_list_t token_id_list
00174 );
00175 
00184 CK_RV
00185 pkcs11h_token_enumTokenIds (
00186         IN const unsigned method,
00187         OUT pkcs11h_token_id_list_t * const p_token_id_list
00188 );
00189 
00198 CK_RV
00199 pkcs11h_token_serializeTokenId (
00200         OUT char * const sz,
00201         IN OUT size_t *max,
00202         IN const pkcs11h_token_id_t token_id
00203 );
00204 
00213 CK_RV
00214 pkcs11h_token_deserializeTokenId (
00215         OUT pkcs11h_token_id_t *p_token_id,
00216         IN const char * const sz
00217 );
00218 
00219 #ifdef __cplusplus
00220 }
00221 #endif
00222 
00225 #endif                          /* __PKCS11H_TOKEN_H */

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