Issue #1673 - warn using test-keystore, hide bouncycastle from webapp

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2021-01-11 23:06:17 +11:00
parent c3e8e8d395
commit 171dfc2237
2 changed files with 7 additions and 0 deletions

View File

@ -23,6 +23,7 @@ etc/jetty-test-keystore.xml
[ini] [ini]
bouncycastle.version?=1.62 bouncycastle.version?=1.62
jetty.webapp.addServerClasses+=,${jetty.base.uri}/lib/bouncycastle/
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

View File

@ -35,12 +35,18 @@ import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.operator.ContentSigner; import org.bouncycastle.operator.ContentSigner;
import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder; import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
import org.eclipse.jetty.util.security.Password; import org.eclipse.jetty.util.security.Password;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class KeystoreGenerator public class KeystoreGenerator
{ {
private static final Logger LOG = LoggerFactory.getLogger(KeystoreGenerator.class);
@SuppressWarnings("unused") @SuppressWarnings("unused")
public static File generateTestKeystore(String location, String password) throws Exception public static File generateTestKeystore(String location, String password) throws Exception
{ {
LOG.warn("Generating Test Keystore: DO NOT USE IN PRODUCTION!");
// Generate an RSA key pair. // Generate an RSA key pair.
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA"); KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
keyPairGenerator.initialize(2048); keyPairGenerator.initialize(2048);