/src/strongswan/src/libstrongswan/plugins/pkcs8/pkcs8_plugin.c
Line | Count | Source |
1 | | /* |
2 | | * Copyright (C) 2012 Tobias Brunner |
3 | | * |
4 | | * Copyright (C) secunet Security Networks AG |
5 | | * |
6 | | * This program is free software; you can redistribute it and/or modify it |
7 | | * under the terms of the GNU General Public License as published by the |
8 | | * Free Software Foundation; either version 2 of the License, or (at your |
9 | | * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. |
10 | | * |
11 | | * This program is distributed in the hope that it will be useful, but |
12 | | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
13 | | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
14 | | * for more details. |
15 | | */ |
16 | | |
17 | | #include "pkcs8_plugin.h" |
18 | | |
19 | | #include <library.h> |
20 | | |
21 | | #include "pkcs8_builder.h" |
22 | | |
23 | | typedef struct private_pkcs8_plugin_t private_pkcs8_plugin_t; |
24 | | |
25 | | /** |
26 | | * private data of pkcs8_plugin |
27 | | */ |
28 | | struct private_pkcs8_plugin_t { |
29 | | |
30 | | /** |
31 | | * public functions |
32 | | */ |
33 | | pkcs8_plugin_t public; |
34 | | }; |
35 | | |
36 | | METHOD(plugin_t, get_name, char*, |
37 | | private_pkcs8_plugin_t *this) |
38 | 0 | { |
39 | 0 | return "pkcs8"; |
40 | 0 | } |
41 | | |
42 | | METHOD(plugin_t, get_features, int, |
43 | | private_pkcs8_plugin_t *this, plugin_feature_t *features[]) |
44 | 0 | { |
45 | 0 | static plugin_feature_t f[] = { |
46 | 0 | PLUGIN_REGISTER(PRIVKEY, pkcs8_private_key_load, FALSE), |
47 | 0 | PLUGIN_PROVIDE(PRIVKEY, KEY_ANY), |
48 | 0 | PLUGIN_PROVIDE(PRIVKEY, KEY_RSA), |
49 | 0 | PLUGIN_PROVIDE(PRIVKEY, KEY_ECDSA), |
50 | 0 | PLUGIN_PROVIDE(PRIVKEY, KEY_ED25519), |
51 | 0 | PLUGIN_PROVIDE(PRIVKEY, KEY_ED448), |
52 | 0 | }; |
53 | 0 | *features = f; |
54 | 0 | return countof(f); |
55 | 0 | } |
56 | | |
57 | | METHOD(plugin_t, destroy, void, |
58 | | private_pkcs8_plugin_t *this) |
59 | 0 | { |
60 | 0 | free(this); |
61 | 0 | } |
62 | | |
63 | | /* |
64 | | * see header file |
65 | | */ |
66 | | PLUGIN_DEFINE(pkcs8) |
67 | 0 | { |
68 | 0 | private_pkcs8_plugin_t *this; |
69 | |
|
70 | 0 | INIT(this, |
71 | 0 | .public = { |
72 | 0 | .plugin = { |
73 | 0 | .get_name = _get_name, |
74 | 0 | .get_features = _get_features, |
75 | 0 | .destroy = _destroy, |
76 | 0 | }, |
77 | 0 | }, |
78 | 0 | ); |
79 | |
|
80 | 0 | return &this->public.plugin; |
81 | 0 | } |
82 | | |