aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-common
diff options
context:
space:
mode:
authorThomas <>2023-01-12 16:55:34 +0100
committerThomas <>2023-01-12 16:55:34 +0100
commit15c1a4715be0d358d4449c77bd71aa7eb926fe54 (patch)
treef1d54a5ffbe09fd8745902f9bad3f0f98580eca6 /pdf-as-common
parent5ec5b73c5dc4191d77c764d85197bbf2ac2e2bf2 (diff)
downloadpdf-as-4-15c1a4715be0d358d4449c77bd71aa7eb926fe54.tar.gz
pdf-as-4-15c1a4715be0d358d4449c77bd71aa7eb926fe54.tar.bz2
pdf-as-4-15c1a4715be0d358d4449c77bd71aa7eb926fe54.zip
feat(sigblock): validate signature-profile information provided by QR-code placeholder
Issue: #64
Diffstat (limited to 'pdf-as-common')
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/SignatureProfileSettings.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/SignatureProfileSettings.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/SignatureProfileSettings.java
index a151f12e..7f047278 100644
--- a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/SignatureProfileSettings.java
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/SignatureProfileSettings.java
@@ -23,10 +23,15 @@
******************************************************************************/
package at.gv.egiz.pdfas.common.settings;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.*;
+import at.gv.egiz.pdfas.common.exceptions.ErrorConstants;
+import at.gv.egiz.pdfas.common.exceptions.PDFASError;
public class SignatureProfileSettings implements IProfileConstants {
@@ -43,8 +48,15 @@ public class SignatureProfileSettings implements IProfileConstants {
private ISettings configuration;
- public SignatureProfileSettings(String profileID, ISettings configuration) {
- this.profileID = profileID;
+ public SignatureProfileSettings(String profileID, ISettings configuration) throws PDFASError {
+
+ if (!configuration.hasPrefix(SIG_OBJ + profileID)) {
+ throw new PDFASError(ErrorConstants.ERROR_SIG_INVALID_PROFILE,
+ PDFASError.buildInfoString(ErrorConstants.ERROR_SIG_INVALID_PROFILE,
+ profileID));
+ }
+
+ this.profileID = profileID;
String profilePrefix = SIG_OBJ + profileID + KEY_SEPARATOR;
String keysPrefix = profilePrefix + PROFILE_KEY;
String valuesPrefix = profilePrefix + PROFILE_VALUE;