aboutsummaryrefslogtreecommitdiff
path: root/src/main/model/pki/cert/TbsCertificate.java
diff options
context:
space:
mode:
authorYuuta Liang <yuutaw@students.cs.ubc.ca>2023-10-14 06:17:57 +0800
committerYuuta Liang <yuutaw@students.cs.ubc.ca>2023-10-14 06:17:57 +0800
commitdf3eb7af36b6797e0c8e09a179191c329889da57 (patch)
treeb2119f13e57b2b391637f3e862b16bce3cd766a2 /src/main/model/pki/cert/TbsCertificate.java
parent6f82e5f3238bcc611354b20ed624d65759263032 (diff)
downloadjca-df3eb7af36b6797e0c8e09a179191c329889da57.tar
jca-df3eb7af36b6797e0c8e09a179191c329889da57.tar.gz
jca-df3eb7af36b6797e0c8e09a179191c329889da57.tar.bz2
jca-df3eb7af36b6797e0c8e09a179191c329889da57.zip
Fix coverage
Signed-off-by: Yuuta Liang <yuutaw@students.cs.ubc.ca>
Diffstat (limited to 'src/main/model/pki/cert/TbsCertificate.java')
-rw-r--r--src/main/model/pki/cert/TbsCertificate.java6
1 files changed, 2 insertions, 4 deletions
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)) {