Issue #1673 - bring in bouncycastle jars with the .mod file
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
parent
c2b9d92a2f
commit
a99f8196bc
|
@ -7,23 +7,24 @@
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>jetty-test-keystore</artifactId>
|
<artifactId>jetty-test-keystore</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
<name>Jetty :: Test Keystore</name>
|
<name>Jetty :: Test Keystore</name>
|
||||||
<description>Test keystore with self-signed SSL Certificate.</description>
|
<description>Test keystore with self-signed SSL Certificate.</description>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<bouncycastle-version>1.60</bouncycastle-version>
|
<bouncycastle.version>1.62</bouncycastle.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bouncycastle</groupId>
|
<groupId>org.bouncycastle</groupId>
|
||||||
<artifactId>bcpkix-jdk15on</artifactId>
|
<artifactId>bcpkix-jdk15on</artifactId>
|
||||||
<version>${bouncycastle-version}</version>
|
<version>${bouncycastle.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bouncycastle</groupId>
|
<groupId>org.bouncycastle</groupId>
|
||||||
<artifactId>bcprov-jdk15on</artifactId>
|
<artifactId>bcprov-jdk15on</artifactId>
|
||||||
<version>${bouncycastle-version}</version>
|
<version>${bouncycastle.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
|
|
|
@ -9,13 +9,20 @@ ssl
|
||||||
[depend]
|
[depend]
|
||||||
ssl
|
ssl
|
||||||
|
|
||||||
|
[files]
|
||||||
|
maven://org.bouncycastle/bcpkix-jdk15on/${bouncycastle.version}|lib/bouncycastle/bcpkix-jdk15on-${bouncycastle.version}.jar
|
||||||
|
maven://org.bouncycastle/bcprov-jdk15on/${bouncycastle.version}|lib/bouncycastle/bcprov-jdk15on-${bouncycastle.version}.jar
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
lib/jetty-test-keystore-${jetty.version}.jar
|
lib/jetty-test-keystore-${jetty.version}.jar
|
||||||
|
lib/bouncycastle/bcpkix-jdk15on-${bouncycastle.version}.jar
|
||||||
|
lib/bouncycastle/bcprov-jdk15on-${bouncycastle.version}.jar
|
||||||
|
|
||||||
[xml]
|
[xml]
|
||||||
etc/jetty-test-keystore.xml
|
etc/jetty-test-keystore.xml
|
||||||
|
|
||||||
[ini]
|
[ini]
|
||||||
|
bouncycastle.version?=1.62
|
||||||
jetty.sslContext.keyStorePath?=etc/test-keystore.p12
|
jetty.sslContext.keyStorePath?=etc/test-keystore.p12
|
||||||
jetty.sslContext.keyStoreType?=PKCS12
|
jetty.sslContext.keyStoreType?=PKCS12
|
||||||
jetty.sslContext.keyStorePassword?=OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4
|
jetty.sslContext.keyStorePassword?=OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class KeystoreGenerator
|
||||||
generateTestKeystore("test-keystore.p12", "storepwd");
|
generateTestKeystore("test-keystore.p12", "storepwd");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void generateTestKeystore(String location, String password) throws Exception
|
public static File generateTestKeystore(String location, String password) throws Exception
|
||||||
{
|
{
|
||||||
// Generate an RSA key pair.
|
// Generate an RSA key pair.
|
||||||
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
|
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
|
||||||
|
@ -51,9 +51,9 @@ public class KeystoreGenerator
|
||||||
KeyPair keyPair = keyPairGenerator.generateKeyPair();
|
KeyPair keyPair = keyPairGenerator.generateKeyPair();
|
||||||
|
|
||||||
// Create a self-signed certificate.
|
// Create a self-signed certificate.
|
||||||
Instant now = Instant.now();
|
Instant start = Instant.now().minus(Duration.ofDays(1));
|
||||||
Date notBefore = Date.from(now);
|
Date notBefore = Date.from(start);
|
||||||
Date notAfter = Date.from(now.plus(Duration.ofDays(365)));
|
Date notAfter = Date.from(start.plus(Duration.ofDays(365)));
|
||||||
BigInteger serial = BigInteger.valueOf(new SecureRandom().nextLong());
|
BigInteger serial = BigInteger.valueOf(new SecureRandom().nextLong());
|
||||||
X500Name x500Name = new X500Name("C=US,ST=NE,L=Omaha,O=Webtide,OU=Jetty,CN=localhost");
|
X500Name x500Name = new X500Name("C=US,ST=NE,L=Omaha,O=Webtide,OU=Jetty,CN=localhost");
|
||||||
X509v3CertificateBuilder certBuilder = new JcaX509v3CertificateBuilder(x500Name, serial, notBefore, notAfter, x500Name, keyPair.getPublic());
|
X509v3CertificateBuilder certBuilder = new JcaX509v3CertificateBuilder(x500Name, serial, notBefore, notAfter, x500Name, keyPair.getPublic());
|
||||||
|
@ -76,6 +76,6 @@ public class KeystoreGenerator
|
||||||
{
|
{
|
||||||
keystore.store(fos, pwdCharArray);
|
keystore.store(fos, pwdCharArray);
|
||||||
}
|
}
|
||||||
|
return keystoreFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue