From d342a45d98c4795b3a3fe1aaef5236ad4a782b55 Mon Sep 17 00:00:00 2001 From: Yuuta Liang Date: Thu, 12 Oct 2023 12:10:33 +0800 Subject: Implement data structures from X.680, X.501, X.509, and PKCS#10, with X.690 encoding / decoding support The implementation took four days, and it is still a little bit rough. Updated version should arrive soon. Signed-off-by: Yuuta Liang --- .../model/pki/crl/CertificateListContentTest.java | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/test/model/pki/crl/CertificateListContentTest.java (limited to 'src/test/model/pki/crl/CertificateListContentTest.java') diff --git a/src/test/model/pki/crl/CertificateListContentTest.java b/src/test/model/pki/crl/CertificateListContentTest.java new file mode 100644 index 0000000..ec18629 --- /dev/null +++ b/src/test/model/pki/crl/CertificateListContentTest.java @@ -0,0 +1,37 @@ +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 org.junit.jupiter.api.Test; + +import java.time.ZoneId; +import java.time.ZonedDateTime; + +import static model.TestConstants.*; +import static org.junit.jupiter.api.Assertions.*; + +public class CertificateListContentTest { + @Test + void testConstructor() { + assertEquals(1, CRL_CONTENT_1.getVersion().getLong()); + assertEquals("CN=Test CA", CRL_CONTENT_1.getIssuer().toString()); + assertArrayEquals(ObjectIdentifier.OID_SHA256_WITH_RSA_ENCRYPTION, + CRL_CONTENT_1.getSignature().getType().getInts()); + assertEquals(GeneralizedTime.TAG.getNumber(), + CRL_CONTENT_1.getThisUpdate().getTag().getNumber()); + assertNull(CRL_CONTENT_1.getNextUpdate()); + assertEquals(2, CRL_CONTENT_1.getRevokedCertificates().length); + } + + @Test + void testEncode() { + assertArrayEquals(CRL_CONTENT_1_DER, CRL_CONTENT_1.encodeDER()); + assertArrayEquals(CRL_CONTENT_2_DER, CRL_CONTENT_2.encodeDER()); + } +} -- cgit v1.2.3