Share vici_cert_info.c with vici_cred.c
[strongswan.git] / src / libcharon / plugins / vici / vici_cert_info.c
1 /*
2 * Copyright (C) 2015 Andreas Steffen
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 "vici_cert_info.h"
17
18 static vici_cert_info_t vici_cert_infos[] = {
19 { "any", "", CERT_ANY,
20 X509_NONE },
21 { "x509", "X.509 End Entity Certificate", CERT_X509,
22 X509_NONE },
23 { "x509ca", "X.509 CA Certificate", CERT_X509,
24 X509_CA },
25 { "x509aa", "X.509 AA Certificate", CERT_X509,
26 X509_AA },
27 { "x509ocsp", "X.509 OCSP Signer Certificate", CERT_X509,
28 X509_OCSP_SIGNER },
29 { "x509ac", "X.509 Attribute Certificate", CERT_X509_AC,
30 X509_NONE },
31 { "x509crl", "X.509 CRL", CERT_X509_CRL,
32 X509_NONE },
33 { "ocsp", "OCSP Response", CERT_X509_OCSP_RESPONSE,
34 X509_NONE },
35 { "pubkey", "Raw Public Key", CERT_TRUSTED_PUBKEY,
36 X509_NONE }
37 };
38
39 /* See header. */
40 vici_cert_info_t* vici_cert_info_retrieve(char *type_str)
41 {
42 int i;
43
44 for (i = 0; i < countof(vici_cert_infos); i++)
45 {
46 if (strcaseeq(type_str, vici_cert_infos[i].type_str))
47 {
48 return &vici_cert_infos[i];
49 }
50 }
51 return NULL;
52 }