diff options
author | pdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2010-11-29 14:22:33 +0000 |
---|---|---|
committer | pdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2010-11-29 14:22:33 +0000 |
commit | f490f5d9141cb66a32985d2c1e0de2db88b04c6a (patch) | |
tree | b8da8dbaf0b1b366bc5158a720c8c1f5d347478f /src/main/java/at/gv | |
parent | 2af260905c442ab917765cb26104af824d2e533e (diff) | |
download | pdf-as-3-f490f5d9141cb66a32985d2c1e0de2db88b04c6a.tar.gz pdf-as-3-f490f5d9141cb66a32985d2c1e0de2db88b04c6a.tar.bz2 pdf-as-3-f490f5d9141cb66a32985d2c1e0de2db88b04c6a.zip |
added DynamicSignatureProfile support
added override properties
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@626 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/gv')
-rw-r--r-- | src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java b/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java index c5322e7..8816b1c 100644 --- a/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java +++ b/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java @@ -11,6 +11,7 @@ import java.util.List; import java.util.Properties;
import java.util.Vector;
+import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -19,6 +20,9 @@ import at.gv.egiz.pdfas.api.PdfAs; import at.gv.egiz.pdfas.api.analyze.AnalyzeParameters;
import at.gv.egiz.pdfas.api.analyze.AnalyzeResult;
import at.gv.egiz.pdfas.api.commons.Constants;
+import at.gv.egiz.pdfas.api.commons.DynamicSignatureLifetimeEnum;
+import at.gv.egiz.pdfas.api.commons.DynamicSignatureProfile;
+import at.gv.egiz.pdfas.api.commons.DynamicSignatureProfileImpl;
import at.gv.egiz.pdfas.api.commons.SignatureInformation;
import at.gv.egiz.pdfas.api.exceptions.PdfAsException;
import at.gv.egiz.pdfas.api.sign.SignParameters;
@@ -35,6 +39,7 @@ import at.gv.egiz.pdfas.api.xmldsig.ReconstructXMLDsigResult; import at.gv.egiz.pdfas.api.xmldsig.XMLDsigData;
import at.gv.egiz.pdfas.commandline.CommandlineConnectorChooser;
import at.gv.egiz.pdfas.exceptions.ErrorCode;
+import at.gv.egiz.pdfas.framework.DataSourceHolder;
import at.gv.egiz.pdfas.framework.config.SettingsHelper;
import at.gv.egiz.pdfas.framework.input.ExtractionStage;
import at.gv.egiz.pdfas.framework.input.PdfDataSource;
@@ -314,7 +319,8 @@ public class PdfAsObject implements PdfAs signParameters.getSignatureProfileId(),
signParameters.getSignatureKeyIdentifier(),
pos,
- signParameters.getTimeStamperImpl()
+ signParameters.getTimeStamperImpl(),
+ signParameters.getProfileOverrideProperties()
);
return new SignResultImpl(signParameters.getOutput(), si.getSignSignatureObject().getX509Certificate(),
new ActualSignaturePositionAdapter(si.getActualTablePos()), si.getNonTextualObjects());
@@ -334,6 +340,7 @@ public class PdfAsObject implements PdfAs AnalyzeParameters ap = new AnalyzeParameters();
fillAnalyzeParametersWithVerifyParameters(ap, verifyParameters);
AnalyzeResult analyzeResult = analyze(ap);
+ System.err.println(ToStringBuilder.reflectionToString(analyzeResult));
if (verifyParameters.getSignatureToVerify() != Constants.VERIFY_ALL)
{
@@ -451,7 +458,9 @@ public class PdfAsObject implements PdfAs try {
ExtractionStage es = new ExtractionStage();
- List signature_holders = es.extractSignatureHolders(inputDataSource, parameters);
+ DataSourceHolder dsh = new DataSourceHolder(inputDataSource);
+ List signature_holders = es.extractSignatureHolders(dsh, parameters);
+
// List sigInfs = new ArrayList(signature_holders.size());
List sigInfs = new ArrayList();
@@ -468,12 +477,12 @@ public class PdfAsObject implements PdfAs SignatureInformation si = new SignatureInformationAdapter(sh);
sigInfs.add(si);
if (analyzeParameters.isReturnNonTextualObjects()) {
- si.setNonTextualObjects(doExtractNonTexualObjects(sh, (PdfDataSource) inputDataSource));
+ si.setNonTextualObjects(doExtractNonTexualObjects(sh, (PdfDataSource) dsh.getDataSource()));
}
}
}
- return new AnalyzeResultImpl(sigInfs, noSigs);
+ return new AnalyzeResultImpl(sigInfs, noSigs, parameters.hasBeenCorrected());
} catch (java.lang.OutOfMemoryError e) {
throw new OutOfMemoryException(ErrorCode.OUT_OF_MEMORY_ERROR, "Insufficient memory allocated to virtual machine. Start Java with parameters \"-Xms128m -Xmx786m -XX:MaxPermSize=256m\".", e);
}
@@ -604,4 +613,27 @@ public class PdfAsObject implements PdfAs }
}
+ public DynamicSignatureProfile createDynamicSignatureProfile(String parentProfile, DynamicSignatureLifetimeEnum mode) {
+ return DynamicSignatureProfileImpl.createFromParent(null, parentProfile, mode);
+ }
+
+ public DynamicSignatureProfile createEmptyDynamicSignatureProfile(DynamicSignatureLifetimeEnum mode) {
+ return DynamicSignatureProfileImpl.createEmptyProfile(null, mode);
+ }
+
+ public DynamicSignatureProfile loadDynamicSignatureProfile(String name) {
+ return DynamicSignatureProfileImpl.loadProfile(name);
+ }
+
+ public DynamicSignatureProfile createDynamicSignatureProfile(String myUniqueName,
+ String parentProfile, DynamicSignatureLifetimeEnum mode) {
+ return DynamicSignatureProfileImpl.createFromParent(myUniqueName, parentProfile, mode);
+ }
+
+ public DynamicSignatureProfile createEmptyDynamicSignatureProfile(String myUniqueName,
+ DynamicSignatureLifetimeEnum mode) {
+ return DynamicSignatureProfileImpl.createEmptyProfile(myUniqueName, mode);
+ }
+
+
}
|