Annotation of embedaddon/strongswan/src/libstrongswan/plugins/pkcs11/pkcs11_private_key.h, revision 1.1.1.2
1.1 misho 1: /*
2: * Copyright (C) 2011 Tobias Brunner
3: * HSR Hochschule fuer Technik Rapperswil
4: *
5: * Copyright (C) 2010 Martin Willi
6: * Copyright (C) 2010 revosec AG
7: *
8: * This program is free software; you can redistribute it and/or modify it
9: * under the terms of the GNU General Public License as published by the
10: * Free Software Foundation; either version 2 of the License, or (at your
11: * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
12: *
13: * This program is distributed in the hope that it will be useful, but
14: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16: * for more details.
17: */
18:
19: /**
20: * @defgroup pkcs11_private_key pkcs11_private_key
21: * @{ @ingroup pkcs11
22: */
23:
24: #ifndef PKCS11_PRIVATE_KEY_H_
25: #define PKCS11_PRIVATE_KEY_H_
26:
27: typedef struct pkcs11_private_key_t pkcs11_private_key_t;
28:
29: #include <credentials/builder.h>
30: #include <credentials/keys/private_key.h>
31:
32: #include "pkcs11.h"
1.1.1.2 ! misho 33: #include "pkcs11_library.h"
1.1 misho 34:
35: /**
36: * Private Key implementation on top of PKCS#11.
37: */
38: struct pkcs11_private_key_t {
39:
40: /**
41: * Implements private_key_t interface.
42: */
43: private_key_t key;
44: };
45:
46: /**
47: * Open a private key on a PKCS#11 device.
48: *
49: * Accepts the BUILD_SMARTCARD_KEYID and the BUILD_SMARTCARD_PIN arguments.
50: *
51: * @param type type of the key
52: * @param args builder_part_t argument list
53: * @return loaded key, NULL on failure
54: */
55: pkcs11_private_key_t *pkcs11_private_key_connect(key_type_t type, va_list args);
56:
57: /**
58: * Get the Cryptoki mechanism for a signature scheme.
59: *
60: * Verifies that the given key is usable for this scheme.
61: *
1.1.1.2 ! misho 62: * @param lib PKCS#11 library of the token the key resides on
! 63: * @param slot slot of the token
1.1 misho 64: * @param scheme signature scheme
65: * @param type key type
66: * @param keylen key length in bits
67: * @param hash hash algorithm to apply first (HASH_UNKNOWN if none)
68: */
1.1.1.2 ! misho 69: CK_MECHANISM_PTR pkcs11_signature_scheme_to_mech(pkcs11_library_t *lib,
! 70: CK_SLOT_ID slot,
! 71: signature_scheme_t scheme,
1.1 misho 72: key_type_t type, size_t keylen,
73: hash_algorithm_t *hash);
74:
75: /**
76: * Get the Cryptoki mechanism for a encryption scheme.
77: */
78: CK_MECHANISM_PTR pkcs11_encryption_scheme_to_mech(encryption_scheme_t scheme);
79:
80: #endif /** PKCS11_PRIVATE_KEY_H_ @}*/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>