Annotation of embedaddon/strongswan/src/libstrongswan/plugins/pkcs7/pkcs7_plugin.c, revision 1.1.1.1
1.1 misho 1: /*
2: * Copyright (C) 2012 Martin Willi
3: * Copyright (C) 2012 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: #include "pkcs7_plugin.h"
17: #include "pkcs7_generic.h"
18: #include "pkcs7_data.h"
19: #include "pkcs7_signed_data.h"
20: #include "pkcs7_enveloped_data.h"
21:
22: #include <library.h>
23:
24: typedef struct private_pkcs7_plugin_t private_pkcs7_plugin_t;
25:
26: /**
27: * private data of pkcs7_plugin
28: */
29: struct private_pkcs7_plugin_t {
30:
31: /**
32: * public functions
33: */
34: pkcs7_plugin_t public;
35: };
36:
37: METHOD(plugin_t, get_name, char*,
38: private_pkcs7_plugin_t *this)
39: {
40: return "pkcs7";
41: }
42:
43: METHOD(plugin_t, get_features, int,
44: private_pkcs7_plugin_t *this, plugin_feature_t *features[])
45: {
46: static plugin_feature_t f[] = {
47: PLUGIN_REGISTER(CONTAINER_DECODE, pkcs7_generic_load, TRUE),
48: PLUGIN_PROVIDE(CONTAINER_DECODE, CONTAINER_PKCS7),
49: PLUGIN_REGISTER(CONTAINER_ENCODE, pkcs7_data_gen, TRUE),
50: PLUGIN_PROVIDE(CONTAINER_ENCODE, CONTAINER_PKCS7_DATA),
51: PLUGIN_REGISTER(CONTAINER_ENCODE, pkcs7_signed_data_gen, TRUE),
52: PLUGIN_PROVIDE(CONTAINER_ENCODE, CONTAINER_PKCS7_SIGNED_DATA),
53: PLUGIN_REGISTER(CONTAINER_ENCODE, pkcs7_enveloped_data_gen, TRUE),
54: PLUGIN_PROVIDE(CONTAINER_ENCODE, CONTAINER_PKCS7_ENVELOPED_DATA),
55: };
56: *features = f;
57: return countof(f);
58: }
59:
60: METHOD(plugin_t, destroy, void,
61: private_pkcs7_plugin_t *this)
62: {
63: free(this);
64: }
65:
66: /*
67: * see header file
68: */
69: plugin_t *pkcs7_plugin_create()
70: {
71: private_pkcs7_plugin_t *this;
72:
73: INIT(this,
74: .public = {
75: .plugin = {
76: .get_name = _get_name,
77: .get_features = _get_features,
78: .destroy = _destroy,
79: },
80: },
81: );
82:
83: return &this->public.plugin;
84: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>