From dafc76624606f7d47f65006a6bf4695c3a0cd1a9 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Tue, 2 May 2023 09:27:05 +0200 Subject: feat(pkix): add addition features to validate short-term certificates --- moaSig/common/build.gradle | 2 +- .../at/gv/egovernment/moaspss/util/Constants.java | 2 +- .../resources/schemas/MOA-SPSS-config-3.2.0.xsd | 383 +++++++++++++++++++++ moaSig/libs/cpxlevel.jar | Bin 145677 -> 0 bytes moaSig/libs/iaik_cms-6.0_moa.jar | Bin 0 -> 501606 bytes moaSig/libs/iaik_cms.jar | Bin 461322 -> 0 bytes moaSig/libs/iaik_cpades-2.4_MOA.jar | Bin 130134 -> 0 bytes moaSig/libs/iaik_cpades-2.4_moa.jar | Bin 0 -> 130134 bytes moaSig/libs/iaik_cpxlevel-0.9.1_moa.jar | Bin 0 -> 139207 bytes moaSig/libs/iaik_eccelerate-6.02.jar | Bin 647834 -> 0 bytes moaSig/libs/iaik_eccelerate-6.3.0_eval.jar | Bin 0 -> 807993 bytes moaSig/libs/iaik_eccelerate_addon-6.02.jar | Bin 88796 -> 0 bytes moaSig/libs/iaik_eccelerate_addon-6.3.0_eval.jar | Bin 0 -> 98152 bytes moaSig/libs/iaik_eccelerate_cms-6.02.jar | Bin 4769 -> 0 bytes moaSig/libs/iaik_jce_full_signed-5.63_MOA.jar | Bin 1394182 -> 0 bytes moaSig/libs/iaik_jce_full_signed-6.01_moa.jar | Bin 0 -> 1475130 bytes moaSig/libs/iaik_moa-2.08.jar | Bin 529915 -> 0 bytes moaSig/libs/iaik_moa-2.09.jar | Bin 0 -> 530620 bytes moaSig/libs/iaik_pki_module-2.02_moa.jar | Bin 627372 -> 0 bytes moaSig/libs/iaik_pki_module-2.03_moa.jar | Bin 0 -> 629542 bytes moaSig/libs/iaik_sva-1.2.0.jar | Bin 0 -> 157685 bytes moaSig/libs/iaik_tsp-2.32_eval.jar | Bin 0 -> 40481 bytes moaSig/libs/iaik_tsp.jar | Bin 40481 -> 0 bytes moaSig/libs/iaik_xsect-2.14_MOA.jar | Bin 445795 -> 0 bytes moaSig/libs/iaik_xsect-2.14_moa.jar | Bin 0 -> 445795 bytes moaSig/libs/sigval-0.0.1.jar | Bin 51942 -> 0 bytes moaSig/libs/sigvallib-0.0.1.jar | Bin 126597 -> 0 bytes .../server/config/ConfigurationPartsBuilder.java | 95 ++++- .../spss/server/config/ConfigurationProvider.java | 38 ++ .../iaik/config/RevocationConfigurationImpl.java | 30 ++ 30 files changed, 541 insertions(+), 9 deletions(-) create mode 100644 moaSig/common/src/main/resources/resources/schemas/MOA-SPSS-config-3.2.0.xsd delete mode 100644 moaSig/libs/cpxlevel.jar create mode 100644 moaSig/libs/iaik_cms-6.0_moa.jar delete mode 100644 moaSig/libs/iaik_cms.jar delete mode 100644 moaSig/libs/iaik_cpades-2.4_MOA.jar create mode 100644 moaSig/libs/iaik_cpades-2.4_moa.jar create mode 100644 moaSig/libs/iaik_cpxlevel-0.9.1_moa.jar delete mode 100644 moaSig/libs/iaik_eccelerate-6.02.jar create mode 100644 moaSig/libs/iaik_eccelerate-6.3.0_eval.jar delete mode 100644 moaSig/libs/iaik_eccelerate_addon-6.02.jar create mode 100644 moaSig/libs/iaik_eccelerate_addon-6.3.0_eval.jar delete mode 100644 moaSig/libs/iaik_eccelerate_cms-6.02.jar delete mode 100644 moaSig/libs/iaik_jce_full_signed-5.63_MOA.jar create mode 100644 moaSig/libs/iaik_jce_full_signed-6.01_moa.jar delete mode 100644 moaSig/libs/iaik_moa-2.08.jar create mode 100644 moaSig/libs/iaik_moa-2.09.jar delete mode 100644 moaSig/libs/iaik_pki_module-2.02_moa.jar create mode 100644 moaSig/libs/iaik_pki_module-2.03_moa.jar create mode 100644 moaSig/libs/iaik_sva-1.2.0.jar create mode 100644 moaSig/libs/iaik_tsp-2.32_eval.jar delete mode 100644 moaSig/libs/iaik_tsp.jar delete mode 100644 moaSig/libs/iaik_xsect-2.14_MOA.jar create mode 100644 moaSig/libs/iaik_xsect-2.14_moa.jar delete mode 100644 moaSig/libs/sigval-0.0.1.jar delete mode 100644 moaSig/libs/sigvallib-0.0.1.jar (limited to 'moaSig') diff --git a/moaSig/common/build.gradle b/moaSig/common/build.gradle index 6d90201..c4e6dab 100644 --- a/moaSig/common/build.gradle +++ b/moaSig/common/build.gradle @@ -1,5 +1,5 @@ dependencies { - implementation files('../libs/iaik_jce_full_signed-5.63_MOA.jar') + implementation files('../libs/iaik_jce_full_signed-6.01_moa.jar') api 'org.slf4j:slf4j-api:1.7.36' api 'xerces:xercesImpl:2.12.2' api 'xalan:xalan:2.7.1' diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Constants.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Constants.java index 1102975..d7dfaa1 100644 --- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Constants.java +++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/Constants.java @@ -100,7 +100,7 @@ public interface Constants { /** Local location of the MOA configuration XML schema definition. */ String MOA_CONFIG_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-SPSS-config-3.0.0.xsd"; + SCHEMA_ROOT + "MOA-SPSS-config-3.2.0.xsd"; /** Local location of the MOA ID configuration XML schema definition. */ String MOA_ID_CONFIG_SCHEMA_LOCATION = diff --git a/moaSig/common/src/main/resources/resources/schemas/MOA-SPSS-config-3.2.0.xsd b/moaSig/common/src/main/resources/resources/schemas/MOA-SPSS-config-3.2.0.xsd new file mode 100644 index 0000000..cb405c3 --- /dev/null +++ b/moaSig/common/src/main/resources/resources/schemas/MOA-SPSS-config-3.2.0.xsd @@ -0,0 +1,383 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/moaSig/libs/cpxlevel.jar b/moaSig/libs/cpxlevel.jar deleted file mode 100644 index a00eeb4..0000000 Binary files a/moaSig/libs/cpxlevel.jar and /dev/null differ diff --git a/moaSig/libs/iaik_cms-6.0_moa.jar b/moaSig/libs/iaik_cms-6.0_moa.jar new file mode 100644 index 0000000..f11b250 Binary files /dev/null and b/moaSig/libs/iaik_cms-6.0_moa.jar differ diff --git a/moaSig/libs/iaik_cms.jar b/moaSig/libs/iaik_cms.jar deleted file mode 100644 index 127160d..0000000 Binary files a/moaSig/libs/iaik_cms.jar and /dev/null differ diff --git a/moaSig/libs/iaik_cpades-2.4_MOA.jar b/moaSig/libs/iaik_cpades-2.4_MOA.jar deleted file mode 100644 index 300c215..0000000 Binary files a/moaSig/libs/iaik_cpades-2.4_MOA.jar and /dev/null differ diff --git a/moaSig/libs/iaik_cpades-2.4_moa.jar b/moaSig/libs/iaik_cpades-2.4_moa.jar new file mode 100644 index 0000000..300c215 Binary files /dev/null and b/moaSig/libs/iaik_cpades-2.4_moa.jar differ diff --git a/moaSig/libs/iaik_cpxlevel-0.9.1_moa.jar b/moaSig/libs/iaik_cpxlevel-0.9.1_moa.jar new file mode 100644 index 0000000..0bbbf6e Binary files /dev/null and b/moaSig/libs/iaik_cpxlevel-0.9.1_moa.jar differ diff --git a/moaSig/libs/iaik_eccelerate-6.02.jar b/moaSig/libs/iaik_eccelerate-6.02.jar deleted file mode 100644 index e30b629..0000000 Binary files a/moaSig/libs/iaik_eccelerate-6.02.jar and /dev/null differ diff --git a/moaSig/libs/iaik_eccelerate-6.3.0_eval.jar b/moaSig/libs/iaik_eccelerate-6.3.0_eval.jar new file mode 100644 index 0000000..4422430 Binary files /dev/null and b/moaSig/libs/iaik_eccelerate-6.3.0_eval.jar differ diff --git a/moaSig/libs/iaik_eccelerate_addon-6.02.jar b/moaSig/libs/iaik_eccelerate_addon-6.02.jar deleted file mode 100644 index 94f2de5..0000000 Binary files a/moaSig/libs/iaik_eccelerate_addon-6.02.jar and /dev/null differ diff --git a/moaSig/libs/iaik_eccelerate_addon-6.3.0_eval.jar b/moaSig/libs/iaik_eccelerate_addon-6.3.0_eval.jar new file mode 100644 index 0000000..182a150 Binary files /dev/null and b/moaSig/libs/iaik_eccelerate_addon-6.3.0_eval.jar differ diff --git a/moaSig/libs/iaik_eccelerate_cms-6.02.jar b/moaSig/libs/iaik_eccelerate_cms-6.02.jar deleted file mode 100644 index 32d7aec..0000000 Binary files a/moaSig/libs/iaik_eccelerate_cms-6.02.jar and /dev/null differ diff --git a/moaSig/libs/iaik_jce_full_signed-5.63_MOA.jar b/moaSig/libs/iaik_jce_full_signed-5.63_MOA.jar deleted file mode 100644 index cf4a2dd..0000000 Binary files a/moaSig/libs/iaik_jce_full_signed-5.63_MOA.jar and /dev/null differ diff --git a/moaSig/libs/iaik_jce_full_signed-6.01_moa.jar b/moaSig/libs/iaik_jce_full_signed-6.01_moa.jar new file mode 100644 index 0000000..bde418f Binary files /dev/null and b/moaSig/libs/iaik_jce_full_signed-6.01_moa.jar differ diff --git a/moaSig/libs/iaik_moa-2.08.jar b/moaSig/libs/iaik_moa-2.08.jar deleted file mode 100644 index 16a3529..0000000 Binary files a/moaSig/libs/iaik_moa-2.08.jar and /dev/null differ diff --git a/moaSig/libs/iaik_moa-2.09.jar b/moaSig/libs/iaik_moa-2.09.jar new file mode 100644 index 0000000..a73a348 Binary files /dev/null and b/moaSig/libs/iaik_moa-2.09.jar differ diff --git a/moaSig/libs/iaik_pki_module-2.02_moa.jar b/moaSig/libs/iaik_pki_module-2.02_moa.jar deleted file mode 100644 index b7979e5..0000000 Binary files a/moaSig/libs/iaik_pki_module-2.02_moa.jar and /dev/null differ diff --git a/moaSig/libs/iaik_pki_module-2.03_moa.jar b/moaSig/libs/iaik_pki_module-2.03_moa.jar new file mode 100644 index 0000000..a017fe6 Binary files /dev/null and b/moaSig/libs/iaik_pki_module-2.03_moa.jar differ diff --git a/moaSig/libs/iaik_sva-1.2.0.jar b/moaSig/libs/iaik_sva-1.2.0.jar new file mode 100644 index 0000000..a9d3824 Binary files /dev/null and b/moaSig/libs/iaik_sva-1.2.0.jar differ diff --git a/moaSig/libs/iaik_tsp-2.32_eval.jar b/moaSig/libs/iaik_tsp-2.32_eval.jar new file mode 100644 index 0000000..fbd9abd Binary files /dev/null and b/moaSig/libs/iaik_tsp-2.32_eval.jar differ diff --git a/moaSig/libs/iaik_tsp.jar b/moaSig/libs/iaik_tsp.jar deleted file mode 100644 index fbd9abd..0000000 Binary files a/moaSig/libs/iaik_tsp.jar and /dev/null differ diff --git a/moaSig/libs/iaik_xsect-2.14_MOA.jar b/moaSig/libs/iaik_xsect-2.14_MOA.jar deleted file mode 100644 index aa3c229..0000000 Binary files a/moaSig/libs/iaik_xsect-2.14_MOA.jar and /dev/null differ diff --git a/moaSig/libs/iaik_xsect-2.14_moa.jar b/moaSig/libs/iaik_xsect-2.14_moa.jar new file mode 100644 index 0000000..aa3c229 Binary files /dev/null and b/moaSig/libs/iaik_xsect-2.14_moa.jar differ diff --git a/moaSig/libs/sigval-0.0.1.jar b/moaSig/libs/sigval-0.0.1.jar deleted file mode 100644 index efbbbaa..0000000 Binary files a/moaSig/libs/sigval-0.0.1.jar and /dev/null differ diff --git a/moaSig/libs/sigvallib-0.0.1.jar b/moaSig/libs/sigvallib-0.0.1.jar deleted file mode 100644 index 16b9d78..0000000 Binary files a/moaSig/libs/sigvallib-0.0.1.jar and /dev/null differ diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java index 5daf1a6..5f8b46d 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java @@ -94,6 +94,9 @@ public class ConfigurationPartsBuilder { private static final String CM_CHAINING = "chaining"; private static final String CM_PKIX = "pkix"; + private static final int SHORT_TIME_CERT_DEFAULT_INTERVAL = 0; + private static final boolean SHORT_TIME_CERT_DEFAULT_ETSI = true; + // // XPath expressions to select certain parts of the configuration // @@ -205,6 +208,17 @@ public class ConfigurationPartsBuilder { + CONF + "RevocationChecking/" + CONF + "CrlRetentionIntervals/" + CONF + "CA"; + + private static final String SHORT_TIME_CERTS_INTERVALS_XPATH = + ROOT + CONF + "SignatureVerification/" + + CONF + "CertificateValidation/" + + CONF + "RevocationChecking/" + + CONF + "ShortTermedCertificates"; + + private static final String SHORT_TIME_CERTS_INTERVALS_CA_XPATH = + SHORT_TIME_CERTS_INTERVALS_XPATH + "/" + + CONF + "CA"; + private static final String ENABLE_REVOCATION_CHECKING_XPATH_ = ROOT + CONF + "SignatureVerification/" + CONF + "CertificateValidation/" @@ -1718,17 +1732,84 @@ public class ConfigurationPartsBuilder { final String x509IssuerName = getElementValue(modElem, CONF + "X509IssuerName", null); final String i = getElementValue(modElem, CONF + "Interval", null); final Integer interval = new Integer(i); - try { - final RFC2253NameParser parser = new RFC2253NameParser(x509IssuerName); - final Name name = parser.parse(); - map.put(name.getRFC2253String(), interval); - } catch (final RFC2253NameParserException e) { - map.put(x509IssuerName, interval); - } + map.put(ConfigurationProvider.normalizeX500Names(x509IssuerName), interval); } return map; } + + /** + * Should ETSI extension should be used for short-time certificate validation. + * + * @return true if it is used + */ + public boolean isShotTimeCertEtsiExtCheck() { + final NodeIterator modIter = XPathUtils.selectNodeIterator( + getConfigElem(), + SHORT_TIME_CERTS_INTERVALS_XPATH); + + Element modElem; + if ((modElem = (Element) modIter.nextNode()) != null) { + Boolean value = Boolean.valueOf(modElem.getAttribute("checkETSIValidityAssuredExtension")); + Logger.debug((value ? "Enable" : "Disable") + "shortTime certificate ETSI extension"); + return value; + + } + + return SHORT_TIME_CERT_DEFAULT_ETSI; + } + + /** + * Get default shortTime certificate interval. + * + * @return Time in minutes + */ + public int getShotTimeCertDefaultInterval() { + final NodeIterator modIter = XPathUtils.selectNodeIterator( + getConfigElem(), + SHORT_TIME_CERTS_INTERVALS_XPATH); + + Element modElem; + if ((modElem = (Element) modIter.nextNode()) != null) { + String defaultString = modElem.getAttribute("defaultValidityPeriod"); + Logger.debug("Set default shortTimePeriodInterval to: " + defaultString); + return Integer.valueOf(defaultString); + + } + + return SHORT_TIME_CERT_DEFAULT_INTERVAL; + } + + + /** + * Returns a map of shortTime certificate intervals. + * + *

+ * No revocation checks are performed during this interval. + *

+ * + * @return + */ + public Map getShotTimeCertIntervals() { + final Map map = new HashMap(); + final NodeIterator modIter = XPathUtils.selectNodeIterator( + getConfigElem(), + SHORT_TIME_CERTS_INTERVALS_CA_XPATH); + + Element modElem; + while ((modElem = (Element) modIter.nextNode()) != null) { + final String x509IssuerName = ConfigurationProvider.normalizeX500Names( + getElementValue(modElem, CONF + "X509IssuerName", null)); + final String i = getElementValue(modElem, CONF + "ValidityPeriod", null); + final Integer interval = new Integer(i); + map.put(x509IssuerName, interval); + Logger.debug("Set shortTimePeriodInterval: " + interval + " for Issuer: " + x509IssuerName); + + } + + return map; + } + } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java index 4596109..85930b2 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java @@ -258,6 +258,12 @@ public class ConfigurationProvider { */ private Map crlRetentionIntervals; + + private boolean useShortTimeCertificateEtisExt; + private int defaultShortTimeCertificatePeriod; + private Map shortTimeCertificatePeriods; + + /** * Indicates wether external URIs are allowed or not */ @@ -416,6 +422,10 @@ public class ConfigurationProvider { permitFileURIs = builder.getPermitFileURIs(); crlRetentionIntervals = builder.getCrlRetentionIntervals(); + shortTimeCertificatePeriods = builder.getShotTimeCertIntervals(); + defaultShortTimeCertificatePeriod = builder.getShotTimeCertDefaultInterval(); + useShortTimeCertificateEtisExt = builder.isShotTimeCertEtsiExtCheck(); + allowExternalUris_ = builder.allowExternalUris(); if (allowExternalUris_) { @@ -998,5 +1008,33 @@ public class ConfigurationProvider { public TSLConfiguration getTSLConfiguration() { return tslconfiguration_; } + + public int getDefaultShortTimeCertificatePeriod() { + return defaultShortTimeCertificatePeriod; + } + + public boolean isUseShortTimeCertificateEtisExt() { + return useShortTimeCertificateEtisExt; + } + + public Map getShortTimeCertificatePeriods() { + return shortTimeCertificatePeriods; + } + + + public static final String normalizeX500Names(String x500Name) { + try { + final RFC2253NameParser parser = new RFC2253NameParser(x500Name); + final Name name = parser.parse(); + return name.getRFC2253String(); + + } catch (final RFC2253NameParserException e) { + Logger.info("X500Name: " + x500Name + " can not be normalized. Use it as it is"); + return x500Name; + + } + + } + } \ No newline at end of file diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/RevocationConfigurationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/RevocationConfigurationImpl.java index 6aa20cf..002df3b 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/RevocationConfigurationImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/RevocationConfigurationImpl.java @@ -30,8 +30,11 @@ import java.util.Map; import java.util.Set; import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; +import at.gv.egovernment.moaspss.logging.Logger; +import iaik.asn1.structures.Name; import iaik.pki.revocation.RevocationConfiguration; import iaik.pki.revocation.dbcrl.config.DBCrlConfig; +import iaik.utils.RFC2253NameParserException; /** * An implementation of the RevocationConfiguration interface using @@ -111,4 +114,31 @@ public class RevocationConfigurationImpl extends AbstractObservableConfiguration return false; } + @Override + public boolean checkETSIValidityAssuredShortTermExt() { + return config.isUseShortTimeCertificateEtisExt(); + + } + + @Override + public Long getShortTermedValidityPeriod(X509Certificate eeCert) { + try { + String issuer = ConfigurationProvider.normalizeX500Names(((Name)eeCert.getIssuerDN()).getRFC2253String()); + if (config.getShortTimeCertificatePeriods().containsKey(issuer)) { + Integer interval = config.getShortTimeCertificatePeriods().get(issuer); + Logger.debug("Use shortTermedValidityPeriod: " + interval + "[min] for Issuer: " + issuer); + return Long.valueOf(interval) * 60 * 1000; + + } + + } catch (RFC2253NameParserException e) { + Logger.warn("Can not normalize X509 IssuerName: " + eeCert.getIssuerDN(), e); + + } + + Logger.debug("Use default shortTermedValidityPeriod: " + config.getDefaultShortTimeCertificatePeriod() + "[min]"); + return Long.valueOf(config.getDefaultShortTimeCertificatePeriod()) * 60 * 1000; + + } + } -- cgit v1.2.3