pkcs11_lib.h

Go to the documentation of this file.
00001 /*
00002  * PKCS #11 PAM Login Module
00003  * Copyright (C) 2003 Mario Strasser <mast@gmx.net>,
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2.1 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  *
00015  * $Id: pkcs11_lib.h 270 2007-05-21 08:13:00Z ludovic.rousseau $
00016  */
00017 #ifndef __PKCS11_LIB_H__
00018 #define __PKCS11_LIB_H__
00019 
00020 #include "cert_st.h"
00021 
00022 typedef struct cert_object_str cert_object_t;
00023 typedef struct pkcs11_handle_str pkcs11_handle_t;
00024 
00025 #ifndef __PKCS11_LIB_C__
00026 #define PKCS11_EXTERN extern
00027 #else 
00028 #define PKCS11_EXTERN
00029 #endif
00030 
00031 PKCS11_EXTERN int crypto_init(cert_policy *policy);
00032 PKCS11_EXTERN int load_pkcs11_module(char *module, pkcs11_handle_t **h);
00033 PKCS11_EXTERN int init_pkcs11_module(pkcs11_handle_t *h,int flag);
00034 PKCS11_EXTERN int find_slot_by_number(pkcs11_handle_t *h,int slot_num,
00035                                       unsigned int *slot);
00036 PKCS11_EXTERN int find_slot_by_number_and_label(pkcs11_handle_t *h,
00037                                       int slot_num, const char *slot_label,
00038                                       unsigned int *slot);
00039 PKCS11_EXTERN const char *get_slot_label(pkcs11_handle_t *h);
00040 PKCS11_EXTERN int wait_for_token(pkcs11_handle_t *h,
00041                                  int wanted_slot_num, 
00042                                  const char *wanted_slot_label,
00043                                  unsigned int *slot);
00044 PKCS11_EXTERN const X509 *get_X509_certificate(cert_object_t *cert);
00045 PKCS11_EXTERN void release_pkcs11_module(pkcs11_handle_t *h);
00046 PKCS11_EXTERN int open_pkcs11_session(pkcs11_handle_t *h, unsigned int slot);
00047 PKCS11_EXTERN int close_pkcs11_session(pkcs11_handle_t *h);
00048 PKCS11_EXTERN int pkcs11_login(pkcs11_handle_t *h, char *password);
00049 PKCS11_EXTERN int pkcs11_pass_login(pkcs11_handle_t *h, int nullok);
00050 PKCS11_EXTERN cert_object_t **get_certificate_list(pkcs11_handle_t *h, 
00051                                                   int *ncert);
00052 PKCS11_EXTERN int get_private_key(pkcs11_handle_t *h, cert_object_t *);
00053 PKCS11_EXTERN int sign_value(pkcs11_handle_t *h, cert_object_t *,
00054                unsigned char *data, unsigned long length,
00055                unsigned char **signature, unsigned long *signature_length);
00056 PKCS11_EXTERN int get_random_value(unsigned char *data, int length);
00057 
00058 #undef PKCS11_EXTERN
00059 
00060 /* end of pkcs11_lib.h */
00061 #endif

Generated on Mon May 21 23:11:10 2007 for pam_pkcs11 by  doxygen 1.5.1