diff options
Diffstat (limited to 'pdf-as-moa/src/main/java')
| -rw-r--r-- | pdf-as-moa/src/main/java/at/gv/egiz/pdfas/moa/MOAConnector.java | 28 | ||||
| -rw-r--r-- | pdf-as-moa/src/main/java/at/gv/egiz/pdfas/moa/MOAVerifier.java | 21 |
2 files changed, 25 insertions, 24 deletions
diff --git a/pdf-as-moa/src/main/java/at/gv/egiz/pdfas/moa/MOAConnector.java b/pdf-as-moa/src/main/java/at/gv/egiz/pdfas/moa/MOAConnector.java index 8c07875a..11d00c75 100644 --- a/pdf-as-moa/src/main/java/at/gv/egiz/pdfas/moa/MOAConnector.java +++ b/pdf-as-moa/src/main/java/at/gv/egiz/pdfas/moa/MOAConnector.java @@ -40,15 +40,15 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import at.gv.e_government.reference.namespace.moa._20020822.CMSContentBaseType; -import at.gv.e_government.reference.namespace.moa._20020822.CMSDataObjectInfoType.DataObject; -import at.gv.e_government.reference.namespace.moa._20020822.CreateCMSSignatureRequest; -import at.gv.e_government.reference.namespace.moa._20020822.CreateCMSSignatureRequestType.SingleSignatureInfo; -import at.gv.e_government.reference.namespace.moa._20020822.CreateCMSSignatureRequestType.SingleSignatureInfo.DataObjectInfo; -import at.gv.e_government.reference.namespace.moa._20020822.CreateCMSSignatureResponseType; -import at.gv.e_government.reference.namespace.moa._20020822.ErrorResponseType; -import at.gv.e_government.reference.namespace.moa._20020822.MetaInfoType; +import at.gv.e_government.reference.namespace.moa._20020822_.CMSContentBaseType; +import at.gv.e_government.reference.namespace.moa._20020822_.CMSDataObjectInfoType.DataObject; +import at.gv.e_government.reference.namespace.moa._20020822_.CreateCMSSignatureRequest; +import at.gv.e_government.reference.namespace.moa._20020822_.CreateCMSSignatureRequestType.SingleSignatureInfo; +import at.gv.e_government.reference.namespace.moa._20020822_.CreateCMSSignatureRequestType.SingleSignatureInfo.DataObjectInfo; +import at.gv.e_government.reference.namespace.moa._20020822_.CreateCMSSignatureResponseType; +import at.gv.e_government.reference.namespace.moa._20020822_.ErrorResponseType; import at.gv.e_government.reference.namespace.moa._20020822_.MOAFault; +import at.gv.e_government.reference.namespace.moa._20020822_.MetaInfoType; import at.gv.e_government.reference.namespace.moa._20020822_.SignatureCreationPortType; import at.gv.e_government.reference.namespace.moa._20020822_.SignatureCreationService; import at.gv.egiz.pdfas.common.exceptions.ErrorConstants; @@ -134,7 +134,7 @@ public class MOAConnector implements ISignatureConnector, URL certificateURL = new URL(certificateValue); is = certificateURL.openStream(); this.certificate = new X509Certificate(is); - + } catch (MalformedURLException e) { logger.error(certificateValue + " is not a valid url but starts with http!"); throw new PdfAsWrappedIOException(new PdfAsException(certificateValue + " is not a valid url but!")); @@ -193,10 +193,11 @@ public class MOAConnector implements ISignatureConnector, if (this.mtomEnabled) { if (provider.getBinding() instanceof SOAPBinding) { - ((SOAPBinding) provider.getBinding()).setMTOMEnabled(true); + ((SOAPBinding) provider.getBinding()).setMTOMEnabled(true); + } } - + CreateCMSSignatureRequest request = new CreateCMSSignatureRequest(); request.setKeyIdentifier(this.keyIdentifier.trim()); SingleSignatureInfo sigInfo = new SingleSignatureInfo(); @@ -205,8 +206,7 @@ public class MOAConnector implements ISignatureConnector, dataObjectInfo.setStructure("detached"); DataObject dataObject = new DataObject(); MetaInfoType metaInfoType = new MetaInfoType(); - - + if (parameter.getConfiguration().hasValue(IConfigurationConstants.SIG_PADES_FORCE_FLAG)) { if (IConfigurationConstants.TRUE.equalsIgnoreCase(parameter.getConfiguration().getValue(IConfigurationConstants.SIG_PADES_FORCE_FLAG))) @@ -245,6 +245,8 @@ public class MOAConnector implements ISignatureConnector, try { response = creationPort.createCMSSignature(request); + + } catch (MOAFault e) { logger.warn("MOA signing failed!", e); if (e.getFaultInfo() != null) { diff --git a/pdf-as-moa/src/main/java/at/gv/egiz/pdfas/moa/MOAVerifier.java b/pdf-as-moa/src/main/java/at/gv/egiz/pdfas/moa/MOAVerifier.java index 5deeef43..40ea4ba5 100644 --- a/pdf-as-moa/src/main/java/at/gv/egiz/pdfas/moa/MOAVerifier.java +++ b/pdf-as-moa/src/main/java/at/gv/egiz/pdfas/moa/MOAVerifier.java @@ -1,7 +1,5 @@ package at.gv.egiz.pdfas.moa; -import iaik.x509.X509Certificate; - import java.util.ArrayList; import java.util.Date; import java.util.GregorianCalendar; @@ -14,17 +12,17 @@ import javax.xml.ws.BindingProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.w3._2000._09.xmldsig.KeyInfoType; -import org.w3._2000._09.xmldsig.X509DataType; +import org.w3._2000._09.xmldsig_.KeyInfoType; +import org.w3._2000._09.xmldsig_.X509DataType; -import at.gv.e_government.reference.namespace.moa._20020822.CMSContentBaseType; -import at.gv.e_government.reference.namespace.moa._20020822.CMSDataObjectOptionalMetaType; -import at.gv.e_government.reference.namespace.moa._20020822.CheckResultType; -import at.gv.e_government.reference.namespace.moa._20020822.MetaInfoType; -import at.gv.e_government.reference.namespace.moa._20020822.VerifyCMSSignatureRequest; -import at.gv.e_government.reference.namespace.moa._20020822.VerifyCMSSignatureResponseType; +import at.gv.e_government.reference.namespace.moa._20020822_.CMSContentBaseType; +import at.gv.e_government.reference.namespace.moa._20020822_.CMSDataObjectOptionalMetaType; +import at.gv.e_government.reference.namespace.moa._20020822_.CheckResultType; +import at.gv.e_government.reference.namespace.moa._20020822_.MetaInfoType; import at.gv.e_government.reference.namespace.moa._20020822_.SignatureVerificationPortType; import at.gv.e_government.reference.namespace.moa._20020822_.SignatureVerificationService; +import at.gv.e_government.reference.namespace.moa._20020822_.VerifyCMSSignatureRequest; +import at.gv.e_government.reference.namespace.moa._20020822_.VerifyCMSSignatureResponseType; import at.gv.egiz.pdfas.common.exceptions.PdfAsException; import at.gv.egiz.pdfas.lib.api.Configuration; import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter.SignatureVerificationLevel; @@ -32,6 +30,7 @@ import at.gv.egiz.pdfas.lib.api.verify.VerifyResult; import at.gv.egiz.pdfas.lib.impl.verify.IVerifier; import at.gv.egiz.pdfas.lib.impl.verify.SignatureCheckImpl; import at.gv.egiz.pdfas.lib.impl.verify.VerifyResultImpl; +import iaik.x509.X509Certificate; public class MOAVerifier implements IVerifier { @@ -86,7 +85,7 @@ public class MOAVerifier implements IVerifier { logger.debug("Got Verify Response from MOA"); - List<JAXBElement<?>> verifySequence = response.getSignerInfoAndSignatureCheckAndCertificateCheck(); + List<JAXBElement<?>> verifySequence = response.getSignerInfoAndSignatureAlgorithmAndSignatureCheck(); VerifyResultImpl result = new VerifyResultImpl(); |
