PolarSSL v1.1.4
pkcs11.h
Go to the documentation of this file.
00001 
00029 #ifndef POLARSSL_PKCS11_H
00030 #define POLARSSL_PKCS11_H
00031 
00032 #include "config.h"
00033 
00034 #if defined(POLARSSL_PKCS11_C)
00035 
00036 #include "x509.h"
00037 
00038 #include <pkcs11-helper-1.0/pkcs11h-certificate.h>
00039 
00043 typedef struct {
00044         pkcs11h_certificate_t pkcs11h_cert;
00045         int len;
00046 } pkcs11_context;
00047 
00056 int pkcs11_x509_cert_init( x509_cert *cert, pkcs11h_certificate_t pkcs11h_cert );
00057 
00068 int pkcs11_priv_key_init( pkcs11_context *priv_key,
00069         pkcs11h_certificate_t pkcs11_cert );
00070 
00077 void pkcs11_priv_key_free( pkcs11_context *priv_key );
00078 
00095 int pkcs11_decrypt( pkcs11_context *ctx,
00096                        int mode, size_t *olen,
00097                        const unsigned char *input,
00098                        unsigned char *output,
00099                        unsigned int output_max_len );
00100 
00117 int pkcs11_sign( pkcs11_context *ctx,
00118                     int mode,
00119                     int hash_id,
00120                     unsigned int hashlen,
00121                     const unsigned char *hash,
00122                     unsigned char *sig );
00123 
00124 #endif /* POLARSSL_PKCS11_C */
00125 
00126 #endif /* POLARSSL_PKCS11_H */