Annotation of embedaddon/strongswan/src/libstrongswan/plugins/pkcs11/pkcs11_creds.h, revision 1.1.1.1
1.1 misho 1: /*
2: * Copyright (C) 2010 Martin Willi
3: * Copyright (C) 2010 revosec AG
4: *
5: * This program is free software; you can redistribute it and/or modify it
6: * under the terms of the GNU General Public License as published by the
7: * Free Software Foundation; either version 2 of the License, or (at your
8: * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9: *
10: * This program is distributed in the hope that it will be useful, but
11: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13: * for more details.
14: */
15:
16: /**
17: * @defgroup pkcs11_creds pkcs11_creds
18: * @{ @ingroup pkcs11
19: */
20:
21: #ifndef PKCS11_CREDS_H_
22: #define PKCS11_CREDS_H_
23:
24: typedef struct pkcs11_creds_t pkcs11_creds_t;
25:
26: #include "pkcs11_library.h"
27:
28: #include <credentials/credential_manager.h>
29:
30: /**
31: * Credential set on top on a PKCS#11 token.
32: */
33: struct pkcs11_creds_t {
34:
35: /**
36: * Implements credential_set_t.
37: */
38: credential_set_t set;
39:
40: /**
41: * Get the PKCS#11 library this set uses.
42: *
43: * @return library
44: */
45: pkcs11_library_t* (*get_library)(pkcs11_creds_t *this);
46:
47: /**
48: * Get the slot of the token this set uses.
49: *
50: * @return slot
51: */
52: CK_SLOT_ID (*get_slot)(pkcs11_creds_t *this);
53:
54: /**
55: * Destroy a pkcs11_creds_t.
56: */
57: void (*destroy)(pkcs11_creds_t *this);
58: };
59:
60: /**
61: * Create a pkcs11_creds instance.
62: *
63: * @param p11 loaded PKCS#11 library
64: * @param slot slot of the token we hand out credentials
65: */
66: pkcs11_creds_t *pkcs11_creds_create(pkcs11_library_t *p11, CK_SLOT_ID slot);
67:
68: /**
69: * Load a specific certificate from a token.
70: *
71: * Requires a BUILD_PKCS11_KEYID argument, and optionally BUILD_PKCS11_MODULE
72: * and/or BUILD_PKCS11_SLOT.
73: *
74: * @param type certificate type, must be CERT_X509
75: * @param args variable argument list, containing BUILD_PKCS11_KEYID.
76: * @return loaded certificate, or NULL on failure
77: */
78: certificate_t *pkcs11_creds_load(certificate_type_t type, va_list args);
79:
80: #endif /** PKCS11_CREDS_H_ @}*/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>