Skip to content

Commit a8a2266

Browse files
committed
Added final composite OIDs to external, simple correctness test.
1 parent d1c0380 commit a8a2266

File tree

3 files changed

+106
-21
lines changed

3 files changed

+106
-21
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package org.bouncycastle.asn1.test;
2+
3+
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
4+
import org.bouncycastle.internal.asn1.iana.IANAObjectIdentifiers;
5+
import org.bouncycastle.util.test.SimpleTest;
6+
import org.bouncycastle.util.test.TestResult;
7+
8+
public class IANAObjectIdentifierTest
9+
extends SimpleTest
10+
{
11+
public String getName()
12+
{
13+
return "IANAObjectIdentifier";
14+
}
15+
16+
public void performTest()
17+
throws Exception
18+
{
19+
isEquals("wrong internet", new ASN1ObjectIdentifier("1.3.6.1"), IANAObjectIdentifiers.internet);
20+
isEquals("wrong id-alg", new ASN1ObjectIdentifier("1.3.6.1.5.5.7.6"), IANAObjectIdentifiers.id_alg);
21+
isEquals(new ASN1ObjectIdentifier("1.3.6.1.5.5.7.6.37"), IANAObjectIdentifiers.id_MLDSA44_RSA2048_PSS_SHA256);
22+
isEquals(new ASN1ObjectIdentifier("1.3.6.1.5.5.7.6.54"), IANAObjectIdentifiers.id_MLDSA87_ECDSA_P521_SHA512);
23+
}
24+
25+
public static void main(
26+
String[] args)
27+
{
28+
IANAObjectIdentifierTest test = new IANAObjectIdentifierTest();
29+
TestResult result = test.perform();
30+
31+
System.out.println(result);
32+
}
33+
}

core/src/test/java/org/bouncycastle/asn1/test/RegressionTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ public class RegressionTest
5656
new KMACParamsTest(),
5757
new DERPrivateTest(),
5858
new X509AltTest(),
59-
new CertIDTest()
59+
new CertIDTest(),
60+
new IANAObjectIdentifierTest()
6061
};
6162

6263
public static void main(String[] args)

util/src/main/java/org/bouncycastle/asn1/iana/IANAObjectIdentifiers.java

