private SecureRandom createSecureRandom(ContextAware context) throws NoSuchProviderException, NoSuchAlgorithmException { SecureRandom secureRandom = getSecureRandom().createSecureRandom(); context.addInfo("secure random algorithm '" + secureRandom.getAlgorithm() + "' provider '" + secureRandom.getProvider() + "'"); return secureRandom; }
@Override public SecureRandom createSecureRandom() throws NoSuchProviderException, NoSuchAlgorithmException { secureRandomCreated = true; return super.createSecureRandom(); }
private SecureRandom createSecureRandom(ContextAware context) throws NoSuchProviderException, NoSuchAlgorithmException { SecureRandom secureRandom = getSecureRandom().createSecureRandom(); context.addInfo("secure random algorithm '" + secureRandom.getAlgorithm() + "' provider '" + secureRandom.getProvider() + "'"); return secureRandom; }
private SecureRandom createSecureRandom(ContextAware context) throws NoSuchProviderException, NoSuchAlgorithmException { SecureRandom secureRandom = getSecureRandom().createSecureRandom(); context.addInfo("secure random algorithm '" + secureRandom.getAlgorithm() + "' provider '" + secureRandom.getProvider() + "'"); return secureRandom; }
private SecureRandom createSecureRandom(ContextAware context) throws NoSuchProviderException, NoSuchAlgorithmException { SecureRandom secureRandom = getSecureRandom().createSecureRandom(); context.addInfo("secure random algorithm '" + secureRandom.getAlgorithm() + "' provider '" + secureRandom.getProvider() + "'"); return secureRandom; }
private SecureRandom createSecureRandom(ContextAware context) throws NoSuchProviderException, NoSuchAlgorithmException { SecureRandom secureRandom = getSecureRandom().createSecureRandom(); context.addInfo("secure random algorithm '" + secureRandom.getAlgorithm() + "' provider '" + secureRandom.getProvider() + "'"); return secureRandom; }
private SecureRandom createSecureRandom(ContextAware context) throws NoSuchProviderException, NoSuchAlgorithmException { SecureRandom secureRandom = getSecureRandom().createSecureRandom(); context.addInfo("secure random algorithm '" + secureRandom.getAlgorithm() + "' provider '" + secureRandom.getProvider() + "'"); return secureRandom; }
@Test public void testDefaults() throws Exception { assertNotNull(factoryBean.createSecureRandom()); }
@Test public void testExplicitProvider() throws Exception { SecureRandom secureRandom = SecureRandom.getInstance( SSL.DEFAULT_SECURE_RANDOM_ALGORITHM); factoryBean.setProvider(secureRandom.getProvider().getName()); assertNotNull(factoryBean.createSecureRandom()); }
@Test public void testUnknownAlgorithm() throws Exception { factoryBean.setAlgorithm(SSLTestConstants.FAKE_ALGORITHM_NAME); try { factoryBean.createSecureRandom(); fail("expected NoSuchAlgorithmException"); } catch (NoSuchAlgorithmException ex) { assertTrue(ex.getMessage().contains(SSLTestConstants.FAKE_ALGORITHM_NAME)); } }
@Test public void testUnknownProvider() throws Exception { factoryBean.setProvider(SSLTestConstants.FAKE_PROVIDER_NAME); try { factoryBean.createSecureRandom(); fail("expected NoSuchProviderException"); } catch (NoSuchProviderException ex) { assertTrue(ex.getMessage().contains(SSLTestConstants.FAKE_PROVIDER_NAME)); } }