diff options
author | ferbas <ferbas@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2009-11-13 12:57:14 +0000 |
---|---|---|
committer | ferbas <ferbas@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2009-11-13 12:57:14 +0000 |
commit | ab13bc2c5df96615e6e7865febb1e1208171a4b6 (patch) | |
tree | 6c7239d61e7e95dc4c2b7e0a9cd102e64ff259de /src/main | |
parent | ec1a985e45b747dc0a0311d18b5ec09e9e6abaed (diff) | |
download | pdf-as-3-ab13bc2c5df96615e6e7865febb1e1208171a4b6.tar.gz pdf-as-3-ab13bc2c5df96615e6e7865febb1e1208171a4b6.tar.bz2 pdf-as-3-ab13bc2c5df96615e6e7865febb1e1208171a4b6.zip |
added timestamp support
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@403 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java index efb6312..1340f4d 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java @@ -25,10 +25,14 @@ import java.util.Comparator; import java.util.Date;
import java.util.List;
import java.util.Vector;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import at.gv.egiz.pdfas.algorithmSuite.AlgorithmSuiteUtil;
+import at.gv.egiz.pdfas.api.timestamp.TimeStamper;
import at.gv.egiz.pdfas.commandline.CommandlineConnectorChooser;
import at.gv.egiz.pdfas.exceptions.ErrorCode;
import at.gv.egiz.pdfas.exceptions.framework.CorrectorException;
@@ -477,6 +481,8 @@ public abstract class PdfAS {
// try without /n
found_index = text.lastIndexOf(caption);
+
+ // fix #331 here ??
}
log.debug("found key:" + caption + " at index:" + found_index);
if (key.equals(SignatureTypes.SIG_ID))
@@ -964,7 +970,7 @@ public abstract class PdfAS * F.e.
* @throws ConnectorException
*/
- public static SignSignatureObject sign(final SignatureData data_to_sign, final Connector connector) throws SignatureException, PDFDocumentException, ConnectorException
+ public static SignSignatureObject sign(final SignatureData data_to_sign, final Connector connector, final TimeStamper timeStamper) throws SignatureException, PDFDocumentException, ConnectorException
{
// if (data_to_sign == null || data_to_sign.getData() == null)
// {
@@ -978,6 +984,13 @@ public abstract class PdfAS // }
SignSignatureObject signed_signature_object = connector.doSign(data_to_sign);
+
+ // call timestamper if available
+ if (timeStamper != null) {
+ log.debug("execute timestamping with stamper: " + timeStamper.getClass());
+ signed_signature_object.sigTimeStamp = timeStamper.applyTimeStamp(signed_signature_object.getSignatureValue());
+ }
+
return signed_signature_object;
}
@@ -1033,7 +1046,7 @@ public abstract class PdfAS // signCommandline(pdfDataSource, dataSink, signatorId, connectorId, profile, pos);
// }
- public static SignatorInformation signCommandline(PdfDataSource pdfDataSource, DataSink dataSink, PdfASID signatorId, String connectorId, final String profile, final String signatureKeyIdentifier, TablePos pos) throws PresentableException
+ public static SignatorInformation signCommandline(PdfDataSource pdfDataSource, DataSink dataSink, PdfASID signatorId, String connectorId, final String profile, final String signatureKeyIdentifier, TablePos pos, TimeStamper timeStamper) throws PresentableException
{
at.gv.egiz.pdfas.framework.signator.Signator signator = at.gv.egiz.pdfas.framework.SignatorFactory.createSignator(signatorId);
@@ -1043,9 +1056,9 @@ public abstract class PdfAS Connector c = at.gv.egiz.pdfas.framework.ConnectorFactory.createConnector(connectorId, cp);
// SignatorInformation si = signator.prepareSign(pdfDataSource, profile, pos, ConnectorFactory.needsSIG_ID(connector));
- SignatorInformation si = signator.prepareSign(pdfDataSource, profile, pos);
+ SignatorInformation si = signator.prepareSign(pdfDataSource, profile, pos, timeStamper);
- SignSignatureObject sso = sign(si.getSignatureData(), c);
+ SignSignatureObject sso = sign(si.getSignatureData(), c, timeStamper);
si.setSignSignatureObject(sso);
@@ -1055,7 +1068,7 @@ public abstract class PdfAS }
public static SignatorInformation signCommandline(PdfDataSource pdfDataSource, DataSink dataSink, PdfASID signatorId, String connectorId, final String profile, TablePos pos) throws PresentableException {
- return signCommandline(pdfDataSource, dataSink, signatorId, connectorId, profile, null, pos);
+ return signCommandline(pdfDataSource, dataSink, signatorId, connectorId, profile, null, pos, null);
}
/**
@@ -1138,6 +1151,8 @@ public abstract class PdfAS {
Normalizer normalizer = new Normalizer();
String normalized_text = normalizer.normalize(text);
+ // fix #331 ??
+ //normalized_text = normalized_text.replaceAll("\n", "");
return normalized_text;
}
|