aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java40
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);
+ }
+
+
}