mirror of https://github.com/apache/activemq.git
Merge pull request #431 from coheigea/AMQ-7142
AMQ-7142 - Inserting Bouncy Castle Provider Early in Java Security Pr…
This commit is contained in:
commit
b589b61f2d
|
@ -277,9 +277,14 @@ public class BrokerService implements Service {
|
||||||
ClassLoader loader = BrokerService.class.getClassLoader();
|
ClassLoader loader = BrokerService.class.getClassLoader();
|
||||||
Class<?> clazz = loader.loadClass("org.bouncycastle.jce.provider.BouncyCastleProvider");
|
Class<?> clazz = loader.loadClass("org.bouncycastle.jce.provider.BouncyCastleProvider");
|
||||||
Provider bouncycastle = (Provider) clazz.newInstance();
|
Provider bouncycastle = (Provider) clazz.newInstance();
|
||||||
Security.insertProviderAt(bouncycastle,
|
Integer bouncyCastlePosition = Integer.getInteger("org.apache.activemq.broker.BouncyCastlePosition");
|
||||||
Integer.getInteger("org.apache.activemq.broker.BouncyCastlePosition", 2));
|
int ret = 0;
|
||||||
LOG.info("Loaded the Bouncy Castle security provider.");
|
if (bouncyCastlePosition != null) {
|
||||||
|
ret = Security.insertProviderAt(bouncycastle, bouncyCastlePosition);
|
||||||
|
} else {
|
||||||
|
ret = Security.addProvider(bouncycastle);
|
||||||
|
}
|
||||||
|
LOG.info("Loaded the Bouncy Castle security provider at position: " + ret);
|
||||||
} catch(Throwable e) {
|
} catch(Throwable e) {
|
||||||
// No BouncyCastle found so we use the default Java Security Provider
|
// No BouncyCastle found so we use the default Java Security Provider
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class AMQ2902Test extends TestCase {
|
||||||
LOG.error("got event: " + event + ", ex:" + event.getThrowableInformation().getThrowable(), event.getThrowableInformation().getThrowable());
|
LOG.error("got event: " + event + ", ex:" + event.getThrowableInformation().getThrowable(), event.getThrowableInformation().getThrowable());
|
||||||
LOG.error("Event source: ", new Throwable("Here"));
|
LOG.error("Event source: ", new Throwable("Here"));
|
||||||
}
|
}
|
||||||
if( !"Loaded the Bouncy Castle security provider.".equals(event.getMessage()) ) {
|
if( !((String) event.getMessage()).startsWith("Loaded the Bouncy Castle security provider at position") ) {
|
||||||
if (event.getMDC("activemq.broker") == null) {
|
if (event.getMDC("activemq.broker") == null) {
|
||||||
failedToFindMDC.set(Boolean.TRUE);
|
failedToFindMDC.set(Boolean.TRUE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue