Annotation of embedaddon/strongswan/src/libstrongswan/plugins/x509/x509_plugin.c, revision 1.1.1.1
1.1 misho 1: /*
2: * Copyright (C) 2008-2009 Martin Willi
3: * HSR Hochschule fuer Technik Rapperswil
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 "x509_plugin.h"
17:
18: #include <library.h>
19: #include "x509_cert.h"
20: #include "x509_ac.h"
21: #include "x509_crl.h"
22: #include "x509_ocsp_request.h"
23: #include "x509_ocsp_response.h"
24: #include "x509_pkcs10.h"
25:
26: typedef struct private_x509_plugin_t private_x509_plugin_t;
27:
28: /**
29: * private data of x509_plugin
30: */
31: struct private_x509_plugin_t {
32:
33: /**
34: * public functions
35: */
36: x509_plugin_t public;
37: };
38:
39: METHOD(plugin_t, get_name, char*,
40: private_x509_plugin_t *this)
41: {
42: return "x509";
43: }
44:
45: METHOD(plugin_t, get_features, int,
46: private_x509_plugin_t *this, plugin_feature_t *features[])
47: {
48: static plugin_feature_t f[] = {
49: PLUGIN_REGISTER(CERT_ENCODE, x509_cert_gen, FALSE),
50: PLUGIN_PROVIDE(CERT_ENCODE, CERT_X509),
51: PLUGIN_DEPENDS(HASHER, HASH_SHA1),
52: PLUGIN_REGISTER(CERT_DECODE, x509_cert_load, TRUE),
53: PLUGIN_PROVIDE(CERT_DECODE, CERT_X509),
54: PLUGIN_DEPENDS(HASHER, HASH_SHA1),
55: PLUGIN_DEPENDS(PUBKEY, KEY_ANY),
56:
57: PLUGIN_REGISTER(CERT_ENCODE, x509_ac_gen, FALSE),
58: PLUGIN_PROVIDE(CERT_ENCODE, CERT_X509_AC),
59: PLUGIN_REGISTER(CERT_DECODE, x509_ac_load, TRUE),
60: PLUGIN_PROVIDE(CERT_DECODE, CERT_X509_AC),
61:
62: PLUGIN_REGISTER(CERT_ENCODE, x509_crl_gen, FALSE),
63: PLUGIN_PROVIDE(CERT_ENCODE, CERT_X509_CRL),
64: PLUGIN_REGISTER(CERT_DECODE, x509_crl_load, TRUE),
65: PLUGIN_PROVIDE(CERT_DECODE, CERT_X509_CRL),
66:
67: PLUGIN_REGISTER(CERT_ENCODE, x509_ocsp_request_gen, FALSE),
68: PLUGIN_PROVIDE(CERT_ENCODE, CERT_X509_OCSP_REQUEST),
69: PLUGIN_DEPENDS(HASHER, HASH_SHA1),
70: PLUGIN_DEPENDS(RNG, RNG_WEAK),
71: PLUGIN_REGISTER(CERT_DECODE, x509_ocsp_response_load, TRUE),
72: PLUGIN_PROVIDE(CERT_DECODE, CERT_X509_OCSP_RESPONSE),
73:
74: PLUGIN_REGISTER(CERT_ENCODE, x509_pkcs10_gen, FALSE),
75: PLUGIN_PROVIDE(CERT_ENCODE, CERT_PKCS10_REQUEST),
76: PLUGIN_REGISTER(CERT_DECODE, x509_pkcs10_load, TRUE),
77: PLUGIN_PROVIDE(CERT_DECODE, CERT_PKCS10_REQUEST),
78: };
79: *features = f;
80: return countof(f);
81: }
82:
83: METHOD(plugin_t, destroy, void,
84: private_x509_plugin_t *this)
85: {
86: free(this);
87: }
88:
89: /*
90: * see header file
91: */
92: plugin_t *x509_plugin_create()
93: {
94: private_x509_plugin_t *this;
95:
96: INIT(this,
97: .public = {
98: .plugin = {
99: .get_name = _get_name,
100: .get_features = _get_features,
101: .destroy = _destroy,
102: },
103: },
104: );
105:
106: return &this->public.plugin;
107: }
108:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>