static

in src/main/java/org/apache/commons/crypto/random/OpenSslCryptoRandom.java [49:72]


    static {
        boolean opensslLoaded = false;
        Throwable except = null;
        if (Crypto.isNativeCodeLoaded()) {
            try {
                OpenSslCryptoRandomNative.initSR();
                opensslLoaded = true;
            } catch (final Exception | UnsatisfiedLinkError e) {
                except = e;
            }
        }
        nativeEnabled = opensslLoaded;
        initException = except;
        //
        // Check that nextRandBytes works (is this really needed?)
        try {
            checkNative();
        } catch (final GeneralSecurityException e) {
            throw new IllegalStateException(e);
        }
        if (!OpenSslCryptoRandomNative.nextRandBytes(new byte[1])) {
            throw new IllegalStateException("Check of nextRandBytes failed");
        }
    }