aboutsummaryrefslogtreecommitdiff
path: root/src/test/model/csr
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/model/csr')
-rw-r--r--src/test/model/csr/AttributeTest.java2
-rw-r--r--src/test/model/csr/AttributesTest.java14
-rw-r--r--src/test/model/csr/CertificationRequestInfoTest.java54
-rw-r--r--src/test/model/csr/CertificationRequestTest.java46
-rw-r--r--src/test/model/csr/ValuesTest.java7
5 files changed, 58 insertions, 65 deletions
diff --git a/src/test/model/csr/AttributeTest.java b/src/test/model/csr/AttributeTest.java
index f4daa4c..4899072 100644
--- a/src/test/model/csr/AttributeTest.java
+++ b/src/test/model/csr/AttributeTest.java
@@ -5,7 +5,7 @@ import model.asn1.exceptions.ParseException;
import model.asn1.parsing.BytesReader;
import org.junit.jupiter.api.Test;
-import static model.asn1.ObjectIdentifier.*;
+import static model.asn1.ObjectIdentifier.OID_EXTENSION_REQUEST;
import static org.junit.jupiter.api.Assertions.*;
public class AttributeTest {
diff --git a/src/test/model/csr/AttributesTest.java b/src/test/model/csr/AttributesTest.java
index 86a0112..eebdbfb 100644
--- a/src/test/model/csr/AttributesTest.java
+++ b/src/test/model/csr/AttributesTest.java
@@ -24,12 +24,12 @@ public class AttributesTest {
@Test
void testParse() throws ParseException {
final Attributes parsed = new Attributes(new BytesReader(new Byte[]{
- -96, 30,
- 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
- }), false);
+ -96, 30,
+ 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
+ }), false);
assertEquals(1, parsed.getArray().length);
assertEquals("10.0.19045.2", parsed.getArray()[0].getValues().getArray()[0].toString());
}
@@ -59,7 +59,7 @@ public class AttributesTest {
Byte[] a2 = TestConstants.CSR_ATTR_2.encodeDER();
Byte[] a1 = TestConstants.CSR_ATTR_1.encodeDER();
assertArrayEquals(
- Stream.of(Arrays.asList(new Byte[]{ 0x31, (byte)(a2.length + a1.length) }),
+ Stream.of(Arrays.asList(new Byte[]{0x31, (byte) (a2.length + a1.length)}),
Arrays.asList(a2),
Arrays.asList(a1))
.flatMap(Collection::stream)
diff --git a/src/test/model/csr/CertificationRequestInfoTest.java b/src/test/model/csr/CertificationRequestInfoTest.java
index fe2633f..bb7ae38 100644
--- a/src/test/model/csr/CertificationRequestInfoTest.java
+++ b/src/test/model/csr/CertificationRequestInfoTest.java
@@ -12,7 +12,7 @@ import static model.TestConstants.mutate;
import static org.junit.jupiter.api.Assertions.*;
public class CertificationRequestInfoTest {
- static final Byte[] CSR_1 = new Byte[] {
+ static final Byte[] CSR_1 = new Byte[]{
0x30, -126, 0x02, 0x03, // SEQUENCE CertificationRequestInfo
0x02, 0x01, 0x00, // Version
0x30, 0x1c, // SEQUENCE Subject
@@ -22,30 +22,30 @@ public class CertificationRequestInfoTest {
0x0c, 0x11, 0x4d, 0x49, 0x4b, 0x55, 0x2e, 0x41, // PrintableString (MIKU.AD.YUUTA.MOE)
0x44, 0x2e, 0x59, 0x55, 0x55, 0x54, 0x41, 0x2e,
0x4d, 0x4f, 0x45,
- 0x30, -127, -97, // SEQUENCE SubjectPublicKeyInfo
+ 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,
- -96, -126, 0x01, 0x3c, // SEQUENCE (attributes)
+ -96, -126, 0x01, 0x3c, // SEQUENCE (attributes)
0x30, 0x1c, 0x06, 0x0a, // SEQUENCE (attribute)
0x2b, 0x06, 0x01, 0x04, 0x01, -126, 0x37, 0x0d,
0x02, 0x03, 0x31, 0x0e, 0x16, 0x0c, 0x31, 0x30,
@@ -76,10 +76,10 @@ public class CertificationRequestInfoTest {
0x6f, 0x00, 0x76, 0x00, 0x69, 0x00, 0x64, 0x00,
0x65, 0x00, 0x72, 0x03, 0x01, 0x00,
0x30, 0x70, 0x06, 0x09, // SEQUENCE (attribute)
- 0x2a, -122, 0x48, -122, -9, 0x0d, 0x01, 0x09,
+ 0x2a, -122, 0x48, -122, -9, 0x0d, 0x01, 0x09,
0x0e, 0x31, 0x63, 0x30, 0x61, 0x30, 0x0e, 0x06,
- 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, -1, 0x04,
- 0x04, 0x03, 0x02, 0x05, -96, 0x30, 0x13, 0x06,
+ 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, -1, 0x04,
+ 0x04, 0x03, 0x02, 0x05, -96, 0x30, 0x13, 0x06,
0x03, 0x55, 0x1d, 0x25, 0x04, 0x0c, 0x30, 0x0a,
0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07,
0x03, 0x01, 0x30, 0x1b, 0x06, 0x09, 0x2b, 0x06,
@@ -87,9 +87,9 @@ public class CertificationRequestInfoTest {
0x0e, 0x30, 0x0c, 0x30, 0x0a, 0x06, 0x08, 0x2b,
0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x01, 0x30,
0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16,
- 0x04, 0x14, -15, 0x3e, -110, -16, 0x4d, 0x1b,
- -47, 0x6e, 0x53, 0x7f, -102, 0x1d, 0x19, -75,
- 0x5e, -22, 0x64, 0x7f, 0x1f, -110,
+ 0x04, 0x14, -15, 0x3e, -110, -16, 0x4d, 0x1b,
+ -47, 0x6e, 0x53, 0x7f, -102, 0x1d, 0x19, -75,
+ 0x5e, -22, 0x64, 0x7f, 0x1f, -110,
};
@Test
@@ -104,7 +104,7 @@ public class CertificationRequestInfoTest {
ObjectIdentifier.OID_SHA256_WITH_RSA_ENCRYPTION),
new Null(Null.TAG, null)),
new BitString(BitString.TAG, null,
- 0, new Byte[]{ 1, 2, 3, 4, 5 })),
+ 0, new Byte[]{1, 2, 3, 4, 5})),
TestConstants.CSR_ATTRS_2);
assertEquals(CertificationRequestInfo.VERSION_V1, info.getVersion().getLong());
assertEquals(3, info.getSubject().getRdnSequence().length);
diff --git a/src/test/model/csr/CertificationRequestTest.java b/src/test/model/csr/CertificationRequestTest.java
index 962e90b..689f39d 100644
--- a/src/test/model/csr/CertificationRequestTest.java
+++ b/src/test/model/csr/CertificationRequestTest.java
@@ -18,25 +18,25 @@ import static org.junit.jupiter.api.Assertions.*;
public class CertificationRequestTest {
private static final Byte[] CSR_1 = Stream.of(
// SEQUENCE (CertificationRequest)
- Arrays.asList(new Byte[]{ 0x30, -126, 0x02, -102 }),
+ Arrays.asList(new Byte[]{0x30, -126, 0x02, -102}),
// SEQUENCE (CertificationRequestInfo)
Arrays.asList(CertificationRequestInfoTest.CSR_1),
// SEQUENCE (AlgorithmIdentifier)
Arrays.asList(new Byte[]{
0x30, 0x0D, 0x06, 0x09, 0x2A, -122, 0x48, -122,
- -9, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00
+ -9, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00
}),
// BIT STRING (Signature)
Arrays.asList(new Byte[]{
0x03, -127, -127,
- 0x00, 0x6F, 0x61, 0x5C, -25, 0x29, 0x48, 0x3F,
- -78, 0x1B, -117, 0x2C, -93, -114, 0x7D, -77,
- 0x62, 0x14, 0x21, 0x4B, -99, 0x74, -95, -93,
- 0x16, 0x38, 0x31, 0x40, 0x5E, 0x72, -77, -55,
- 0x6D, -69, 0x19, -108, 0x52, -95, 0x19, -121,
- -81, -71, 0x74, -123, 0x6B, -27, -20, 0x4C,
- -126, 0x42, -89, 0x66, 0x6A, 0x52, -34, 0x62,
- 0x72, 0x40, 0x2C, -79, 0x78, -117, -100, -70,
+ 0x00, 0x6F, 0x61, 0x5C, -25, 0x29, 0x48, 0x3F,
+ -78, 0x1B, -117, 0x2C, -93, -114, 0x7D, -77,
+ 0x62, 0x14, 0x21, 0x4B, -99, 0x74, -95, -93,
+ 0x16, 0x38, 0x31, 0x40, 0x5E, 0x72, -77, -55,
+ 0x6D, -69, 0x19, -108, 0x52, -95, 0x19, -121,
+ -81, -71, 0x74, -123, 0x6B, -27, -20, 0x4C,
+ -126, 0x42, -89, 0x66, 0x6A, 0x52, -34, 0x62,
+ 0x72, 0x40, 0x2C, -79, 0x78, -117, -100, -70,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -53,23 +53,23 @@ public class CertificationRequestTest {
final CertificationRequest request = new CertificationRequest(
ASN1Object.TAG_SEQUENCE, null,
new CertificationRequestInfo(
- ASN1Object.TAG_SEQUENCE, null,
- new Int(Int.TAG, null, CertificationRequestInfo.VERSION_V1),
- TestConstants.NAME_2,
- 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, 4, 5 })),
- TestConstants.CSR_ATTRS_2),
+ ASN1Object.TAG_SEQUENCE, null,
+ new Int(Int.TAG, null, CertificationRequestInfo.VERSION_V1),
+ TestConstants.NAME_2,
+ 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, 4, 5})),
+ TestConstants.CSR_ATTRS_2),
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[]{ 2, 4, 6, 8, 10 }));
+ 0, new Byte[]{2, 4, 6, 8, 10}));
assertEquals(CertificationRequestInfo.VERSION_V1,
request.getCertificationRequestInfo().getVersion().getLong());
@@ -77,7 +77,7 @@ public class CertificationRequestTest {
request.getCertificationRequestInfo().getSubject().getRdnSequence().length);
assertArrayEquals(ObjectIdentifier.OID_SHA256_WITH_RSA_ENCRYPTION,
request.getSignatureAlgorithm().getType().getInts());
- assertArrayEquals(new Byte[]{ 2, 4, 6, 8, 10 },
+ assertArrayEquals(new Byte[]{2, 4, 6, 8, 10},
request.getSignature().getConvertedVal());
}
diff --git a/src/test/model/csr/ValuesTest.java b/src/test/model/csr/ValuesTest.java
index 93229a4..5ee6070 100644
--- a/src/test/model/csr/ValuesTest.java
+++ b/src/test/model/csr/ValuesTest.java
@@ -1,19 +1,12 @@
package model.csr;
import model.asn1.ASN1Object;
-import model.asn1.Null;
-import model.asn1.ObjectIdentifier;
-import model.asn1.PrintableString;
import model.asn1.exceptions.ParseException;
import model.asn1.parsing.BytesReader;
-import model.x501.AttributeTypeAndValue;
-import model.x501.RelativeDistinguishedName;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static model.asn1.ASN1Object.TAG_SET;
-import static model.asn1.ObjectIdentifier.OID_C;
-import static model.asn1.ObjectIdentifier.OID_OU;
import static org.junit.jupiter.api.Assertions.*;
public class ValuesTest {