From df3eb7af36b6797e0c8e09a179191c329889da57 Mon Sep 17 00:00:00 2001 From: Yuuta Liang Date: Sat, 14 Oct 2023 06:17:57 +0800 Subject: Fix coverage Signed-off-by: Yuuta Liang --- src/main/model/pki/cert/TbsCertificate.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/main/model/pki/cert') diff --git a/src/main/model/pki/cert/TbsCertificate.java b/src/main/model/pki/cert/TbsCertificate.java index 84cf0ba..26b30f4 100644 --- a/src/main/model/pki/cert/TbsCertificate.java +++ b/src/main/model/pki/cert/TbsCertificate.java @@ -171,7 +171,7 @@ public class TbsCertificate extends ASN1Object { } else { // Enforce the extensions tag - nothing else should be here. if (Integer.compareUnsigned(getLength(), (encoded.getIndex() - i)) != 0) { - new Tag(encoded).enforce(new Tag(TagClass.CONTEXT_SPECIFIC, true, 3)); + throw new ParseException("Unexpected objects after."); } this.extensions = null; } @@ -204,9 +204,7 @@ public class TbsCertificate extends ASN1Object { */ private void enforceVersion() throws ParseException { if (version != null - && (version.getLong() != VERSION_V1 - && version.getLong() != VERSION_V2 - && version.getLong() != VERSION_V3)) { + && (version.getLong() < VERSION_V1 || version.getLong() > VERSION_V3)) { throw new ParseException("Illegal certificate version: " + version.getLong()); } if (extensions != null && (version == null || version.getLong() != VERSION_V3)) { -- cgit v1.2.3