diff options
Diffstat (limited to 'moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa')
-rw-r--r-- | moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvoker.java | 100 |
1 files changed, 29 insertions, 71 deletions
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 188e8e2..42d34fc 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 @@ -147,7 +147,7 @@ public class CMSSignatureVerificationInvoker { // build the profile if (request.isPDF()) { PDFSignatureVerificationProfile profile = profileFactory.createPDFProfile(); - Logger.info("Sending PDFSignatureVerificationProfile to IAIK-MOA"); + Logger.debug("Sending PDFSignatureVerificationProfile to IAIK-MOA"); PDFSignatureVerificationModule module = iaik.server.modules.pdfverify.PDFSignatureVerificationModuleFactory .getInstance(); @@ -174,7 +174,7 @@ public class CMSSignatureVerificationInvoker { // get the signed content signedContent = getSignedContent(request); CMSSignatureVerificationProfile profile = profileFactory.createProfile(); - Logger.info("Sending CMSSignatureVerificationProfile to IAIK-MOA"); + Logger.debug("Sending CMSSignatureVerificationProfile to IAIK-MOA"); // verify the signature CMSSignatureVerificationModule module = CMSSignatureVerificationModuleFactory.getInstance(); @@ -276,24 +276,28 @@ public class CMSSignatureVerificationInvoker { adesResults = AdESResultUtils.getAdESResult(result.getFormVerificationResult()); - if (adesResults != null) { + if (Logger.isDebugEnabled() && adesResults != null) { Iterator adesIterator = adesResults.iterator(); - while (adesIterator.hasNext()) { - Logger.info("ADES Formresults: " + adesIterator.next().toString()); - } + while (adesIterator.hasNext()) + Logger.debug("ADES Formresults: " + adesIterator.next().toString()); + } + try { //Logger.info("Extended Validation Report: " + result.getName()); - Logger.info("Extended Validation Code: " + result.getResultCode().toString()); - Logger.info("Extended Validation Info: " + result.getInfo()); + Logger.debug("Extended Validation Code: " + result.getResultCode().toString()); + Logger.debug("Extended Validation Info: " + result.getInfo()); extCheckResult = AdESResultUtils.getExtendedResult(result.getResultCode()); + } catch (NullPointerException e) { Logger.info("No extendend validation result available."); + } } else { - Logger.info("Got CMSSignatureVerificationResult"); + Logger.debug("Got CMSSignatureVerificationResult"); cmsResult = (CMSSignatureVerificationResult) resultObject; + } String issuerCountryCode = null; @@ -342,29 +346,34 @@ public class CMSSignatureVerificationInvoker { cmsResult = result.getPDFSignatureVerificationResult(); adesResults = AdESResultUtils.getAdESResult(result.getFormVerificationResult()); - if (adesResults != null) { + if (Logger.isDebugEnabled() && adesResults != null) { Iterator adesIterator = adesResults.iterator(); - while (adesIterator.hasNext()) { - Logger.info("ADES Formresults: " + adesIterator.next().toString()); - } + while (adesIterator.hasNext()) + Logger.debug("ADES Formresults: " + adesIterator.next().toString()); + } + cmsResult = result.getPDFSignatureVerificationResult(); + try { - //Logger.info("Extended Validation Report: " + result.getName()); - Logger.info("Extended Validation Code: " + result.getResultCode().toString()); + Logger.debug("Extended Validation Code: " + result.getResultCode().toString()); + if (result.getDetailedExtendedReport() != null) - Logger.info("Extended Validation Info: " + result.getDetailedExtendedReport().getMessage()); + Logger.debug("Extended Validation Info: " + result.getDetailedExtendedReport().getMessage()); else - Logger.info("Extended Validation Info: " + result.getInfo()); + Logger.debug("Extended Validation Info: " + result.getInfo()); - Logger.debug("Full extended Validation Infos: " + result.getInfo()); - + + Logger.debug("Full extended Validation Infos: " + result.getInfo()); extCheckResult = AdESResultUtils.getExtendedResult(result.getResultCode()); + } catch (NullPointerException e) { Logger.info("No extendend validation result available."); + } + } else { - Logger.info("Got PDFSignatureVerificationResult"); + Logger.debug("Got PDFSignatureVerificationResult"); cmsResult = (PDFSignatureVerificationResult) resultObject; } @@ -505,55 +514,4 @@ public class CMSSignatureVerificationInvoker { } } - - private List getAdESResult(ExtendedCMSSignatureVerificationResult adesFormVerification) throws ConfigurationException { - if (adesFormVerification == null) { - // no form information - return null; - } - - List adesList = new ArrayList(); - Logger.info("Checking AdES Results:"); - - //AdESResultUtils.buildResult(adesFormVerification.getDetailedExtendedReport(), adesList); - - //AdESResultUtils.checkSubResult(adesFormVerification.getSubResult(AdESConstants.LONG_TERM_VALIDATION), - // SignatureVerificationProfile.LEVEL_LTA, adesList); - AdESResultUtils.checkSubResult(adesFormVerification.getSubResult(AdESConstants.LONG_TERM_VALIDATION), - SignatureVerificationProfile.LEVEL_LT, adesList); - AdESResultUtils.checkSubResult(adesFormVerification.getSubResult(AdESConstants.ADES_T_VALIDATION), - SignatureVerificationProfile.LEVEL_T, adesList); - AdESResultUtils.checkSubResult(adesFormVerification.getSubResult("basic report"), - SignatureVerificationProfile.LEVEL_B, adesList); - - return adesList; - } - - private List getAdESResult(ExtendedPDFSignatureVerificationResult adesFormVerification) throws ConfigurationException { - if (adesFormVerification == null) { - // no form information - return null; - } - - List adesList = new ArrayList(); - - /*checkSubResult(adesFormVerification.getSubResult(SignatureVerificationProfile.LEVEL_LTA), - SignatureVerificationProfile.LEVEL_LTA, adesList); - checkSubResult(adesFormVerification.getSubResult(SignatureVerificationProfile.LEVEL_LT), - SignatureVerificationProfile.LEVEL_LT, adesList); - checkSubResult(adesFormVerification.getSubResult(SignatureVerificationProfile.LEVEL_T), - SignatureVerificationProfile.LEVEL_T, adesList); - checkSubResult(adesFormVerification.getSubResult(SignatureVerificationProfile.LEVEL_B), - SignatureVerificationProfile.LEVEL_B, adesList); - */ - - AdESResultUtils.checkSubResult(adesFormVerification.getSubResult(AdESConstants.LONG_TERM_VALIDATION), - SignatureVerificationProfile.LEVEL_LT, adesList); - AdESResultUtils.checkSubResult(adesFormVerification.getSubResult(AdESConstants.ADES_T_VALIDATION), - SignatureVerificationProfile.LEVEL_T, adesList); - AdESResultUtils.checkSubResult(adesFormVerification.getSubResult("basic report"), - SignatureVerificationProfile.LEVEL_B, adesList); - - return adesList; - } } |