From cf8769c549882f47bad496bc4ba9bd14a65429bc Mon Sep 17 00:00:00 2001 From: tlenz Date: Fri, 5 May 2017 07:42:27 +0200 Subject: update iaik_moa.jar to 2.03 update MOA-SP to support new IAIK_MOA API --- .../gv/egovernment/moa/spss/OutputConstants.java | 2 +- .../invoke/CMSSignatureVerificationInvoker.java | 4 ---- .../invoke/XMLSignatureVerificationInvoker.java | 2 -- .../egovernment/moa/spss/util/AdESResultUtils.java | 28 ++++++++++++++++++---- 4 files changed, 24 insertions(+), 12 deletions(-) (limited to 'moaSig/moa-sig-lib/src') diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/OutputConstants.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/OutputConstants.java index 83519d2..c264475 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/OutputConstants.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/OutputConstants.java @@ -2,7 +2,7 @@ package at.gv.egovernment.moa.spss; import java.lang.reflect.Field; -import iaik.server.modules.ResultCode; +import iaik.server.modules.resultcodes.ResultCode; public class OutputConstants { public static void main(String[] argv) throws IllegalArgumentException, IllegalAccessException { 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 d618bab..34d6a22 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 @@ -288,8 +288,6 @@ public class CMSSignatureVerificationInvoker { Logger.info("Extended Validation Info: " + result.getInfo()); extCheckResult = AdESResultUtils.getExtendedResult(result.getResultCode()); - } catch (ConfigurationException e) { - Logger.warn("Cannot generate Extendend Result. Check SVA Configuration!", e); } catch (NullPointerException e) { Logger.info("No extendend validation result available."); } @@ -357,8 +355,6 @@ public class CMSSignatureVerificationInvoker { Logger.info("Extended Validation Info: " + result.getInfo()); extCheckResult = AdESResultUtils.getExtendedResult(result.getResultCode()); - } catch (ConfigurationException e) { - Logger.warn("Cannot generate Extendend Result. Check SVA Configuration!", e); } catch (NullPointerException e) { Logger.info("No extendend validation result available."); } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java index 827728c..e68092f 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvoker.java @@ -260,8 +260,6 @@ public class XMLSignatureVerificationInvoker { extCheckResult = AdESResultUtils.getExtendedResult(result.getResultCode()); responseBuilder.setExtendedCertificateCheckResult(extCheckResult); - } catch (ConfigurationException e) { - Logger.warn("Cannot generate Extendend Result. Check SVA Configuration!", e); } catch (NullPointerException e) { Logger.info("No extendend validation result available."); } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/AdESResultUtils.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/AdESResultUtils.java index b6bba93..b1fee06 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/AdESResultUtils.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/util/AdESResultUtils.java @@ -12,19 +12,24 @@ import at.gv.egovernment.moaspss.logging.Logger; import iaik.esi.sva.validation.ValidationReport; import iaik.server.ConfigurationException; import iaik.server.modules.AdESVerificationResult; -import iaik.server.modules.ResultCode; -import iaik.server.modules.ResultCodeInvalid; -import iaik.server.modules.ResultCodeValid; import iaik.server.modules.SignatureVerificationProfile; import iaik.server.modules.SignatureVerificationResult; +import iaik.server.modules.resultcodes.ResultCode; +import iaik.server.modules.resultcodes.ResultCodeError; +import iaik.server.modules.resultcodes.ResultCodeInvalid; +import iaik.server.modules.resultcodes.ResultCodeSkipped; +import iaik.server.modules.resultcodes.ResultCodeValid; public class AdESResultUtils { + private static final int MAJORRESULTCODESKIPPED = new Integer(3); + private static final int MAJORRESULTCODEERROR = new Integer(4); + public static Integer getResultCode(Integer adesCode) { return adesCode; } - public static ExtendedCertificateCheckResult getExtendedResult(iaik.server.modules.ResultCode resultCode) { + public static ExtendedCertificateCheckResult getExtendedResult(iaik.server.modules.resultcodes.ResultCode resultCode) { ExtendedCertificateCheckResult check = null; int majorCode = -1; @@ -37,9 +42,19 @@ public class AdESResultUtils { if (resultCode instanceof ResultCodeValid) { majorCode = SignatureVerificationResult.VALID; majorInfo = "VALID"; + } else if (resultCode instanceof ResultCodeInvalid) { majorCode = SignatureVerificationResult.INVALID; majorInfo = "INVALID"; + + } else if (resultCode instanceof ResultCodeSkipped) { + majorCode = MAJORRESULTCODESKIPPED; + majorInfo = "SKIPPED"; + + } else if (resultCode instanceof ResultCodeError) { + majorCode = MAJORRESULTCODEERROR; + majorInfo = "ERROR"; + } else { majorCode = SignatureVerificationResult.INDETERMINATE; majorInfo = "INDETERMINATE"; @@ -93,7 +108,10 @@ public class AdESResultUtils { minorInfo = "UNKNOWN_COMMITMENT_TYPE"; } else if (resultCode.getCode().equals(ResultCode.SUCCESS)) { minorInfo = "SUCCESS"; + } else if (resultCode.getCode().equals(ResultCode.UNKNOWN_SUBFILTER)) { + minorInfo = "UNKNOWN_SUBFILTER"; } + } check = new ExtendedCertificateCheckResultImpl(majorCode, majorInfo, minorCode, @@ -198,7 +216,7 @@ public class AdESResultUtils { try { AdESFormResultsImpl adESFormResultsImpl = new AdESFormResultsImpl(); - ResultCode resultCode = subResult.getResultCode(); + iaik.server.modules.resultcodes.ResultCode resultCode = subResult.getResultCode(); if (resultCode instanceof ResultCodeValid) { adESFormResultsImpl.setCode(SignatureVerificationResult.VALID);// .getResultCode().getCode())); } else if (resultCode instanceof ResultCodeInvalid) { -- cgit v1.2.3