From 15c1a4715be0d358d4449c77bd71aa7eb926fe54 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Thu, 12 Jan 2023 16:55:34 +0100 Subject: feat(sigblock): validate signature-profile information provided by QR-code placeholder Issue: #64 --- .../common/settings/SignatureProfileSettings.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'pdf-as-common/src/main') 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; -- cgit v1.2.3