Lines changed: 71 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,50 +10,101 @@ public interface IANAObjectIdentifiers
1010
{
1111

1212
/** { iso(1) identifier-organization(3) dod(6) internet(1) } == IETF defined things */
13-
static final ASN1ObjectIdentifier internet = new ASN1ObjectIdentifier("1.3.6.1");
13+
ASN1ObjectIdentifier internet = new ASN1ObjectIdentifier("1.3.6.1");
1414
/** 1.3.6.1.1: Internet directory: X.500 */
15-
static final ASN1ObjectIdentifier directory = internet.branch("1");
15+
ASN1ObjectIdentifier directory = internet.branch("1");
1616
/** 1.3.6.1.2: Internet management */
17-
static final ASN1ObjectIdentifier mgmt = internet.branch("2");
17+
ASN1ObjectIdentifier mgmt = internet.branch("2");
1818
/** 1.3.6.1.3: */
19-
static final ASN1ObjectIdentifier experimental = internet.branch("3");
19+
ASN1ObjectIdentifier experimental = internet.branch("3");
2020
/** 1.3.6.1.4: */
21-
static final ASN1ObjectIdentifier _private = internet.branch("4");
21+
ASN1ObjectIdentifier _private = internet.branch("4");
2222
/** 1.3.6.1.5: Security services */
23-
static final ASN1ObjectIdentifier security = internet.branch("5");
23+
ASN1ObjectIdentifier security = internet.branch("5");
2424
/** 1.3.6.1.6: SNMPv2 -- never really used */
25-
static final ASN1ObjectIdentifier SNMPv2 = internet.branch("6");
25+
ASN1ObjectIdentifier SNMPv2 = internet.branch("6");
2626
/** 1.3.6.1.7: mail -- never really used */
27-
static final ASN1ObjectIdentifier mail = internet.branch("7");
27+
ASN1ObjectIdentifier mail = internet.branch("7");
2828

2929

30-
// id-SHA1 OBJECT IDENTIFIER ::=
30+
// id-SHA1 OBJECT IDENTIFIER ::=
3131
// {iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) ipsec(8) isakmpOakley(1)}
3232
//
3333

3434

3535
/** IANA security mechanisms; 1.3.6.1.5.5 */
36-
static final ASN1ObjectIdentifier security_mechanisms = security.branch("5");
36+
ASN1ObjectIdentifier security_mechanisms = security.branch("5");
3737
/** IANA security nametypes; 1.3.6.1.5.6 */
38-
static final ASN1ObjectIdentifier security_nametypes = security.branch("6");
38+
ASN1ObjectIdentifier security_nametypes = security.branch("6");
3939

4040
/** PKIX base OID: 1.3.6.1.5.5.7 */
41-
static final ASN1ObjectIdentifier pkix = security_mechanisms.branch("7");
41+
ASN1ObjectIdentifier pkix = security_mechanisms.branch("7");
42+
4243

4344
/** IPSEC base OID: 1.3.6.1.5.5.8 */
44-
static final ASN1ObjectIdentifier ipsec = security_mechanisms.branch("8");
45+
ASN1ObjectIdentifier ipsec = security_mechanisms.branch("8");
4546
/** IPSEC ISAKMP-Oakley OID: 1.3.6.1.5.5.8.1 */
46-
static final ASN1ObjectIdentifier isakmpOakley = ipsec.branch("1");
47+
ASN1ObjectIdentifier isakmpOakley = ipsec.branch("1");
4748

4849
/** IPSEC ISAKMP-Oakley hmacMD5 OID: 1.3.6.1.5.5.8.1.1 */
49-
static final ASN1ObjectIdentifier hmacMD5 = isakmpOakley.branch("1");
50+
ASN1ObjectIdentifier hmacMD5 = isakmpOakley.branch("1");
5051
/** IPSEC ISAKMP-Oakley hmacSHA1 OID: 1.3.6.1.5.5.8.1.2 */
51-
static final ASN1ObjectIdentifier hmacSHA1 = isakmpOakley.branch("2");
52-
52+
ASN1ObjectIdentifier hmacSHA1 = isakmpOakley.branch("2");
53+
5354
/** IPSEC ISAKMP-Oakley hmacTIGER OID: 1.3.6.1.5.5.8.1.3 */
54-
static final ASN1ObjectIdentifier hmacTIGER = isakmpOakley.branch("3");
55-
55+
ASN1ObjectIdentifier hmacTIGER = isakmpOakley.branch("3");
56+
5657
/** IPSEC ISAKMP-Oakley hmacRIPEMD160 OID: 1.3.6.1.5.5.8.1.4 */
57-
static final ASN1ObjectIdentifier hmacRIPEMD160 = isakmpOakley.branch("4");
58+
ASN1ObjectIdentifier hmacRIPEMD160 = isakmpOakley.branch("4");
59+
60+
/** 1.3.6.1.5.5.7.6 */
61+
ASN1ObjectIdentifier id_alg = internet.branch("5.5.7.6");
62+
63+
ASN1ObjectIdentifier id_RSASSA_PSS_SHAKE128 = id_alg.branch("30");
64+
65+
ASN1ObjectIdentifier id_RSASSA_PSS_SHAKE256 = id_alg.branch("31");
66+
67+
ASN1ObjectIdentifier id_ecdsa_with_shake128 = id_alg.branch("32");
68+
69+
ASN1ObjectIdentifier id_ecdsa_with_shake256 = id_alg.branch("33");
70+
71+
ASN1ObjectIdentifier id_alg_unsigned = id_alg.branch("36");
72+
73+
/** 1.3.6.1.5.5.7.6.37 id-MLDSA44-RSA2048-PSS-SHA256 */
74+
ASN1ObjectIdentifier id_MLDSA44_RSA2048_PSS_SHA256 = id_alg.branch("37");
75+
/** 1.3.6.1.5.5.7.6.38 id-MLDSA44-RSA2048-PKCS15-SHA256 */
76+
ASN1ObjectIdentifier id_MLDSA44_RSA2048_PKCS15_SHA256 = id_alg.branch("38");
77+
/** 1.3.6.1.5.5.7.6.39 id-MLDSA44-Ed25519-SHA512 */
78+
ASN1ObjectIdentifier id_MLDSA44_Ed25519_SHA512 = id_alg.branch("39");
79+
/** 1.3.6.1.5.5.7.6.40 id-MLDSA44-ECDSA-P256-SHA256 */
80+
ASN1ObjectIdentifier id_MLDSA44_ECDSA_P256_SHA256 = id_alg.branch("40");
81+
/** 1.3.6.1.5.5.7.6.41 id-MLDSA65-RSA3072-PSS-SHA512 */
82+
ASN1ObjectIdentifier id_MLDSA65_RSA3072_PSS_SHA512 = id_alg.branch("41");
83+
/** 1.3.6.1.5.5.7.6.42 id-MLDSA65-RSA3072-PKCS15-SHA512 */
84+
ASN1ObjectIdentifier id_MLDSA65_RSA3072_PKCS15_SHA512 = id_alg.branch("42");
85+
/** 1.3.6.1.5.5.7.6.43 id-MLDSA65-RSA4096-PSS-SHA512 */
86+
ASN1ObjectIdentifier id_MLDSA65_RSA4096_PSS_SHA512 = id_alg.branch("43");
87+
/** 1.3.6.1.5.5.7.6.44 id-MLDSA65-RSA4096-PKCS15-SHA512 */
88+
ASN1ObjectIdentifier id_MLDSA65_RSA4096_PKCS15_SHA512 = id_alg.branch("44");
89+
/** 1.3.6.1.5.5.7.6.45 id-MLDSA65-ECDSA-P256-SHA512 */
90+
ASN1ObjectIdentifier id_MLDSA65_ECDSA_P256_SHA512 = id_alg.branch("45");
91+
/** 1.3.6.1.5.5.7.6.46 id-MLDSA65-ECDSA-P384-SHA512 */
92+
ASN1ObjectIdentifier id_MLDSA65_ECDSA_P384_SHA512 = id_alg.branch("46");
93+
/** 1.3.6.1.5.5.7.6.47 id-MLDSA65-ECDSA-brainpoolP256r1-SHA512 */
94+
ASN1ObjectIdentifier id_MLDSA65_ECDSA_brainpoolP256r1_SHA512 = id_alg.branch("47");
95+
/** 1.3.6.1.5.5.7.6.48 id-MLDSA65-Ed25519-SHA512 */
96+
ASN1ObjectIdentifier id_MLDSA65_Ed25519_SHA512 = id_alg.branch("48");
97+
/** 1.3.6.1.5.5.7.6.49 id-MLDSA87-ECDSA-P384-SHA512 */
98+
ASN1ObjectIdentifier id_MLDSA87_ECDSA_P384_SHA512 = id_alg.branch("49");
99+
/** 1.3.6.1.5.5.7.6.50 id-MLDSA87-ECDSA-brainpoolP384r1-SHA512 */
100+
ASN1ObjectIdentifier id_MLDSA87_ECDSA_brainpoolP384r1_SHA512 = id_alg.branch("50");
101+
/** 1.3.6.1.5.5.7.6.51 id-MLDSA87-Ed448-SHAKE256 */
102+
ASN1ObjectIdentifier id_MLDSA87_Ed448_SHAKE256 = id_alg.branch("51");
103+
/** 1.3.6.1.5.5.7.6.52 id-MLDSA87-RSA3072-PSS-SHA512 */
104+
ASN1ObjectIdentifier id_MLDSA87_RSA3072_PSS_SHA512 = id_alg.branch("52");
105+
/** 1.3.6.1.5.5.7.6.53 id-MLDSA87-RSA4096-PSS-SHA512 */
106+
ASN1ObjectIdentifier id_MLDSA87_RSA4096_PSS_SHA512 = id_alg.branch("53");
107+
/** 1.3.6.1.5.5.7.6.54 id-MLDSA87-ECDSA-P521-SHA512 */
108+
ASN1ObjectIdentifier id_MLDSA87_ECDSA_P521_SHA512 = id_alg.branch("54");
58109

59110
}

0 commit comments

Comments
 (0)