merged the modularization branch (credentials) back to trunk
[strongswan.git] / src / charon / sa / authenticators / authenticator.c
1 /*
2 * Copyright (C) 2006 Martin Willi
3 * 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 * $Id$
16 */
17
18 #include <string.h>
19
20 #include "authenticator.h"
21
22 #include <sa/authenticators/rsa_authenticator.h>
23 #include <sa/authenticators/psk_authenticator.h>
24 #include <sa/authenticators/eap_authenticator.h>
25
26
27 ENUM_BEGIN(auth_method_names, AUTH_RSA, AUTH_DSS,
28 "RSA signature",
29 "pre-shared key",
30 "DSS signature");
31 ENUM_NEXT(auth_method_names, AUTH_EAP, AUTH_EAP, AUTH_DSS,
32 "EAP");
33 ENUM_END(auth_method_names, AUTH_EAP);
34
35 /*
36 * Described in header.
37 */
38 authenticator_t *authenticator_create(ike_sa_t *ike_sa, auth_method_t auth_method)
39 {
40 switch (auth_method)
41 {
42 case AUTH_RSA:
43 return (authenticator_t*)rsa_authenticator_create(ike_sa);
44 case AUTH_PSK:
45 return (authenticator_t*)psk_authenticator_create(ike_sa);
46 case AUTH_EAP:
47 return (authenticator_t*)eap_authenticator_create(ike_sa);
48 default:
49 return NULL;
50 }
51 }