diff --git a/pom.xml b/pom.xml
index 061415e..2e2d2d7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -122,14 +122,14 @@
11
11
11
- 1.70
+ 1.78.1
7.7.1
4.11.0
2.12.0
2.3.3
2.3.3
31.1-jre
- 2.0.0
+ 2.1.0
1.9
@@ -137,7 +137,7 @@
org.bouncycastle
- bcpkix-jdk15on
+ bcpkix-jdk18on
${bouncycastle.version}
diff --git a/src/main/java/network/oxalis/commons/certvalidator/parser/ClassRuleParser.java b/src/main/java/network/oxalis/commons/certvalidator/parser/ClassRuleParser.java
index ac987b6..b7bd2e5 100644
--- a/src/main/java/network/oxalis/commons/certvalidator/parser/ClassRuleParser.java
+++ b/src/main/java/network/oxalis/commons/certvalidator/parser/ClassRuleParser.java
@@ -6,6 +6,7 @@
import network.oxalis.commons.certvalidator.lang.ValidatorParsingException;
import org.kohsuke.MetaInfServices;
+import java.lang.reflect.InvocationTargetException;
import java.util.Map;
/**
@@ -24,8 +25,8 @@ public ValidatorRule parse(Object o, Map objectStorage) throws V
ClassType classType = (ClassType) o;
try {
- return (ValidatorRule) Class.forName(classType.getValue()).newInstance();
- } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
+ return (ValidatorRule) Class.forName(classType.getValue()).getDeclaredConstructor().newInstance();
+ } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
throw new ValidatorParsingException(
String.format("Unable to load rule '%s'.", classType.getValue()), e);
}
diff --git a/src/main/java/network/oxalis/commons/certvalidator/rule/CRLRule.java b/src/main/java/network/oxalis/commons/certvalidator/rule/CRLRule.java
index 94f8169..0111228 100644
--- a/src/main/java/network/oxalis/commons/certvalidator/rule/CRLRule.java
+++ b/src/main/java/network/oxalis/commons/certvalidator/rule/CRLRule.java
@@ -11,7 +11,7 @@
import org.bouncycastle.asn1.x509.DistributionPoint;
import org.bouncycastle.asn1.x509.GeneralName;
import org.bouncycastle.asn1.x509.GeneralNames;
-import org.bouncycastle.x509.extension.X509ExtensionUtil;
+import org.bouncycastle.cert.jcajce.JcaX509ExtensionUtils;
import java.io.IOException;
import java.security.cert.X509CRL;
@@ -58,7 +58,7 @@ public static List getCrlDistributionPoints(X509Certificate certificate)
if (!certificate.getNonCriticalExtensionOIDs().contains(CRL_EXTENSION))
return urls;
- CRLDistPoint distPoint = CRLDistPoint.getInstance(X509ExtensionUtil.fromExtensionValue(certificate.getExtensionValue(CRL_EXTENSION)));
+ CRLDistPoint distPoint = CRLDistPoint.getInstance(JcaX509ExtensionUtils.parseExtensionValue(certificate.getExtensionValue(CRL_EXTENSION)));
for (DistributionPoint dp : distPoint.getDistributionPoints())
for (GeneralName name : ((GeneralNames) dp.getDistributionPoint().getName()).getNames())
if (name.getTagNo() == GeneralName.uniformResourceIdentifier)
diff --git a/src/test/java/network/oxalis/commons/certvalidator/extra/NorwegianOrganizationNumberRuleTest.java b/src/test/java/network/oxalis/commons/certvalidator/extra/NorwegianOrganizationNumberRuleTest.java
index f307a35..4af3ea4 100644
--- a/src/test/java/network/oxalis/commons/certvalidator/extra/NorwegianOrganizationNumberRuleTest.java
+++ b/src/test/java/network/oxalis/commons/certvalidator/extra/NorwegianOrganizationNumberRuleTest.java
@@ -20,7 +20,7 @@ public class NorwegianOrganizationNumberRuleTest extends X509TestGenerator {
@Test
public void shouldExtractOrgnumberFromCertBasedOnSerialnumber() throws Exception {
final String ORGNR = "123456789";
- X509Certificate cert = createX509Certificate("CN=name, OU=None, O=None L=None, C=None, serialNumber=" + ORGNR);
+ X509Certificate cert = createX509Certificate("CN=name, OU=None, O=None, L=None, C=None, serialNumber=" + ORGNR);
new NorwegianOrganizationNumberRule(new PrincipalNameProvider() {
@Override
@@ -34,7 +34,7 @@ public boolean validate(String value) {
@Test(expectedExceptions = FailedValidationException.class)
public void invalidOrgnumberFromCertBasedOnSerialnumber() throws Exception {
final String ORGNR = "123 456 789";
- X509Certificate cert = createX509Certificate("CN=name, OU=None, O=None L=None, C=None, serialNumber=" + ORGNR);
+ X509Certificate cert = createX509Certificate("CN=name, OU=None, O=None, L=None, C=None, serialNumber=" + ORGNR);
new NorwegianOrganizationNumberRule(new PrincipalNameProvider() {
@Override
@@ -89,7 +89,7 @@ public boolean validate(String value) {
@Test(expectedExceptions = FailedValidationException.class)
public void notAcceptedOrgnumberFromCertBasedOnSerialnumber() throws Exception {
final String ORGNR = "123456789";
- X509Certificate cert = createX509Certificate("CN=name, OU=None, O=None L=None, C=None, serialNumber=" + ORGNR);
+ X509Certificate cert = createX509Certificate("CN=name, OU=None, O=None, L=None, C=None, serialNumber=" + ORGNR);
new NorwegianOrganizationNumberRule(new PrincipalNameProvider() {
@Override
diff --git a/src/test/java/network/oxalis/commons/certvalidator/testutil/X509TestGenerator.java b/src/test/java/network/oxalis/commons/certvalidator/testutil/X509TestGenerator.java
index 02825e8..2e883fe 100644
--- a/src/test/java/network/oxalis/commons/certvalidator/testutil/X509TestGenerator.java
+++ b/src/test/java/network/oxalis/commons/certvalidator/testutil/X509TestGenerator.java
@@ -27,7 +27,7 @@ public abstract class X509TestGenerator {
protected X509Certificate createX509Certificate(Date from, Date to) throws NoSuchAlgorithmException, SignatureException, InvalidKeyException, CertificateException, OperatorCreationException, CertIOException {
String domainName = "test";
- return createX509Certificate(null, "CN=" + domainName + ", OU=None, O=None L=None, C=None", null, from, to);
+ return createX509Certificate(null, "CN=" + domainName + ", OU=None, O=None, L=None, C=None", null, from, to);
}
protected X509Certificate createX509Certificate(String subject, X509ExtensionCustom custom, Date from, Date to) throws NoSuchAlgorithmException, SignatureException, InvalidKeyException, CertificateException, OperatorCreationException, CertIOException {
@@ -48,9 +48,9 @@ protected X509Certificate createX509Certificate(X509Certificate issuer, String s
if(issuer != null)
issuerName = new X500Name(issuer.getSubjectX500Principal().getName());
else
- issuerName = new X500Name("CN=" + "test" + ", OU=None, O=None L=None, C=None");
+ issuerName = new X500Name("CN=" + "test" + ", OU=None, O=None, L=None, C=None");
- SubjectPublicKeyInfo subjPubKeyInfo = new SubjectPublicKeyInfo(ASN1Sequence.getInstance(RSAPubKey.getEncoded()));
+ SubjectPublicKeyInfo subjPubKeyInfo = SubjectPublicKeyInfo.getInstance((ASN1Sequence.getInstance(RSAPubKey.getEncoded())));
X509v3CertificateBuilder v3CertGen = new X509v3CertificateBuilder(
@@ -75,7 +75,7 @@ protected X509Certificate createX509Certificate(X509Certificate issuer, String s
protected X509Certificate createX509Certificate(X509ExtensionCustom x509ExtensionCustom) throws NoSuchAlgorithmException, SignatureException, InvalidKeyException, CertificateException, OperatorCreationException, CertIOException {
String domainName = "test";
- return createX509Certificate("CN=" + domainName + ", OU=None, O=None L=None, C=None", x509ExtensionCustom, DateTime.now().minusYears(1).toDate(), DateTime.now().plusYears(1).toDate());
+ return createX509Certificate("CN=" + domainName + ", OU=None, O=None, L=None, C=None", x509ExtensionCustom, DateTime.now().minusYears(1).toDate(), DateTime.now().plusYears(1).toDate());
}
protected X509Certificate createX509Certificate() throws NoSuchAlgorithmException, SignatureException, InvalidKeyException, CertificateException, OperatorCreationException, CertIOException {