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/main/model/asn1/ObjectIdentifier.java | 74 +++++++++++++++---------------- 1 file changed, 36 insertions(+), 38 deletions(-) (limited to 'src/main/model/asn1/ObjectIdentifier.java') diff --git a/src/main/model/asn1/ObjectIdentifier.java b/src/main/model/asn1/ObjectIdentifier.java index c7278db..f6e850a 100644 --- a/src/main/model/asn1/ObjectIdentifier.java +++ b/src/main/model/asn1/ObjectIdentifier.java @@ -5,8 +5,6 @@ import model.asn1.parsing.BytesReader; import ui.Utils; import java.math.BigInteger; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -20,49 +18,49 @@ public class ObjectIdentifier extends ASN1Object { */ public static final Tag TAG = new Tag(TagClass.UNIVERSAL, false, 0x6); - public static final Integer[] OID_CN = new Integer[]{ 2, 5, 4, 3 }; - public static final Integer[] OID_SN = new Integer[]{ 2, 5, 4, 4 }; - public static final Integer[] OID_C = new Integer[]{ 2, 5, 4, 6 }; - public static final Integer[] OID_L = new Integer[]{ 2, 5, 4, 7 }; - public static final Integer[] OID_O = new Integer[]{ 2, 5, 4, 10 }; - public static final Integer[] OID_OU = new Integer[]{ 2, 5, 4, 11 }; - public static final Integer[] OID_DC = new Integer[]{ 0, 9, 2342, 19200300, 100, 1, 25 }; + public static final Integer[] OID_CN = new Integer[]{2, 5, 4, 3}; + public static final Integer[] OID_SN = new Integer[]{2, 5, 4, 4}; + public static final Integer[] OID_C = new Integer[]{2, 5, 4, 6}; + public static final Integer[] OID_L = new Integer[]{2, 5, 4, 7}; + public static final Integer[] OID_O = new Integer[]{2, 5, 4, 10}; + public static final Integer[] OID_OU = new Integer[]{2, 5, 4, 11}; + public static final Integer[] OID_DC = new Integer[]{0, 9, 2342, 19200300, 100, 1, 25}; public static final Integer[] OID_EXTENSION_REQUEST = - new Integer[]{ 1, 2, 840, 113549, 1, 9, 14 }; + new Integer[]{1, 2, 840, 113549, 1, 9, 14}; public static final Integer[] OID_RSA_ENCRYPTION = - new Integer[]{ 1, 2, 840, 113549, 1, 1, 1 }; + new Integer[]{1, 2, 840, 113549, 1, 1, 1}; public static final Integer[] OID_SHA256_WITH_RSA_ENCRYPTION = - new Integer[]{ 1, 2, 840, 113549, 1, 1, 11 }; + new Integer[]{1, 2, 840, 113549, 1, 1, 11}; public static final Integer[] OID_EC_PUBLIC_KEY = - new Integer[]{ 1, 2, 840, 10045, 2, 1 }; + new Integer[]{1, 2, 840, 10045, 2, 1}; public static final Integer[] OID_ECDSA_WITH_SHA256 = - new Integer[]{ 1, 2, 840, 10045, 4, 3, 2 }; + new Integer[]{1, 2, 840, 10045, 4, 3, 2}; public static final Integer[] OID_ECDSA_WITH_SHA512 = - new Integer[]{ 1, 2, 840, 10045, 4, 3, 4 }; + new Integer[]{1, 2, 840, 10045, 4, 3, 4}; public static final Integer[] OID_PRIME256_V1 = - new Integer[]{ 1, 2, 840, 10045, 3, 1, 7 }; + new Integer[]{1, 2, 840, 10045, 3, 1, 7}; public static final Integer[] OID_SUBJECT_KEY_IDENTIFIER = - new Integer[]{ 2, 5, 29, 14 }; + new Integer[]{2, 5, 29, 14}; public static final Integer[] OID_KEY_USAGE = - new Integer[]{ 2, 5, 29, 15 }; + new Integer[]{2, 5, 29, 15}; public static final Integer[] OID_BASIC_CONSTRAINTS = - new Integer[]{ 2, 5, 29, 19 }; + new Integer[]{2, 5, 29, 19}; public static final Integer[] OID_AUTHORITY_KEY_IDENTIFIER = - new Integer[]{ 2, 5, 29, 35 }; + new Integer[]{2, 5, 29, 35}; public static final Integer[] OID_CRL_DISTRIBUTION_POINTS = - new Integer[]{ 2, 5, 29, 31 }; + new Integer[]{2, 5, 29, 31}; public static final Integer[] OID_AUTHORITY_INFO_ACCESS = - new Integer[]{ 1, 3, 6, 1, 5, 5, 7, 1, 1 }; + new Integer[]{1, 3, 6, 1, 5, 5, 7, 1, 1}; public static final Integer[] OID_CURVED_25519 = - new Integer[]{ 1, 3, 101, 112 }; + new Integer[]{1, 3, 101, 112}; public static final Integer[] OID_CRL_REASON = - new Integer[]{ 2, 5, 29, 21 }; + new Integer[]{2, 5, 29, 21}; private final Integer[] ints; @@ -80,9 +78,9 @@ public class ObjectIdentifier extends ASN1Object { /** * EFFECTS: Parse the input DER. - * Throws {@link ParseException} if the input is invalid: - * - Zero bytes long - * - A multibyte integer is unterminated until the end of input + * Throws {@link ParseException} if the input is invalid: + * - Zero bytes long + * - A multibyte integer is unterminated until the end of input */ public ObjectIdentifier(BytesReader encoded, boolean hasParentTag) throws ParseException { super(encoded, hasParentTag); @@ -115,7 +113,7 @@ public class ObjectIdentifier extends ASN1Object { List num = new ArrayList<>(); for (int i = 1; i < raw.length; i++) { Byte b = raw[i]; - num.add(BitSet.valueOf(new byte[]{ (byte) (b & 127) })); + num.add(BitSet.valueOf(new byte[]{(byte) (b & 127)})); if ((b & -128) == 0) { BitSet bitSet = new BitSet(num.size() * 7); int z = 0; @@ -166,20 +164,20 @@ public class ObjectIdentifier extends ASN1Object { /** * EFFECTS: Encode the OID into DER bytes, following the DER rules as follows: - * - First two ints: first * 40 + second - * - Remaining: Int components are encoded as-is if they are <= 127. Otherwise, they are encoded into multiple 7bit - * bytes, with the MSB set on every byte except for the last (rightmost byte) of each component. - * - Integers are in big-endian. + * - First two ints: first * 40 + second + * - Remaining: Int components are encoded as-is if they are <= 127. Otherwise, they are encoded into multiple 7bit + * bytes, with the MSB set on every byte except for the last (rightmost byte) of each component. + * - Integers are in big-endian. */ @Override public Byte[] encodeValueDER() { return Stream.of( - Arrays.asList(Utils.valToByte(ints[0] * 40 + ints[1])), - Stream.of(ints) - .skip(2) - .map(ObjectIdentifier::encodeSingleInt) - .flatMap(Collection::stream) - .collect(Collectors.toList()) + Arrays.asList(Utils.valToByte(ints[0] * 40 + ints[1])), + Stream.of(ints) + .skip(2) + .map(ObjectIdentifier::encodeSingleInt) + .flatMap(Collection::stream) + .collect(Collectors.toList()) ).flatMap(Collection::stream) .toArray(Byte[]::new); } -- cgit v1.2.3