aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2015-12-11 17:53:40 +0100
committerAndreas Steffen <andreas.steffen@strongswan.org>2015-12-11 22:14:38 +0100
commit4df09fe563383692f2e4a9ccf083b32c92d7e5c5 (patch)
treee81496582d57aad54b311207c4635993532d9f2d /src
parent9dd8bfb2ce81ffbe537d3a42ad33a4d6abb5d849 (diff)
downloadstrongswan-4df09fe563383692f2e4a9ccf083b32c92d7e5c5.tar.bz2
strongswan-4df09fe563383692f2e4a9ccf083b32c92d7e5c5.tar.xz
Modified vici_cert_info class for use with load_creds and vici_cred
Diffstat (limited to 'src')
-rw-r--r--src/libcharon/plugins/vici/vici_cert_info.c54
-rw-r--r--src/libcharon/plugins/vici/vici_cert_info.h36
2 files changed, 31 insertions, 59 deletions
diff --git a/src/libcharon/plugins/vici/vici_cert_info.c b/src/libcharon/plugins/vici/vici_cert_info.c
index 9afaf05a1..61871e217 100644
--- a/src/libcharon/plugins/vici/vici_cert_info.c
+++ b/src/libcharon/plugins/vici/vici_cert_info.c
@@ -15,38 +15,42 @@
#include "vici_cert_info.h"
-static vici_cert_info_t vici_cert_infos[] = {
- { "any", "", CERT_ANY,
- X509_NONE },
- { "x509", "X.509 End Entity Certificate", CERT_X509,
- X509_NONE },
- { "x509ca", "X.509 CA Certificate", CERT_X509,
- X509_CA },
- { "x509aa", "X.509 AA Certificate", CERT_X509,
- X509_AA },
- { "x509ocsp", "X.509 OCSP Signer Certificate", CERT_X509,
- X509_OCSP_SIGNER },
- { "x509ac", "X.509 Attribute Certificate", CERT_X509_AC,
- X509_NONE },
- { "x509crl", "X.509 CRL", CERT_X509_CRL,
- X509_NONE },
- { "ocsp", "OCSP Response", CERT_X509_OCSP_RESPONSE,
- X509_NONE },
- { "pubkey", "Raw Public Key", CERT_TRUSTED_PUBKEY,
- X509_NONE }
+/**
+ * Legacy vici certificate types and directories created by swanctl
+ */
+typedef struct {
+
+ /** Certificate type string used in legacy vici messages */
+ char *type_str;
+ /** Base certificate type */
+ certificate_type_t type;
+ /** X.509 flag */
+ x509_flag_t flag;
+} cert_type_t;
+
+static cert_type_t cert_types[] = {
+ { "x509", CERT_X509, X509_NONE },
+ { "x509ca", CERT_X509, X509_CA },
+ { "x509ocsp", CERT_X509, X509_OCSP_SIGNER },
+ { "x509aa", CERT_X509, X509_AA },
+ { "x509ac", CERT_X509_AC, X509_NONE },
+ { "x509crl", CERT_X509_CRL, X509_NONE },
};
-/* See header. */
-vici_cert_info_t* vici_cert_info_retrieve(char *type_str)
+bool vici_cert_info_from_str(char *type_str, certificate_type_t *type,
+ x509_flag_t *flag)
{
int i;
- for (i = 0; i < countof(vici_cert_infos); i++)
+ for (i = 0; i < countof(cert_types); i++)
{
- if (strcaseeq(type_str, vici_cert_infos[i].type_str))
+ if (strcaseeq(type_str, cert_types[i].type_str))
{
- return &vici_cert_infos[i];
+ *type = cert_types[i].type;
+ *flag = cert_types[i].flag;
+ return TRUE;
}
}
- return NULL;
+ return FALSE;
}
+
diff --git a/src/libcharon/plugins/vici/vici_cert_info.h b/src/libcharon/plugins/vici/vici_cert_info.h
index 31d4b466f..e2a8c4d9f 100644
--- a/src/libcharon/plugins/vici/vici_cert_info.h
+++ b/src/libcharon/plugins/vici/vici_cert_info.h
@@ -26,39 +26,7 @@ typedef struct vici_cert_info_t vici_cert_info_t;
#include <credentials/certificates/certificate.h>
#include <credentials/certificates/x509.h>
-/**
- * Information on vici certificate types
- */
-struct vici_cert_info_t {
-
- /**
- * Certificate type string used in vici messages
- */
- char *type_str;
-
- /**
- * Caption describing the certificate type
- */
- char *caption;
-
- /**
- * Base certificate type
- */
- certificate_type_t type;
-
- /**
- * X.509 flag
- */
- x509_flag_t flag;
-
-};
-
-/**
- * Retrieve information on a given certificate type
- *
- * @param type_str Vici certificate type string
- * @return Information record or NULL if not found
- */
-vici_cert_info_t* vici_cert_info_retrieve(char *type_str);
+bool vici_cert_info_from_str(char *type_str, certificate_type_t *type,
+ x509_flag_t *flag);
#endif /** VICI_CERT_INFO_H_ @}*/