aboutsummaryrefslogtreecommitdiff
path: root/src/test/model/pki
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/model/pki')
-rw-r--r--src/test/model/pki/AlgorithmIdentifierTest.java12
-rw-r--r--src/test/model/pki/SubjectPublicKeyInfoTest.java65
-rw-r--r--src/test/model/pki/cert/CertificateTest.java19
-rw-r--r--src/test/model/pki/cert/ExtensionTest.java42
-rw-r--r--src/test/model/pki/cert/TbsCertificateTest.java10
-rw-r--r--src/test/model/pki/cert/ValidityTest.java18
-rw-r--r--src/test/model/pki/crl/CertificateListContentTest.java13
-rw-r--r--src/test/model/pki/crl/CertificateListTest.java22
-rw-r--r--src/test/model/pki/crl/RevokedCertificateTest.java9
9 files changed, 96 insertions, 114 deletions
diff --git a/src/test/model/pki/AlgorithmIdentifierTest.java b/src/test/model/pki/AlgorithmIdentifierTest.java
index 8bcc80e..cbd2e7c 100644
--- a/src/test/model/pki/AlgorithmIdentifierTest.java
+++ b/src/test/model/pki/AlgorithmIdentifierTest.java
@@ -72,12 +72,12 @@ public class AlgorithmIdentifierTest {
@Test
void testEncode() throws ParseException {
assertArrayEquals(new Byte[]{
- 0x30, 0x0D, // SEQUENCE AlgorithmIdentifier
- 0x06, 0x09, 0x2A, -122, 0x48, -122, -9, 0x0D, // OID (sha256WithRsaEncryption)
- 0x01, 0x01, 0x0B,
- 0x05, 0x00 // Null (Parameter)
- }, new AlgorithmIdentifier(
- ASN1Object.TAG_SEQUENCE, null,
+ 0x30, 0x0D, // SEQUENCE AlgorithmIdentifier
+ 0x06, 0x09, 0x2A, -122, 0x48, -122, -9, 0x0D, // OID (sha256WithRsaEncryption)
+ 0x01, 0x01, 0x0B,
+ 0x05, 0x00 // Null (Parameter)
+ }, new AlgorithmIdentifier(
+ ASN1Object.TAG_SEQUENCE, null,
new ObjectIdentifier(ObjectIdentifier.TAG, null, OID_SHA256_WITH_RSA_ENCRYPTION),
new Null(Null.TAG, null)).encodeDER());
}
diff --git a/src/test/model/pki/SubjectPublicKeyInfoTest.java b/src/test/model/pki/SubjectPublicKeyInfoTest.java
index f1cfff0..7f16330 100644
--- a/src/test/model/pki/SubjectPublicKeyInfoTest.java
+++ b/src/test/model/pki/SubjectPublicKeyInfoTest.java
@@ -7,53 +7,52 @@ import model.asn1.ObjectIdentifier;
import model.asn1.exceptions.ParseException;
import model.asn1.parsing.BytesReader;
import model.csr.CertificationRequestInfo;
-import model.csr.CertificationRequestInfoTest;
import org.junit.jupiter.api.Test;
import static model.TestConstants.mutate;
import static org.junit.jupiter.api.Assertions.*;
public class SubjectPublicKeyInfoTest {
- private static final Byte[] RSA = new Byte[] {
- 0x30, -127, -97, // SEQUENCE SubjectPublicKeyInfo
+ private static final Byte[] RSA = new Byte[]{
+ 0x30, -127, -97, // SEQUENCE SubjectPublicKeyInfo
0x30, 0x0d, // SEQUENCE AlgorithmIdentifier
- 0x06, 0x09, 0x2a, -122, 0x48, -122, -9, 0x0d, // OID (rsaEncryption)
+ 0x06, 0x09, 0x2a, -122, 0x48, -122, -9, 0x0d, // OID (rsaEncryption)
0x01, 0x01, 0x01,
0x05, 0x00, // Null (Parameter)
0x03, -127, -115, 0x00, 0x30, -127, -119, 0x02, // BIT STRING (subjectPublicKey)
- -127, -127, 0x00, -67, -1, 0x4e, 0x6d, -22,
- 0x62, 0x6a, 0x11, -120, 0x77, 0x0a, -92, 0x32,
- -124, -37, 0x22, 0x2f, 0x3d, 0x5d, 0x2a, 0x63,
- -71, -109, 0x11, -50, -92, 0x4f, -119, 0x3b,
- 0x14, 0x3b, -54, 0x3c, -106, -42, 0x11, 0x42,
- 0x78, -110, 0x68, -100, -25, -25, -50, 0x75,
- -101, 0x21, 0x41, -34, -31, -85, -13, 0x1e,
- 0x51, -81, 0x25, 0x4f, -1, 0x56, 0x77, 0x5e,
- -30, 0x27, -104, 0x34, 0x67, -28, -56, 0x55,
- 0x6a, 0x3c, 0x6f, -38, -85, -63, 0x5f, 0x16,
- 0x7a, -93, -19, -35, 0x7f, 0x35, 0x0f, -47,
- -7, -22, -12, -24, -48, 0x25, 0x6d, -114,
- 0x66, 0x1a, 0x53, -77, 0x67, 0x32, -69, -39,
- 0x57, -42, -65, -13, 0x5f, 0x6f, 0x53, 0x6d,
- 0x62, -95, 0x42, 0x12, 0x7b, 0x13, 0x4f, 0x1a,
- -26, 0x00, -72, -32, 0x2b, -83, 0x3c, 0x35,
+ -127, -127, 0x00, -67, -1, 0x4e, 0x6d, -22,
+ 0x62, 0x6a, 0x11, -120, 0x77, 0x0a, -92, 0x32,
+ -124, -37, 0x22, 0x2f, 0x3d, 0x5d, 0x2a, 0x63,
+ -71, -109, 0x11, -50, -92, 0x4f, -119, 0x3b,
+ 0x14, 0x3b, -54, 0x3c, -106, -42, 0x11, 0x42,
+ 0x78, -110, 0x68, -100, -25, -25, -50, 0x75,
+ -101, 0x21, 0x41, -34, -31, -85, -13, 0x1e,
+ 0x51, -81, 0x25, 0x4f, -1, 0x56, 0x77, 0x5e,
+ -30, 0x27, -104, 0x34, 0x67, -28, -56, 0x55,
+ 0x6a, 0x3c, 0x6f, -38, -85, -63, 0x5f, 0x16,
+ 0x7a, -93, -19, -35, 0x7f, 0x35, 0x0f, -47,
+ -7, -22, -12, -24, -48, 0x25, 0x6d, -114,
+ 0x66, 0x1a, 0x53, -77, 0x67, 0x32, -69, -39,
+ 0x57, -42, -65, -13, 0x5f, 0x6f, 0x53, 0x6d,
+ 0x62, -95, 0x42, 0x12, 0x7b, 0x13, 0x4f, 0x1a,
+ -26, 0x00, -72, -32, 0x2b, -83, 0x3c, 0x35,
-103, 0x18, 0x51, 0x02, 0x03, 0x01, 0x00, 0x01,
};
- private static final Byte[] ECC = new Byte[] {
+ private static final Byte[] ECC = new Byte[]{
0x30, 0x59, // SEQUENCE SubjectPublicKeyInfo
0x30, 0x13, // SEQUENCE AlgorithmIdentifier
- 0x06, 0x07, 0x2A, -122, 0x48, -50, 0x3D, 0x02, 0x01, // OID (ecPublicKey)
- 0x06, 0x08, 0x2A, -122, 0x48, -50, 0x3D, 0x03, 0x01, // OID Parameter (prime256v1)
+ 0x06, 0x07, 0x2A, -122, 0x48, -50, 0x3D, 0x02, 0x01, // OID (ecPublicKey)
+ 0x06, 0x08, 0x2A, -122, 0x48, -50, 0x3D, 0x03, 0x01, // OID Parameter (prime256v1)
0x07,
0x03, 0x42, // BIT STRING
- 0x00, 0x04, 0x1D, -24, 0x71, -68, -35, 0x48, 0x70,
- 0x26, 0x71, 0x6C, -35, 0x04, 0x5B, 0x3F, 0x5D, -34,
+ 0x00, 0x04, 0x1D, -24, 0x71, -68, -35, 0x48, 0x70,
+ 0x26, 0x71, 0x6C, -35, 0x04, 0x5B, 0x3F, 0x5D, -34,
0x14, 0x31, -117, 0x3F, 0x31, -128, 0x18, 0x2A, 0x33,
- -27, 0x19, -122, 0x13, -42, -25, 0x48, 0x2F, -107,
- 0x15, 0x3A, 0x59, -115, -19, 0x09, -28, 0x53, 0x1A,
- -13, 0x61, -78, 0x35, 0x61, 0x6E, 0x66, 0x5F, 0x5F,
- -49, 0x0A, -30, 0x65, 0x65, 0x3D, 0x22, 0x2B, 0x30,
+ -27, 0x19, -122, 0x13, -42, -25, 0x48, 0x2F, -107,
+ 0x15, 0x3A, 0x59, -115, -19, 0x09, -28, 0x53, 0x1A,
+ -13, 0x61, -78, 0x35, 0x61, 0x6E, 0x66, 0x5F, 0x5F,
+ -49, 0x0A, -30, 0x65, 0x65, 0x3D, 0x22, 0x2B, 0x30,
0x71, 0x2C, 0x24
};
@@ -66,16 +65,16 @@ public class SubjectPublicKeyInfoTest {
ObjectIdentifier.OID_SHA256_WITH_RSA_ENCRYPTION),
new Null(Null.TAG, null)),
new BitString(BitString.TAG, null,
- 0, new Byte[]{ 1, 2, 3}))
+ 0, new Byte[]{1, 2, 3}))
.getAlgorithm().getType().getInts());
- assertArrayEquals(new Byte[]{ 1, 2, 3 },
+ assertArrayEquals(new Byte[]{1, 2, 3},
new SubjectPublicKeyInfo(ASN1Object.TAG_SEQUENCE, null,
new AlgorithmIdentifier(ASN1Object.TAG_SEQUENCE, null,
new ObjectIdentifier(ObjectIdentifier.TAG, null,
ObjectIdentifier.OID_SHA256_WITH_RSA_ENCRYPTION),
new Null(Null.TAG, null)),
new BitString(BitString.TAG, null,
- 0, new Byte[]{ 1, 2, 3}))
+ 0, new Byte[]{1, 2, 3}))
.getSubjectPublicKey().getConvertedVal());
}
@@ -109,7 +108,7 @@ public class SubjectPublicKeyInfoTest {
// Incorrect public key tag
assertThrows(ParseException.class, () -> {
new CertificationRequestInfo(new BytesReader(mutate(RSA, 18, BitString.TAG.getNumber(), 0x31)),
- false);
+ false);
});
}
}
diff --git a/src/test/model/pki/cert/CertificateTest.java b/src/test/model/pki/cert/CertificateTest.java
index 70564fc..5fb2e82 100644
--- a/src/test/model/pki/cert/CertificateTest.java
+++ b/src/test/model/pki/cert/CertificateTest.java
@@ -1,20 +1,15 @@
package model.pki.cert;
import model.TestConstants;
-import model.asn1.*;
+import model.asn1.ASN1Object;
+import model.asn1.BitString;
+import model.asn1.Null;
+import model.asn1.ObjectIdentifier;
import model.asn1.exceptions.ParseException;
import model.asn1.parsing.BytesReader;
-import model.csr.CertificationRequest;
-import model.csr.CertificationRequestInfo;
-import model.csr.CertificationRequestInfoTest;
import model.pki.AlgorithmIdentifier;
-import model.pki.SubjectPublicKeyInfo;
import org.junit.jupiter.api.Test;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.stream.Stream;
-
import static model.TestConstants.mutate;
import static org.junit.jupiter.api.Assertions.*;
@@ -26,13 +21,13 @@ public class CertificateTest {
new AlgorithmIdentifier(ASN1Object.TAG_SEQUENCE, null,
new ObjectIdentifier(ObjectIdentifier.TAG, null, ObjectIdentifier.OID_RSA_ENCRYPTION),
new Null(Null.TAG, null)),
- new BitString(BitString.TAG, null, 0, new Byte[]{ 1, 2, 3 }));
+ new BitString(BitString.TAG, null, 0, new Byte[]{1, 2, 3}));
assertEquals(TbsCertificate.VERSION_V3,
certificate.getCertificate().getVersion().getLong());
assertArrayEquals(ObjectIdentifier.OID_RSA_ENCRYPTION,
certificate.getSignatureAlgorithm().getType().getInts());
- assertArrayEquals(new Byte[]{ 1, 2, 3 },
+ assertArrayEquals(new Byte[]{1, 2, 3},
certificate.getSignature().getConvertedVal());
}
@@ -57,7 +52,7 @@ public class CertificateTest {
void testParseFail() {
// Incorrect certificate tag
assertThrows(ParseException.class, () ->
- new Certificate(new BytesReader(mutate(TestConstants.CERT_L1_ECC, 4, 0x30, 0x31)), false)
+ new Certificate(new BytesReader(mutate(TestConstants.CERT_L1_ECC, 4, 0x30, 0x31)), false)
);
// Incorrect signatureAlgorithm tag
assertThrows(ParseException.class, () ->
diff --git a/src/test/model/pki/cert/ExtensionTest.java b/src/test/model/pki/cert/ExtensionTest.java
index 06561ba..e00cbc5 100644
--- a/src/test/model/pki/cert/ExtensionTest.java
+++ b/src/test/model/pki/cert/ExtensionTest.java
@@ -11,19 +11,19 @@ import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
public class ExtensionTest {
- static final Byte[] EXT_SUBJECT_KEY_ID = new Byte[] {
+ static final Byte[] EXT_SUBJECT_KEY_ID = new Byte[]{
0x30, 0x1D, // SEQUENCE Extension
0x06, 0x03, 0x55, 0x1D, 0x0E, // OID subjectKeyIdentifier
0x04, 0x16, // OCTET STRING
- 0x04, 0x14, -79, -62, -89, -127, 0x63, 0x66,
- 0x4B, 0x72, 0x0A, -35, -3, 0x7D, 0x20, 0x29,
- -67, 0x6B, 0x49, 0x09, 0x61, -64
+ 0x04, 0x14, -79, -62, -89, -127, 0x63, 0x66,
+ 0x4B, 0x72, 0x0A, -35, -3, 0x7D, 0x20, 0x29,
+ -67, 0x6B, 0x49, 0x09, 0x61, -64
};
- static final Byte[] EXT_KEY_USAGE = new Byte[] {
+ static final Byte[] EXT_KEY_USAGE = new Byte[]{
0x30, 0x0E, // SEQUENCE Extension
0x06, 0x03, 0x55, 0x1D, 0x0F, // OID keyUsage
- 0x01, 0x01, -1, // BOOLEAN critical
+ 0x01, 0x01, -1, // BOOLEAN critical
0x04, 0x04, // OCTET STRING
0x03, 0x02, 0x01, -122
};
@@ -33,10 +33,10 @@ public class ExtensionTest {
final Extension ext = new Extension(ASN1Object.TAG_SEQUENCE, null,
new ObjectIdentifier(ObjectIdentifier.TAG, null, ObjectIdentifier.OID_BASIC_CONSTRAINTS),
new Bool(Bool.TAG, null, true),
- new OctetString(OctetString.TAG, null, new Byte[]{ 0x30, 0x03, 0x01, 0x01, -1 }));
+ new OctetString(OctetString.TAG, null, new Byte[]{0x30, 0x03, 0x01, 0x01, -1}));
assertArrayEquals(ObjectIdentifier.OID_BASIC_CONSTRAINTS, ext.getExtnId().getInts());
assertTrue(ext.getCritical().getValue());
- assertArrayEquals(new Byte[]{ 0x30, 0x03, 0x01, 0x01, -1 }, ext.getExtnValue().getBytes());
+ assertArrayEquals(new Byte[]{0x30, 0x03, 0x01, 0x01, -1}, ext.getExtnValue().getBytes());
}
@Test
@@ -44,16 +44,16 @@ public class ExtensionTest {
Extension parsed = new Extension(new BytesReader(EXT_SUBJECT_KEY_ID), false);
assertArrayEquals(ObjectIdentifier.OID_SUBJECT_KEY_IDENTIFIER, parsed.getExtnId().getInts());
assertNull(parsed.getCritical());
- assertArrayEquals(new Byte[] {
- 0x04, 0x14, -79, -62, -89, -127, 0x63, 0x66,
- 0x4B, 0x72, 0x0A, -35, -3, 0x7D, 0x20, 0x29,
- -67, 0x6B, 0x49, 0x09, 0x61, -64
+ assertArrayEquals(new Byte[]{
+ 0x04, 0x14, -79, -62, -89, -127, 0x63, 0x66,
+ 0x4B, 0x72, 0x0A, -35, -3, 0x7D, 0x20, 0x29,
+ -67, 0x6B, 0x49, 0x09, 0x61, -64
}, parsed.getExtnValue().getBytes());
parsed = new Extension(new BytesReader(EXT_KEY_USAGE), false);
assertArrayEquals(ObjectIdentifier.OID_KEY_USAGE, parsed.getExtnId().getInts());
assertTrue(parsed.getCritical().getValue());
- assertArrayEquals(new Byte[] {
+ assertArrayEquals(new Byte[]{
0x03, 0x02, 0x01, -122
}, parsed.getExtnValue().getBytes());
}
@@ -68,7 +68,7 @@ public class ExtensionTest {
assertThrows(ParseException.class, () -> new Extension(new BytesReader(new Byte[]{
0x30, 0x0E, // SEQUENCE Extension
0x07, 0x03, 0x55, 0x1D, 0x0F, // OID keyUsage
- 0x01, 0x01, -1, // BOOLEAN critical
+ 0x01, 0x01, -1, // BOOLEAN critical
0x04, 0x04, // OCTET STRING
0x03, 0x02, 0x01, -122
}), false));
@@ -76,7 +76,7 @@ public class ExtensionTest {
assertThrows(ParseException.class, () -> new Extension(new BytesReader(new Byte[]{
0x30, 0x0E, // SEQUENCE Extension
0x06, 0x03, 0x55, 0x1D, 0x0F, // OID keyUsage
- 0x05, 0x01, -1, // BOOLEAN critical
+ 0x05, 0x01, -1, // BOOLEAN critical
0x04, 0x04, // OCTET STRING
0x03, 0x02, 0x01, -122
}), false));
@@ -84,7 +84,7 @@ public class ExtensionTest {
assertThrows(ParseException.class, () -> new Extension(new BytesReader(new Byte[]{
0x30, 0x0E, // SEQUENCE Extension
0x06, 0x03, 0x55, 0x1D, 0x0F, // OID keyUsage
- 0x01, 0x01, -1, // BOOLEAN critical
+ 0x01, 0x01, -1, // BOOLEAN critical
0x09, 0x04, // OCTET STRING
0x03, 0x02, 0x01, -122
}), false));
@@ -103,15 +103,15 @@ public class ExtensionTest {
assertArrayEquals(EXT_SUBJECT_KEY_ID, new Extension(ASN1Object.TAG_SEQUENCE, null,
new ObjectIdentifier(ObjectIdentifier.TAG, null, ObjectIdentifier.OID_SUBJECT_KEY_IDENTIFIER),
null,
- new OctetString(OctetString.TAG, null, new Byte[] {
- 0x04, 0x14, -79, -62, -89, -127, 0x63, 0x66,
- 0x4B, 0x72, 0x0A, -35, -3, 0x7D, 0x20, 0x29,
- -67, 0x6B, 0x49, 0x09, 0x61, -64
+ new OctetString(OctetString.TAG, null, new Byte[]{
+ 0x04, 0x14, -79, -62, -89, -127, 0x63, 0x66,
+ 0x4B, 0x72, 0x0A, -35, -3, 0x7D, 0x20, 0x29,
+ -67, 0x6B, 0x49, 0x09, 0x61, -64
})).encodeDER());
assertArrayEquals(EXT_KEY_USAGE, new Extension(ASN1Object.TAG_SEQUENCE, null,
new ObjectIdentifier(ObjectIdentifier.TAG, null, ObjectIdentifier.OID_KEY_USAGE),
new Bool(Bool.TAG, null, true),
- new OctetString(OctetString.TAG, null, new Byte[] {
+ new OctetString(OctetString.TAG, null, new Byte[]{
0x03, 0x02, 0x01, -122
})).encodeDER());
}
diff --git a/src/test/model/pki/cert/TbsCertificateTest.java b/src/test/model/pki/cert/TbsCertificateTest.java
index be26eb9..972f59a 100644
--- a/src/test/model/pki/cert/TbsCertificateTest.java
+++ b/src/test/model/pki/cert/TbsCertificateTest.java
@@ -1,9 +1,11 @@
package model.pki.cert;
-import model.asn1.*;
+import model.TestConstants;
+import model.asn1.ASN1Object;
+import model.asn1.Null;
+import model.asn1.ObjectIdentifier;
import model.asn1.exceptions.ParseException;
import model.asn1.parsing.BytesReader;
-import model.TestConstants;
import org.junit.jupiter.api.Test;
import java.math.BigInteger;
@@ -52,13 +54,13 @@ public class TbsCertificateTest {
false);
assertEquals(TbsCertificate.VERSION_V3, parsed.getVersion().getLong());
assertEquals(0, parsed.getSerialNumber().getValue()
- .compareTo(new BigInteger("644983544608556543477205958886697401602227090424")));
+ .compareTo(new BigInteger("644983544608556543477205958886697401602227090424")));
assertArrayEquals(ObjectIdentifier.OID_ECDSA_WITH_SHA256,
parsed.getSignature().getType().getInts());
assertNull(parsed.getSignature().getParameters());
assertEquals("CN=Yuuta Root CA,C=CA", parsed.getIssuer().toString());
assertEquals(ZonedDateTime.of(2023, 6, 23,
- 2, 50, 46, 0, ZoneId.of("UTC")),
+ 2, 50, 46, 0, ZoneId.of("UTC")),
parsed.getValidity().getNotBefore().getTimestamp());
assertEquals(ZonedDateTime.of(2048, 6, 23,
2, 50, 46, 0, ZoneId.of("UTC")),
diff --git a/src/test/model/pki/cert/ValidityTest.java b/src/test/model/pki/cert/ValidityTest.java
index eba5092..2471ced 100644
--- a/src/test/model/pki/cert/ValidityTest.java
+++ b/src/test/model/pki/cert/ValidityTest.java
@@ -1,7 +1,9 @@
package model.pki.cert;
-import jdk.jshell.EvalException;
-import model.asn1.*;
+import model.asn1.ASN1Object;
+import model.asn1.ASN1Time;
+import model.asn1.GeneralizedTime;
+import model.asn1.UtcTime;
import model.asn1.exceptions.ParseException;
import model.asn1.parsing.BytesReader;
import org.junit.jupiter.api.BeforeEach;
@@ -81,7 +83,7 @@ public class ValidityTest {
// Too short
assertThrows(ParseException.class, () ->
- new Validity(new BytesReader(new Byte[] {
+ new Validity(new BytesReader(new Byte[]{
0x30, 0x0
}), false));
assertThrows(ParseException.class, () -> {
@@ -107,11 +109,11 @@ public class ValidityTest {
final Byte[] utcBytes = utc.encodeDER();
final Byte[] genBytes = gen.encodeDER();
- assertArrayEquals(Stream.of(Arrays.asList(new Byte[]{ 0x30, (byte) (utcBytes.length + genBytes.length) }),
- Arrays.asList(utcBytes),
- Arrays.asList(genBytes))
- .flatMap(Collection::stream)
- .toArray(Byte[]::new),
+ assertArrayEquals(Stream.of(Arrays.asList(new Byte[]{0x30, (byte) (utcBytes.length + genBytes.length)}),
+ Arrays.asList(utcBytes),
+ Arrays.asList(genBytes))
+ .flatMap(Collection::stream)
+ .toArray(Byte[]::new),
new Validity(ASN1Object.TAG_SEQUENCE, null, utc, gen)
.encodeDER());
}
diff --git a/src/test/model/pki/crl/CertificateListContentTest.java b/src/test/model/pki/crl/CertificateListContentTest.java
index ec18629..948df35 100644
--- a/src/test/model/pki/crl/CertificateListContentTest.java
+++ b/src/test/model/pki/crl/CertificateListContentTest.java
@@ -1,18 +1,9 @@
package model.pki.crl;
-import model.TestConstants;
-import model.asn1.*;
-import model.asn1.exceptions.ParseException;
-import model.pki.AlgorithmIdentifier;
-import model.x501.AttributeTypeAndValue;
-import model.x501.Name;
-import model.x501.RelativeDistinguishedName;
-import org.junit.jupiter.api.BeforeEach;
+import model.asn1.GeneralizedTime;
+import model.asn1.ObjectIdentifier;
import org.junit.jupiter.api.Test;
-import java.time.ZoneId;
-import java.time.ZonedDateTime;
-
import static model.TestConstants.*;
import static org.junit.jupiter.api.Assertions.*;
diff --git a/src/test/model/pki/crl/CertificateListTest.java b/src/test/model/pki/crl/CertificateListTest.java
index 0f4f06c..c117c16 100644
--- a/src/test/model/pki/crl/CertificateListTest.java
+++ b/src/test/model/pki/crl/CertificateListTest.java
@@ -5,17 +5,13 @@ import model.asn1.ASN1Object;
import model.asn1.BitString;
import model.asn1.Null;
import model.asn1.ObjectIdentifier;
-import model.asn1.exceptions.ParseException;
-import model.asn1.parsing.BytesReader;
import model.pki.AlgorithmIdentifier;
-import model.pki.cert.Certificate;
-import model.pki.cert.TbsCertificate;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static model.TestConstants.combine;
-import static model.TestConstants.mutate;
-import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class CertificateListTest {
private CertificateList crl;
@@ -27,7 +23,7 @@ public class CertificateListTest {
new AlgorithmIdentifier(ASN1Object.TAG_SEQUENCE, null,
new ObjectIdentifier(ObjectIdentifier.TAG, null, ObjectIdentifier.OID_RSA_ENCRYPTION),
new Null(Null.TAG, null)),
- new BitString(BitString.TAG, null, 0, new Byte[]{ 1, 2, 3 }));
+ new BitString(BitString.TAG, null, 0, new Byte[]{1, 2, 3}));
}
@Test
@@ -35,18 +31,18 @@ public class CertificateListTest {
assertEquals(2, crl.getCrl().getRevokedCertificates().length);
assertArrayEquals(ObjectIdentifier.OID_RSA_ENCRYPTION,
crl.getSignatureAlgorithm().getType().getInts());
- assertArrayEquals(new Byte[]{ 1, 2, 3 },
+ assertArrayEquals(new Byte[]{1, 2, 3},
crl.getSignature().getConvertedVal());
}
@Test
void testEncode() {
assertArrayEquals(combine((byte) 0x30,
- TestConstants.CRL_CONTENT_1_DER,
- new AlgorithmIdentifier(ASN1Object.TAG_SEQUENCE, null,
- new ObjectIdentifier(ObjectIdentifier.TAG, null, ObjectIdentifier.OID_RSA_ENCRYPTION),
- new Null(Null.TAG, null)).encodeDER(),
- new BitString(BitString.TAG, null, 0, new Byte[]{ 1, 2, 3 }).encodeDER()),
+ TestConstants.CRL_CONTENT_1_DER,
+ new AlgorithmIdentifier(ASN1Object.TAG_SEQUENCE, null,
+ new ObjectIdentifier(ObjectIdentifier.TAG, null, ObjectIdentifier.OID_RSA_ENCRYPTION),
+ new Null(Null.TAG, null)).encodeDER(),
+ new BitString(BitString.TAG, null, 0, new Byte[]{1, 2, 3}).encodeDER()),
crl.encodeDER());
}
}
diff --git a/src/test/model/pki/crl/RevokedCertificateTest.java b/src/test/model/pki/crl/RevokedCertificateTest.java
index 659e421..744e578 100644
--- a/src/test/model/pki/crl/RevokedCertificateTest.java
+++ b/src/test/model/pki/crl/RevokedCertificateTest.java
@@ -1,14 +1,11 @@
package model.pki.crl;
-import model.asn1.*;
-import org.junit.jupiter.api.BeforeEach;
+import model.asn1.UtcTime;
import org.junit.jupiter.api.Test;
-import java.time.ZoneId;
-import java.time.ZonedDateTime;
-
import static model.TestConstants.*;
-import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class RevokedCertificateTest {
@Test