DEFAULT SecureRandom not available

Jiho Park(박지호) <[email protected]>
Newsgroups gmane.comp.encryption.bouncy-castle.devel
Message-ID <CACE8fQSA5Arf5-990G60QeAw5u0fB=5SoyoHgNpsL905BYyuWQ@mail.gmail.com>
Hi, everyone.

The code initializing SSLContext works well when I set both BC Provider and
BCJSSE Provider
But when I set BCJSSE provider only, it fails to initialize SSLContext

Caused by: java.lang.IllegalStateException: unable to create TlsCrypto:
DEFAULT SecureRandom not available
at
org.bouncycastle.tls.crypto.impl.jcajce.JcaTlsCryptoProvider.create(JcaTlsCryptoProvider.java:82)
at
org.bouncycastle.jsse.provider.ProvSSLContextSpi.engineInit(ProvSSLContextSpi.java:425)
at javax.net.ssl.SSLContext.init(SSLContext.java:282)


Should I put new SecureRandom() instead of "null"?

But in the example code BC-FJA-(D)TLSUserGuide-1.0.5.pdf,
just add BCJSSE provider and put null to third parameter of SSLContext.init.

------------------------------------------------------------------------------------------

    // KeyStore
    KeyStore keyStore = KeyStore.getInstance("JKS");
    keyStore.load(keyStoreResrc.getInputStream(),
keyStorePassword.toCharArray());
    KeyManagerFactory keyMgrFact = KeyManagerFactory.getInstance("PKIX",
BouncyCastleJsseProvider.PROVIDER_NAME);
    keyMgrFact.init(keyStore, keyStorePassword.toCharArray());

    // TrustStore
    KeyStore trustStore = KeyStore.getInstance("JKS");
    trustStore.load(trustStoreResrc.getInputStream(),
trustStorePassword.toCharArray());
    TrustManagerFactory trustMgrFact =
TrustManagerFactory.getInstance("PKIX",
BouncyCastleJsseProvider.PROVIDER_NAME);
    trustMgrFact.init(trustStore);

    SSLContext sslContext = SSLContext.getInstance("TLSv1.2",
BouncyCastleJsseProvider.PROVIDER_NAME);
    sslContext.init(keyMgrFact.getKeyManagers(),
trustMgrFact.getTrustManagers(), null);

------------------------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.