aboutsummaryrefslogtreecommitdiff
path: root/moaSig/moa-sig-lib/src/main
diff options
context:
space:
mode:
authortlenz <thomas.lenz@egiz.gv.at>2017-02-13 08:52:01 +0100
committertlenz <thomas.lenz@egiz.gv.at>2017-02-13 08:52:01 +0100
commit863b175fd6c3a81a117ed1c3b7c03293a0d31114 (patch)
tree138d189ec08f1d32be0009bfe82a510e70eaf8ca /moaSig/moa-sig-lib/src/main
parentcb42d8b04befa612d88123bdc7e8f7164377cddd (diff)
parentfd922888dbe58582fb4a045ad93da1cf2664a744 (diff)
downloadmoa-sig-863b175fd6c3a81a117ed1c3b7c03293a0d31114.tar.gz
moa-sig-863b175fd6c3a81a117ed1c3b7c03293a0d31114.tar.bz2
moa-sig-863b175fd6c3a81a117ed1c3b7c03293a0d31114.zip
Merge branch 'master' of https://gitlab.iaik.tugraz.at/egiz/moa-sig
Diffstat (limited to 'moaSig/moa-sig-lib/src/main')
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyPDFSignatureResponseBuilder.java39
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java33
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvoker.java32
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java37
4 files changed, 79 insertions, 62 deletions
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyPDFSignatureResponseBuilder.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyPDFSignatureResponseBuilder.java
index 98b54a3..0ca6f8f 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyPDFSignatureResponseBuilder.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyPDFSignatureResponseBuilder.java
@@ -36,6 +36,7 @@ import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponseElemen
import at.gv.egovernment.moa.spss.api.common.CheckResult;
import at.gv.egovernment.moa.spss.api.common.SignerInfo;
import at.gv.egovernment.moa.spss.api.xmlverify.AdESFormResults;
+import at.gv.egovernment.moaspss.logging.Logger;
/**
* Convert a <code>VerifyCMSSignatureResponse</code> API object into its
@@ -104,22 +105,28 @@ public class VerifyPDFSignatureResponseBuilder {
CheckResult signatureCheck = responseElement.getSignatureCheck();
CheckResult certCheck = responseElement.getCertificateCheck();
- ResponseBuilderUtils.addSignerInfo(
- responseDoc,
- responseElem,
- signerInfo.getSignerCertificate(),
- signerInfo.isQualifiedCertificate(),
- signerInfo.getQCSource(),
- signerInfo.isPublicAuthority(),
- signerInfo.getPublicAuhtorityID(),
- signerInfo.isSSCD(),
- signerInfo.getSSCDSource(),
- signerInfo.getIssuerCountryCode(),
- signerInfo.getTslInfos());
-
- ResponseBuilderUtils.addSigningTime(responseDoc,
- responseElem,
- signerInfo.getSigningTime());
+ if (signerInfo != null) {
+ ResponseBuilderUtils.addSignerInfo(
+ responseDoc,
+ responseElem,
+ signerInfo.getSignerCertificate(),
+ signerInfo.isQualifiedCertificate(),
+ signerInfo.getQCSource(),
+ signerInfo.isPublicAuthority(),
+ signerInfo.getPublicAuhtorityID(),
+ signerInfo.isSSCD(),
+ signerInfo.getSSCDSource(),
+ signerInfo.getIssuerCountryCode(),
+ signerInfo.getTslInfos());
+
+ ResponseBuilderUtils.addSigningTime(responseDoc,
+ responseElem,
+ signerInfo.getSigningTime());
+
+ } else {
+ Logger.info("Find signature result with no 'SignerInfo'. Maybe a signature verification Failed");
+
+ }
ResponseBuilderUtils.addCodeInfoElement(
responseDoc,
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java
index 295e861..0e592f0 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java
@@ -143,27 +143,30 @@ public class SystemInitializer {
// initialize configuration
try {
- ConfigurationProvider config = ConfigurationProvider.getInstance();
- Logger.info("Building ConfigurationData");
- ConfigurationData configData = new IaikConfigurator().configure(config);
+ Logger.info("Initialize MOA-SP/SS configuration ... ");
+ ConfigurationProvider config = ConfigurationProvider.getInstance();
- //initialize TSL module
- TSLConfiguration moaSPTslConfig = config.getTSLConfiguration();
- if (moaSPTslConfig != null) {
- TslConfigurationImpl tslConfig = new TslConfigurationImpl();
- tslConfig.setEuTslURL(moaSPTslConfig.getEuTSLUrl());
- tslConfig.setTslWorkingDirectory(moaSPTslConfig.getWorkingDirectory());
- tslConfig.setNetworkReadTimeout(config.getReadTimeout() / 1000);
+ //initialize TSL module
+ TSLConfiguration moaSPTslConfig = config.getTSLConfiguration();
+ if (moaSPTslConfig != null) {
+ Logger.debug("Starting TSL-Service initialization ... ");
+ TslConfigurationImpl tslConfig = new TslConfigurationImpl();
+ tslConfig.setEuTslURL(moaSPTslConfig.getEuTSLUrl());
+ tslConfig.setTslWorkingDirectory(moaSPTslConfig.getWorkingDirectory());
+ tslConfig.setNetworkReadTimeout(config.getReadTimeout() / 1000);
- Logger.info(new LogMsg(msg.getMessage("config.41", null)));
- TSLServiceFactory.initialize(tslConfig);
- Logger.info("TSL-Service client initialization finished");
+ Logger.info(new LogMsg(msg.getMessage("config.41", null)));
+ TSLServiceFactory.initialize(tslConfig);
+ Logger.info("TSL-Service client initialization finished");
- //initialize TSL Update Task
- initTSLUpdateTask(moaSPTslConfig);
+ //initialize TSL Update Task
+ initTSLUpdateTask(moaSPTslConfig);
}
+ Logger.info("Building IAIK-MOA configuration ... ");
+ new IaikConfigurator().configure(config);
+
runInitializer(config);
Logger.info(new LogMsg(msg.getMessage("init.01", null)));
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvoker.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvoker.java
index 1508b42..c0beced 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvoker.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvoker.java
@@ -361,25 +361,27 @@ public class CMSSignatureVerificationInvoker {
String issuerCountryCode = null;
// QC/SSCD check
+
+ if (cmsResult.getCertificateValidationResult() != null) {
+ List list = cmsResult.getCertificateValidationResult().getCertificateChain();
+ if (list != null) {
+ X509Certificate[] chain = new X509Certificate[list.size()];
+
+ Iterator it = list.iterator();
+ int i = 0;
+ while (it.hasNext()) {
+ chain[i] = (X509Certificate) it.next();
+ i++;
+ }
- List list = cmsResult.getCertificateValidationResult().getCertificateChain();
- if (list != null) {
- X509Certificate[] chain = new X509Certificate[list.size()];
-
- Iterator it = list.iterator();
- int i = 0;
- while (it.hasNext()) {
- chain[i] = (X509Certificate) it.next();
- i++;
- }
-
- qcsscdresult = CertificateUtils.checkQCSSCD(chain, cmsResult.getSigningTime(), trustProfile.isTSLEnabled(), ConfigurationProvider.getInstance());
+ qcsscdresult = CertificateUtils.checkQCSSCD(chain, cmsResult.getSigningTime(), trustProfile.isTSLEnabled(), ConfigurationProvider.getInstance());
- // get signer certificate issuer country code
- issuerCountryCode = CertificateUtils.getIssuerCountry((X509Certificate) list.get(0));
+ // get signer certificate issuer country code
+ issuerCountryCode = CertificateUtils.getIssuerCountry((X509Certificate) list.get(0));
+ }
}
-
+
responseBuilder.addResult(cmsResult, trustProfile, qcsscdresult.isQC(), qcsscdresult.isQCSourceTSL(),
qcsscdresult.isSSCD(), qcsscdresult.isSSCDSourceTSL(), issuerCountryCode, adesResults,
extCheckResult, qcsscdresult.getTslInfos());
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java
index 5ada287..f4121b0 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java
@@ -151,28 +151,33 @@ public class VerifyCMSSignatureResponseBuilder {
result.getCertificateValidationResult();
int signatureCheckCode =
result.getSignatureValueVerificationCode().intValue();
- int certificateCheckCode = certResult.getValidationResultCode().intValue();
-
+
VerifyCMSSignatureResponseElement responseElement;
- SignerInfo signerInfo;
+ SignerInfo signerInfo = null;
CheckResult signatureCheck;
CheckResult certificateCheck;
boolean qualifiedCertificate = checkQC;
- // add SignerInfo element
- signerInfo =
- factory.createSignerInfo(
- (X509Certificate) certResult.getCertificateChain().get(0),
- qualifiedCertificate,
- qcSourceTSL,
- certResult.isPublicAuthorityCertificate(),
- certResult.getPublicAuthorityID(),
- checkSSCD,
- sscdSourceTSL,
- issuerCountryCode,
- result.getSigningTime(),
- tslInfos);
+ //set code 99 if not certcheckresult exists
+ int certificateCheckCode = 99;
+ if (certResult != null) {
+ certificateCheckCode = certResult.getValidationResultCode().intValue();
+
+ // add SignerInfo element
+ signerInfo =
+ factory.createSignerInfo(
+ (X509Certificate) certResult.getCertificateChain().get(0),
+ qualifiedCertificate,
+ qcSourceTSL,
+ certResult.isPublicAuthorityCertificate(),
+ certResult.getPublicAuthorityID(),
+ checkSSCD,
+ sscdSourceTSL,
+ issuerCountryCode,
+ result.getSigningTime(),
+ tslInfos);
+ }
// add SignatureCheck element
signatureCheck = factory.createCheckResult(signatureCheckCode, null);