From 28fa18278c1f3a87722d5e8b78f581526a30bb38 Mon Sep 17 00:00:00 2001 From: Yuuta Liang Date: Sat, 14 Oct 2023 05:35:17 +0800 Subject: Fix lint Signed-off-by: Yuuta Liang --- src/test/model/TestConstants.java | 187 +++++++++++++++++++------------------- 1 file changed, 93 insertions(+), 94 deletions(-) (limited to 'src/test/model/TestConstants.java') diff --git a/src/test/model/TestConstants.java b/src/test/model/TestConstants.java index f0ba35a..04a3aa7 100644 --- a/src/test/model/TestConstants.java +++ b/src/test/model/TestConstants.java @@ -33,7 +33,6 @@ import static model.asn1.ASN1Object.TAG_SEQUENCE; import static model.asn1.ASN1Object.TAG_SET; import static model.asn1.ObjectIdentifier.OID_EXTENSION_REQUEST; import static model.asn1.ObjectIdentifier.TAG; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; public final class TestConstants { @@ -76,7 +75,7 @@ public final class TestConstants { public static final Attribute CSR_ATTR_1; - public static final Byte[] CSR_ATTR_1_DER = new Byte[] { + public static final Byte[] CSR_ATTR_1_DER = new Byte[]{ 0x30, 0x1C, 0x06, 0x0A, 0x2B, 0x06, 0x01, 0x04, 0x01, -126, 0x37, 0x0D, 0x02, 0x03, 0x31, 0x0E, 0x16, 0x0C, 0x31, 0x30, 0x2E, 0x30, 0x2E, 0x31, 0x39, 0x30, 0x34, 0x35, 0x2E, 0x32 @@ -89,7 +88,7 @@ public final class TestConstants { 0x06, 0x4D, 0x69, 0x6C, 0x61, 0x6E, 0x6F }; public static final RelativeDistinguishedName L_MILANO; - public static final Byte[] CN_TEST_ED25519_DER = new Byte[] { + public static final Byte[] CN_TEST_ED25519_DER = new Byte[]{ 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0C, 0x54, 0x65, 0x73, 0x74, 0x20, 0x65, 0x64, 0x32, 0x35, 0x35, 0x31, 0x39, @@ -122,33 +121,33 @@ public final class TestConstants { /** * Certificate: - * Data: - * Version: 3 (0x2) - * Serial Number: - * 70:fa:0f:fa:a6:d7:f4:b4:93:05:5d:a9:d3:e4:42:a8:52:60:b3:f8 - * Signature Algorithm: ecdsa-with-SHA256 - * Issuer: CN = Yuuta Root CA, C = CA - * Validity - * Not Before: Jun 23 02:50:46 2023 GMT - * Not After : Jun 23 02:50:46 2048 GMT - * Subject: CN = Yuuta Root CA, C = CA - * Subject Public Key Info: - * Public Key Algorithm: id-ecPublicKey - * Public-Key: (256 bit) - * pub: - * ASN1 OID: prime256v1 - * NIST CURVE: P-256 - * X509v3 extensions: - * X509v3 Subject Key Identifier: - * 78:92:E0:6C:70:F5:A3:BE:02:EE:44:BA:A7:8C:DA:D6:B5:43:A7:93 - * X509v3 Authority Key Identifier: - * 78:92:E0:6C:70:F5:A3:BE:02:EE:44:BA:A7:8C:DA:D6:B5:43:A7:93 - * X509v3 Basic Constraints: critical - * CA:TRUE - * X509v3 Key Usage: critical - * Digital Signature, Certificate Sign, CRL Sign - * Signature Algorithm: ecdsa-with-SHA256 - * Signature Value: + * Data: + * Version: 3 (0x2) + * Serial Number: + * 70:fa:0f:fa:a6:d7:f4:b4:93:05:5d:a9:d3:e4:42:a8:52:60:b3:f8 + * Signature Algorithm: ecdsa-with-SHA256 + * Issuer: CN = Yuuta Root CA, C = CA + * Validity + * Not Before: Jun 23 02:50:46 2023 GMT + * Not After : Jun 23 02:50:46 2048 GMT + * Subject: CN = Yuuta Root CA, C = CA + * Subject Public Key Info: + * Public Key Algorithm: id-ecPublicKey + * Public-Key: (256 bit) + * pub: + * ASN1 OID: prime256v1 + * NIST CURVE: P-256 + * X509v3 extensions: + * X509v3 Subject Key Identifier: + * 78:92:E0:6C:70:F5:A3:BE:02:EE:44:BA:A7:8C:DA:D6:B5:43:A7:93 + * X509v3 Authority Key Identifier: + * 78:92:E0:6C:70:F5:A3:BE:02:EE:44:BA:A7:8C:DA:D6:B5:43:A7:93 + * X509v3 Basic Constraints: critical + * CA:TRUE + * X509v3 Key Usage: critical + * Digital Signature, Certificate Sign, CRL Sign + * Signature Algorithm: ecdsa-with-SHA256 + * Signature Value: */ public static final String CERT_L1_ECC_PEM = "-----BEGIN CERTIFICATE-----\n" + @@ -165,37 +164,37 @@ public final class TestConstants { "-----END CERTIFICATE-----"; /** * Certificate: - * Data: - * Version: 3 (0x2) - * Serial Number: - * 3e:10:93:9d:e4:57:8d:39:87:fd:ff:42:7b:da:65:5b:1f:21:cb:07 - * Signature Algorithm: ecdsa-with-SHA512 - * Issuer: CN = Yuuta Root CA, C = CA - * Validity - * Not Before: Jun 24 00:15:22 2023 GMT - * Not After : Jun 21 00:15:22 2033 GMT - * Subject: DC = MOE, DC = YUUTA, DC = AD, CN = Yuuta Home Issuing CA - * Subject Public Key Info: - * Public Key Algorithm: rsaEncryption - * Public-Key: (4096 bit) - * Modulus: - * Exponent: 65537 (0x10001) - * X509v3 extensions: - * X509v3 Subject Key Identifier: - * B1:C2:A7:81:63:66:4B:72:0A:DD:FD:7D:20:29:BD:6B:49:09:61:C0 - * X509v3 Authority Key Identifier: - * 78:92:E0:6C:70:F5:A3:BE:02:EE:44:BA:A7:8C:DA:D6:B5:43:A7:93 - * X509v3 Basic Constraints: critical - * CA:TRUE, pathlen:0 - * X509v3 Key Usage: critical - * Digital Signature, Certificate Sign, CRL Sign - * X509v3 CRL Distribution Points: - * Full Name: - * URI:http://home.yuuta.moe/pki/rootca.crl - * Authority Information Access: - * CA Issuers - URI:http://home.yuuta.moe/pki/rootca.crt - * Signature Algorithm: ecdsa-with-SHA512 - * Signature Value: + * Data: + * Version: 3 (0x2) + * Serial Number: + * 3e:10:93:9d:e4:57:8d:39:87:fd:ff:42:7b:da:65:5b:1f:21:cb:07 + * Signature Algorithm: ecdsa-with-SHA512 + * Issuer: CN = Yuuta Root CA, C = CA + * Validity + * Not Before: Jun 24 00:15:22 2023 GMT + * Not After : Jun 21 00:15:22 2033 GMT + * Subject: DC = MOE, DC = YUUTA, DC = AD, CN = Yuuta Home Issuing CA + * Subject Public Key Info: + * Public Key Algorithm: rsaEncryption + * Public-Key: (4096 bit) + * Modulus: + * Exponent: 65537 (0x10001) + * X509v3 extensions: + * X509v3 Subject Key Identifier: + * B1:C2:A7:81:63:66:4B:72:0A:DD:FD:7D:20:29:BD:6B:49:09:61:C0 + * X509v3 Authority Key Identifier: + * 78:92:E0:6C:70:F5:A3:BE:02:EE:44:BA:A7:8C:DA:D6:B5:43:A7:93 + * X509v3 Basic Constraints: critical + * CA:TRUE, pathlen:0 + * X509v3 Key Usage: critical + * Digital Signature, Certificate Sign, CRL Sign + * X509v3 CRL Distribution Points: + * Full Name: + * URI:http://home.yuuta.moe/pki/rootca.crl + * Authority Information Access: + * CA Issuers - URI:http://home.yuuta.moe/pki/rootca.crt + * Signature Algorithm: ecdsa-with-SHA512 + * Signature Value: */ public static final String CERT_L2_RSA_PEM = "-----BEGIN CERTIFICATE-----\n" + @@ -226,22 +225,22 @@ public final class TestConstants { /** * Certificate: - * Data: - * Version: 1 (0x0) - * Serial Number: 3580 (0xdfc) - * Signature Algorithm: sha1WithRSAEncryption - * Issuer: C = JP, ST = Tokyo, L = Chuo-ku, O = Frank4DD, OU = WebCert Support, CN = Frank4DD Web CA, emailAddress = support@frank4dd.com - * Validity - * Not Before: Aug 22 05:27:41 2012 GMT - * Not After : Aug 21 05:27:41 2017 GMT - * Subject: C = JP, ST = Tokyo, O = Frank4DD, CN = www.example.com - * Subject Public Key Info: - * Public Key Algorithm: rsaEncryption - * Public-Key: (2048 bit) - * Modulus: - * Exponent: 65537 (0x10001) - * Signature Algorithm: sha1WithRSAEncryption - * Signature Value: + * Data: + * Version: 1 (0x0) + * Serial Number: 3580 (0xdfc) + * Signature Algorithm: sha1WithRSAEncryption + * Issuer: C = JP, ST = Tokyo, L = Chuo-ku, O = Frank4DD, OU = WebCert Support, CN = Frank4DD Web CA, emailAddress = support@frank4dd.com + * Validity + * Not Before: Aug 22 05:27:41 2012 GMT + * Not After : Aug 21 05:27:41 2017 GMT + * Subject: C = JP, ST = Tokyo, O = Frank4DD, CN = www.example.com + * Subject Public Key Info: + * Public Key Algorithm: rsaEncryption + * Public-Key: (2048 bit) + * Modulus: + * Exponent: 65537 (0x10001) + * Signature Algorithm: sha1WithRSAEncryption + * Signature Value: */ public static final String CERT_V1_PEM = "-----BEGIN CERTIFICATE-----\n" + @@ -310,13 +309,13 @@ public final class TestConstants { }); CSR_ATTR_2 = new Attribute( - ASN1Object.TAG_SEQUENCE, null, - new ObjectIdentifier(ObjectIdentifier.TAG, null, OID_EXTENSION_REQUEST), + ASN1Object.TAG_SEQUENCE, null, + new ObjectIdentifier(ObjectIdentifier.TAG, null, OID_EXTENSION_REQUEST), CSR_ATTR_VALUES_2); CSR_ATTR_1 = new Attribute( TAG_SEQUENCE, null, - new ObjectIdentifier(TAG, null, new Integer[]{ 1, 3, 6, 1, 4, 1, 311, 13, 2, 3 }), + new ObjectIdentifier(TAG, null, new Integer[]{1, 3, 6, 1, 4, 1, 311, 13, 2, 3}), new Values(TAG_SET, null, new ASN1Object[]{ new IA5String(IA5String.TAG, null, "10.0.19045.2") }) @@ -432,7 +431,7 @@ public final class TestConstants { ObjectIdentifier.OID_EC_PUBLIC_KEY), new ObjectIdentifier(ObjectIdentifier.TAG, null, ObjectIdentifier.OID_PRIME256_V1)), - new BitString(BitString.TAG, null, 0, new Byte[]{ 1, 2, 3 })), + new BitString(BitString.TAG, null, 0, new Byte[]{1, 2, 3})), new Extensions(ASN1Object.TAG_SEQUENCE, new Tag(TagClass.CONTEXT_SPECIFIC, false, 3), new Extension[]{ @@ -441,13 +440,13 @@ public final class TestConstants { ObjectIdentifier.OID_BASIC_CONSTRAINTS), new Bool(Bool.TAG, null, true), new OctetString(OctetString.TAG, null, - new Byte[]{ 0x30, 0x06, 0x01, 0x01, -1, 0x02, 0x01, 0x00 })), + new Byte[]{0x30, 0x06, 0x01, 0x01, -1, 0x02, 0x01, 0x00})), 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[]{ 0x03, 0x02, 0x01, -122 })) + new Byte[]{0x03, 0x02, 0x01, -122})) })); REVOKED_CESSATION = @@ -461,15 +460,15 @@ public final class TestConstants { new UtcTime(UtcTime.TAG, null, ZonedDateTime.now(ZoneId.of("UTC"))), Reason.KEY_COMPROMISE); REVOKED_CESSATION_DER = combine((byte) 0x30, - REVOKED_CESSATION.getSerialNumber().encodeDER(), - REVOKED_CESSATION.getRevocationDate().encodeDER(), + REVOKED_CESSATION.getSerialNumber().encodeDER(), + REVOKED_CESSATION.getRevocationDate().encodeDER(), + combine((byte) 0x30, combine((byte) 0x30, - combine((byte) 0x30, - new ObjectIdentifier(ObjectIdentifier.TAG, null, - ObjectIdentifier.OID_CRL_REASON).encodeDER(), - new OctetString(OctetString.TAG, null, - new Byte[]{ 0x0A, 0x01, (byte) Reason.CESSATION_OF_OPERATION.getVal() }) - .encodeDER()))); + new ObjectIdentifier(ObjectIdentifier.TAG, null, + ObjectIdentifier.OID_CRL_REASON).encodeDER(), + new OctetString(OctetString.TAG, null, + new Byte[]{0x0A, 0x01, (byte) Reason.CESSATION_OF_OPERATION.getVal()}) + .encodeDER()))); REVOKED_KEY_COMPROMISE_DER = combine((byte) 0x30, REVOKED_KEY_COMPROMISE.getSerialNumber().encodeDER(), REVOKED_KEY_COMPROMISE.getRevocationDate().encodeDER(), @@ -478,7 +477,7 @@ public final class TestConstants { new ObjectIdentifier(ObjectIdentifier.TAG, null, ObjectIdentifier.OID_CRL_REASON).encodeDER(), new OctetString(OctetString.TAG, null, - new Byte[]{ 0x0A, 0x01, (byte) Reason.KEY_COMPROMISE.getVal() }) + new Byte[]{0x0A, 0x01, (byte) Reason.KEY_COMPROMISE.getVal()}) .encodeDER()))); CRL_CONTENT_1 = new CertificateListContent(ASN1Object.TAG_SEQUENCE, null, @@ -536,8 +535,8 @@ public final class TestConstants { public static Byte[] combine(Byte tag, Byte[]... vals) { return Stream.of(Collections.singletonList(tag), - Arrays.asList(new ASN1Length(Arrays.stream(vals).mapToInt(b -> b.length).sum()).encodeDER()), - Arrays.stream(vals).flatMap(Arrays::stream).collect(Collectors.toList())) + Arrays.asList(new ASN1Length(Arrays.stream(vals).mapToInt(b -> b.length).sum()).encodeDER()), + Arrays.stream(vals).flatMap(Arrays::stream).collect(Collectors.toList())) .flatMap(Collection::stream) .toArray(Byte[]::new); } -- cgit v1.2.3