diff options
Diffstat (limited to 'src/main/java/demo')
-rw-r--r-- | src/main/java/demo/SignatureCreationDemo.java | 15 | ||||
-rw-r--r-- | src/main/java/demo/SignatureVerificationDemo.java | 15 |
2 files changed, 25 insertions, 5 deletions
diff --git a/src/main/java/demo/SignatureCreationDemo.java b/src/main/java/demo/SignatureCreationDemo.java index c43b45e..465a0bf 100644 --- a/src/main/java/demo/SignatureCreationDemo.java +++ b/src/main/java/demo/SignatureCreationDemo.java @@ -12,6 +12,7 @@ import at.gv.egiz.pdfas.api.exceptions.PdfAsException; import at.gv.egiz.pdfas.api.io.DataSource;
import at.gv.egiz.pdfas.api.sign.SignParameters;
import at.gv.egiz.pdfas.api.sign.SignResult;
+import at.gv.egiz.pdfas.api.timestamp.DummyTimeStamper;
import at.gv.egiz.pdfas.io.FileBasedDataSink;
import at.gv.egiz.pdfas.io.FileBasedDataSource;
@@ -55,10 +56,20 @@ public class SignatureCreationDemo { SignParameters signParameters = new SignParameters();
signParameters.setDocument(dataSource);
signParameters.setOutput(dataSink);
- signParameters.setSignatureType(Constants.SIGNATURE_TYPE_BINARY);
signParameters.setSignatureDevice(Constants.SIGNATURE_DEVICE_MOA);
- signParameters.setSignatureProfileId("SIGNATURBLOCK_DE");
signParameters.setSignaturePositioning(null);
+ // standard signature
+ signParameters.setSignatureType(Constants.SIGNATURE_TYPE_TEXTUAL);
+ signParameters.setSignatureProfileId("SIGNATURBLOCK_DE");
+
+ // --- enable in case of BAIK SIGNATURE ---
+ /*
+ signParameters.setSignatureType(Constants.SIGNATURE_TYPE_BINARY);
+ // signParameters.setSignatureProfileId("BAIK_URKUNDE_SIGNATUR");
+ signParameters.setSignatureProfileId("BAIK_ARCHIV_SIGNATUR");
+ // use BAIK TimeStamp
+ signParameters.setTimeStamperImpl(new DummyTimeStamper());
+ */
// sign
System.out.println("Signing...");
diff --git a/src/main/java/demo/SignatureVerificationDemo.java b/src/main/java/demo/SignatureVerificationDemo.java index 6df4973..86d1bb8 100644 --- a/src/main/java/demo/SignatureVerificationDemo.java +++ b/src/main/java/demo/SignatureVerificationDemo.java @@ -90,15 +90,24 @@ public class SignatureVerificationDemo { while (it.hasNext()) {
VerifyResult result = (VerifyResult) it.next();
Main.formatVerifyResult(result, out);
+
+ // check if there are timestamps
+ if (result.getTimeStampValue() != null) {
+ out.println("\nTimeStamp value available for this signature");
+ }
+
+ // check if non textual elements have been detected for this signature
if (result.hasNonTextualObjects()) {
- System.out.println("\nWARNING: Non textual objects detected.");
+ out.println("\nWARNING: Non textual objects detected for this signature");
Iterator noit = result.getNonTextualObjects().iterator();
while (noit.hasNext()) {
NonTextObjectInfo info = (NonTextObjectInfo) noit.next();
- System.out.println(" -> " + info.toString());
+ out.println(" -> " + info.toString());
}
- System.out.println();
+ out.println();
+ } else {
+ out.println("\nNo non-textual objects detected for this signature.");
}
}
out.flush();
|