00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00073 #ifndef __PKCS11H_CERTIFICATE_H
00074 #define __PKCS11H_CERTIFICATE_H
00075
00076 #include <pkcs11-helper-1.0/pkcs11h-core.h>
00077
00078 #if defined(__cplusplus)
00079 extern "C" {
00080 #endif
00081
00082 struct pkcs11h_certificate_id_s;
00083 struct pkcs11h_certificate_s;
00084
00088 typedef struct pkcs11h_certificate_id_s *pkcs11h_certificate_id_t;
00089
00093 typedef struct pkcs11h_certificate_s *pkcs11h_certificate_t;
00094
00095 struct pkcs11h_certificate_id_list_s;
00096
00100 typedef struct pkcs11h_certificate_id_list_s *pkcs11h_certificate_id_list_t;
00101
00105 struct pkcs11h_certificate_id_s {
00107 pkcs11h_token_id_t token_id;
00108
00110 char displayName[1024];
00112 CK_BYTE_PTR attrCKA_ID;
00114 size_t attrCKA_ID_size;
00115
00117 unsigned char *certificate_blob;
00119 size_t certificate_blob_size;
00120 };
00121
00125 struct pkcs11h_certificate_id_list_s {
00127 pkcs11h_certificate_id_list_t next;
00129 pkcs11h_certificate_id_t certificate_id;
00130 };
00131
00137 CK_RV
00138 pkcs11h_certificate_freeCertificateId (
00139 IN pkcs11h_certificate_id_t certificate_id
00140 );
00141
00150 CK_RV
00151 pkcs11h_certificate_duplicateCertificateId (
00152 OUT pkcs11h_certificate_id_t * const to,
00153 IN const pkcs11h_certificate_id_t from
00154 );
00155
00165 CK_RV
00166 pkcs11h_certificate_setCertificateIdCertificateBlob (
00167 IN const pkcs11h_certificate_id_t certificate_id,
00168 IN const unsigned char * const blob,
00169 IN const size_t blob_size
00170 );
00171
00177 CK_RV
00178 pkcs11h_certificate_freeCertificate (
00179 IN pkcs11h_certificate_t certificate
00180 );
00181
00194 CK_RV
00195 pkcs11h_certificate_create (
00196 IN const pkcs11h_certificate_id_t certificate_id,
00197 IN void * const user_data,
00198 IN const unsigned mask_prompt,
00199 IN const int pin_cache_period,
00200 OUT pkcs11h_certificate_t * const p_certificate
00201 );
00202
00208 unsigned
00209 pkcs11h_certificate_getPromptMask (
00210 IN const pkcs11h_certificate_t certificate
00211 );
00212
00218 void
00219 pkcs11h_certificate_setPromptMask (
00220 IN const pkcs11h_certificate_t certificate,
00221 IN const unsigned mask_prompt
00222 );
00223
00229 void *
00230 pkcs11h_certificate_getUserData (
00231 IN const pkcs11h_certificate_t certificate
00232 );
00233
00239 void
00240 pkcs11h_certificate_setUserData (
00241 IN const pkcs11h_certificate_t certificate,
00242 IN void * const user_data
00243 );
00244
00253 CK_RV
00254 pkcs11h_certificate_getCertificateId (
00255 IN const pkcs11h_certificate_t certificate,
00256 OUT pkcs11h_certificate_id_t * const p_certificate_id
00257 );
00258
00267 CK_RV
00268 pkcs11h_certificate_getCertificateBlob (
00269 IN const pkcs11h_certificate_t certificate,
00270 OUT unsigned char * const certificate_blob,
00271 IN OUT size_t * const p_certificate_blob_size
00272 );
00273
00282 CK_RV
00283 pkcs11h_certificate_serializeCertificateId (
00284 OUT char * const sz,
00285 IN OUT size_t *max,
00286 IN const pkcs11h_certificate_id_t certificate_id
00287 );
00288
00297 CK_RV
00298 pkcs11h_certificate_deserializeCertificateId (
00299 OUT pkcs11h_certificate_id_t * const p_certificate_id,
00300 IN const char * const sz
00301 );
00302
00308 CK_RV
00309 pkcs11h_certificate_ensureCertificateAccess (
00310 IN const pkcs11h_certificate_t certificate
00311 );
00312
00318 CK_RV
00319 pkcs11h_certificate_ensureKeyAccess (
00320 IN const pkcs11h_certificate_t certificate
00321 );
00322
00337 CK_RV
00338 pkcs11h_certificate_lockSession (
00339 IN const pkcs11h_certificate_t certificate
00340 );
00341
00348 CK_RV
00349 pkcs11h_certificate_releaseSession (
00350 IN const pkcs11h_certificate_t certificate
00351 );
00352
00367 CK_RV
00368 pkcs11h_certificate_sign (
00369 IN const pkcs11h_certificate_t certificate,
00370 IN const CK_MECHANISM_TYPE mech_type,
00371 IN const unsigned char * const source,
00372 IN const size_t source_size,
00373 OUT unsigned char * const target,
00374 IN OUT size_t * const p_target_size
00375 );
00376
00391 CK_RV
00392 pkcs11h_certificate_signRecover (
00393 IN const pkcs11h_certificate_t certificate,
00394 IN const CK_MECHANISM_TYPE mech_type,
00395 IN const unsigned char * const source,
00396 IN const size_t source_size,
00397 OUT unsigned char * const target,
00398 IN OUT size_t * const p_target_size
00399 );
00400
00414 CK_RV
00415 pkcs11h_certificate_decrypt (
00416 IN const pkcs11h_certificate_t certificate,
00417 IN const CK_MECHANISM_TYPE mech_type,
00418 IN const unsigned char * const source,
00419 IN const size_t source_size,
00420 OUT unsigned char * const target,
00421 IN OUT size_t * const p_target_size
00422 );
00423
00437 CK_RV
00438 pkcs11h_certificate_unwrap (
00439 IN const pkcs11h_certificate_t certificate,
00440 IN const CK_MECHANISM_TYPE mech_type,
00441 IN const unsigned char * const source,
00442 IN const size_t source_size,
00443 OUT unsigned char * const target,
00444 IN OUT size_t * const p_target_size
00445 );
00446
00460 CK_RV
00461 pkcs11h_certificate_signAny (
00462 IN const pkcs11h_certificate_t certificate,
00463 IN const CK_MECHANISM_TYPE mech_type,
00464 IN const unsigned char * const source,
00465 IN const size_t source_size,
00466 OUT unsigned char * const target,
00467 IN OUT size_t * const p_target_size
00468 );
00469
00483 CK_RV
00484 pkcs11h_certificate_decryptAny (
00485 IN const pkcs11h_certificate_t certificate,
00486 IN const CK_MECHANISM_TYPE mech_type,
00487 IN const unsigned char * const source,
00488 IN const size_t source_size,
00489 OUT unsigned char * const target,
00490 IN OUT size_t * const p_target_size
00491 );
00492
00498 CK_RV
00499 pkcs11h_certificate_freeCertificateIdList (
00500 IN const pkcs11h_certificate_id_list_t cert_id_list
00501 );
00502
00517 CK_RV
00518 pkcs11h_certificate_enumTokenCertificateIds (
00519 IN const pkcs11h_token_id_t token_id,
00520 IN const unsigned method,
00521 IN void * const user_data,
00522 IN const unsigned mask_prompt,
00523 OUT pkcs11h_certificate_id_list_t * const p_cert_id_issuers_list,
00524 OUT pkcs11h_certificate_id_list_t * const p_cert_id_end_list
00525 );
00526
00539 CK_RV
00540 pkcs11h_certificate_enumCertificateIds (
00541 IN const unsigned method,
00542 IN void * const user_data,
00543 IN const unsigned mask_prompt,
00544 OUT pkcs11h_certificate_id_list_t * const p_cert_id_issuers_list,
00545 OUT pkcs11h_certificate_id_list_t * const p_cert_id_end_list
00546 );
00547
00548 #ifdef __cplusplus
00549 }
00550 #endif
00551
00554 #endif