Move pkcs11 public key lookup function declaration to header file
[strongswan.git] / src / libstrongswan / plugins / pkcs11 / pkcs11_public_key.h
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_public_key pkcs11_public_key
18 * @{ @ingroup pkcs11
19 */
20
21 #ifndef PKCS11_PUBLIC_KEY_H_
22 #define PKCS11_PUBLIC_KEY_H_
23
24 typedef struct pkcs11_public_key_t pkcs11_public_key_t;
25
26 #include <credentials/builder.h>
27 #include <credentials/keys/private_key.h>
28
29 #include "pkcs11_library.h"
30
31 /**
32 * PKCS#11 based public key implementation.
33 */
34 struct pkcs11_public_key_t {
35
36 /**
37 * Implements public_key_t.
38 */
39 public_key_t key;
40 };
41
42 /**
43 * Create a public key in a PKCS#11 session.
44 *
45 * @param type type of the key
46 * @param args builder_part_t argument list
47 * @return loaded key, NULL on failure
48 */
49 pkcs11_public_key_t *pkcs11_public_key_load(key_type_t type, va_list args);
50
51 /**
52 * Find a public key on the given token with a specific keyid.
53 *
54 * @param p11 PKCS#11 module
55 * @param slot slot id
56 * @param type type of the key
57 * @param keyid key id
58 */
59 public_key_t *pkcs11_public_key_connect(pkcs11_library_t *p11, int slot,
60 key_type_t type, chunk_t keyid);
61
62 #endif /** PKCS11_PUBLIC_KEY_H_ @}*/