Changed some certificate_type_names and added x509_flag_names
authorAndreas Steffen <andreas.steffen@strongswan.org>
Wed, 9 Dec 2015 21:33:57 +0000 (22:33 +0100)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Fri, 11 Dec 2015 17:26:55 +0000 (18:26 +0100)
src/libstrongswan/Makefile.am
src/libstrongswan/credentials/certificates/certificate.c
src/libstrongswan/credentials/certificates/x509.c [new file with mode: 0644]
src/libstrongswan/credentials/certificates/x509.h

index 1851ff5..0bac61b 100644 (file)
@@ -19,7 +19,7 @@ credentials/credential_factory.c credentials/builder.c \
 credentials/cred_encoding.c credentials/keys/private_key.c \
 credentials/keys/public_key.c credentials/keys/shared_key.c \
 credentials/certificates/certificate.c credentials/certificates/crl.c \
-credentials/certificates/ocsp_response.c \
+credentials/certificates/ocsp_response.c credentials/certificates/x509.c \
 credentials/certificates/certificate_printer.c \
 credentials/containers/container.c credentials/containers/pkcs12.c \
 credentials/credential_manager.c \
index b281c16..7610829 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2007 Martin Willi
- * Hochschule fuer Technik Rapperswil
+ * Copyright (C) 2015 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
@@ -22,10 +23,10 @@ ENUM(certificate_type_names, CERT_ANY, CERT_GPG,
        "ANY",
        "X509",
        "X509_CRL",
-       "X509_OCSP_REQUEST",
-       "X509_OCSP_RESPONSE",
+       "OCSP_REQUEST",
+       "OCSP_RESPONSE",
        "X509_AC",
-       "TRUSTED_PUBKEY",
+       "PUBKEY",
        "PKCS10_REQUEST",
        "PGP",
 );
diff --git a/src/libstrongswan/credentials/certificates/x509.c b/src/libstrongswan/credentials/certificates/x509.c
new file mode 100644 (file)
index 0000000..5eefa0b
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2015 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ */
+
+#include "x509.h"
+
+ENUM_BEGIN(x509_flag_names, X509_NONE, X509_AA,
+       "NONE",
+       "CA",
+       "AA");
+ENUM_NEXT(x509_flag_names, X509_OCSP_SIGNER, X509_OCSP_SIGNER, X509_AA,
+       "OCSP");
+ENUM_NEXT(x509_flag_names, X509_ANY, X509_ANY, X509_OCSP_SIGNER,
+       "ANY");
+ENUM_END(x509_flag_names, X509_ANY);
+
index 6cbfcde..601c034 100644 (file)
@@ -46,6 +46,8 @@ enum x509_flag_t {
        X509_AA =                 (1<<1),
        /** cert has OCSP signer constraint */
        X509_OCSP_SIGNER =        (1<<2),
+    /** cert has either CA, AA or OCSP constraint */
+       X509_ANY = X509_CA | X509_AA | X509_OCSP_SIGNER,
        /** cert has serverAuth key usage */
        X509_SERVER_AUTH =        (1<<3),
        /** cert has clientAuth key usage */
@@ -62,6 +64,8 @@ enum x509_flag_t {
        X509_MS_SMARTCARD_LOGON = (1<<9),
 };
 
+extern enum_name_t *x509_flag_names;
+
 /**
  * Different numerical X.509 constraints.
  */