aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-moa/src/main/java/at/gv/egiz/pdfas
diff options
context:
space:
mode:
authorbschnalzer <bianca.schnalzer@egiz.gv.at>2017-08-09 13:56:12 +0200
committerbschnalzer <bianca.schnalzer@egiz.gv.at>2017-08-09 13:56:14 +0200
commit7fe464cc98d714179b907c142bdd2fabfd009aa3 (patch)
tree328c53a9b60dfa1106c6b9d930d75ab127dce33f /pdf-as-moa/src/main/java/at/gv/egiz/pdfas
parent17be060a4d2d79ee75036a2f785d4a4913f7935f (diff)
downloadpdf-as-4-7fe464cc98d714179b907c142bdd2fabfd009aa3.tar.gz
pdf-as-4-7fe464cc98d714179b907c142bdd2fabfd009aa3.tar.bz2
pdf-as-4-7fe464cc98d714179b907c142bdd2fabfd009aa3.zip
Fixed problem with PAdES Signatures, removed some attributes from CAdES signatures which are not required, minor bug fixes, implemented new style (lineCenter)4.1.1-RC
Diffstat (limited to 'pdf-as-moa/src/main/java/at/gv/egiz/pdfas')
-rw-r--r--pdf-as-moa/src/main/java/at/gv/egiz/pdfas/moa/MOAConnector.java28
1 files changed, 22 insertions, 6 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 5f3d9cb8..a6cbcd72 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
@@ -23,6 +23,7 @@
******************************************************************************/
package at.gv.egiz.pdfas.moa;
+import at.gv.e_government.reference.namespace.moa._20020822.*;
import iaik.x509.X509Certificate;
import java.io.File;
@@ -32,6 +33,9 @@ import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.cert.CertificateException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
import javax.xml.ws.BindingProvider;
@@ -39,14 +43,9 @@ import org.apache.commons.codec.binary.Base64;
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_.MOAFault;
import at.gv.e_government.reference.namespace.moa._20020822_.SignatureCreationPortType;
import at.gv.e_government.reference.namespace.moa._20020822_.SignatureCreationService;
@@ -80,6 +79,7 @@ public class MOAConnector implements ISignatureConnector,
private String moaEndpoint;
private String keyIdentifier;
+
public MOAConnector(Configuration config,
java.security.cert.Certificate certificate)
throws CertificateException, FileNotFoundException, IOException {
@@ -161,6 +161,7 @@ public class MOAConnector implements ISignatureConnector,
return this.certificate;
}
+
public byte[] sign(byte[] input, int[] byteRange, SignParameter parameter,
RequestedSignature requestedSignature) throws PdfAsException {
@@ -187,8 +188,23 @@ public class MOAConnector implements ISignatureConnector,
DataObject dataObject = new DataObject();
MetaInfoType metaInfoType = new MetaInfoType();
- metaInfoType.setMimeType("application/pdf");
+ if (parameter.getConfiguration().hasValue(IConfigurationConstants.SIG_PADES_FORCE_FLAG))
+ {
+ if (IConfigurationConstants.TRUE.equalsIgnoreCase(parameter.getConfiguration().getValue(IConfigurationConstants.SIG_PADES_FORCE_FLAG)))
+ {
+ metaInfoType.setMimeType("application/pdf");
+ sigInfo.setPAdESConformity(true);
+ }
+ else
+ {
+ metaInfoType.setMimeType("application/pdf");
+ }
+ }
+ else
+ {
+ metaInfoType.setMimeType("application/pdf");
+ }
dataObject.setMetaInfo(metaInfoType);
CMSContentBaseType content = new CMSContentBaseType();