support of multiple certificates with same peer id
[strongswan.git] / src / charon / sa / authenticators / authenticator.c
1 /**
2 * @file authenticator.c
3 *
4 * @brief Generic constructor for authenticators.
5 *
6 */
7
8 /*
9 * Copyright (C) 2006 Martin Willi
10 * Hochschule fuer Technik Rapperswil
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
21 */
22
23 #include <string.h>
24
25 #include "authenticator.h"
26
27 #include <sa/authenticators/rsa_authenticator.h>
28 #include <sa/authenticators/psk_authenticator.h>
29 #include <sa/authenticators/eap_authenticator.h>
30
31
32 ENUM_BEGIN(auth_method_names, AUTH_RSA, AUTH_DSS,
33 "RSA signature",
34 "pre-shared key",
35 "DSS signature");
36 ENUM_NEXT(auth_method_names, AUTH_EAP, AUTH_EAP, AUTH_DSS,
37 "EAP");
38 ENUM_END(auth_method_names, AUTH_EAP);
39
40 /*
41 * Described in header.
42 */
43 authenticator_t *authenticator_create(ike_sa_t *ike_sa, auth_method_t auth_method)
44 {
45 switch (auth_method)
46 {
47 case AUTH_RSA:
48 return (authenticator_t*)rsa_authenticator_create(ike_sa);
49 case AUTH_PSK:
50 return (authenticator_t*)psk_authenticator_create(ike_sa);
51 case AUTH_EAP:
52 return (authenticator_t*)eap_authenticator_create(ike_sa);
53 default:
54 return NULL;
55 }
56 }