From 8d5c38a34858f66a30d14a5794c746c6e66278bc Mon Sep 17 00:00:00 2001 From: tknall Date: Wed, 2 Dec 2009 18:06:58 +0000 Subject: Rejecting unknown /replaces names upon verification of binary signatures git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@481 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCode.java | 2 ++ .../egiz/pdfas/impl/verificator/binary/BinaryVerificator_1_0_0.java | 4 ++++ 2 files changed, 6 insertions(+) (limited to 'src/main/java/at/gv') diff --git a/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCode.java b/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCode.java index d903c9b..857fc09 100644 --- a/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCode.java +++ b/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCode.java @@ -43,6 +43,8 @@ public final class ErrorCode public static final int MODIFIED_AFTER_SIGNATION = 316; public static final int NON_BINARY_SIGNATURES_PRESENT = 317; + + public static final int UNSUPPORTED_REPLACES_NAME = 318; public static final int SIGNATURE_VERIFICATION_NOT_SUPPORTED = 371; public static final int INVALID_SIGNING_TIME = 372; diff --git a/src/main/java/at/gv/egiz/pdfas/impl/verificator/binary/BinaryVerificator_1_0_0.java b/src/main/java/at/gv/egiz/pdfas/impl/verificator/binary/BinaryVerificator_1_0_0.java index 9ca2246..46dbb40 100644 --- a/src/main/java/at/gv/egiz/pdfas/impl/verificator/binary/BinaryVerificator_1_0_0.java +++ b/src/main/java/at/gv/egiz/pdfas/impl/verificator/binary/BinaryVerificator_1_0_0.java @@ -309,6 +309,10 @@ public class BinaryVerificator_1_0_0 implements Verificator ReplaceInfo ri = (ReplaceInfo) rit.next(); String type = SignatureTypes.convertBrevToType(ri.brev); + + if (type == null) { + throw new PresentableException(ErrorCode.UNSUPPORTED_REPLACES_NAME, "Unsupported /replaces name."); + } // signature_object.setSigValue(ri.type, ri.value); if (type.equals(SignatureTypes.SIG_DATE)) -- cgit v1.2.3