public SecureRandom getInitializedSecureRandom() { return SharedSecureRandom.get(); }
/** * Create and return the sessionKey. * @return the sessionKey object */ public SimpleSessionKey createSessionKey() { int id = 0; synchronized (this) { id = ++idCounter; if (id < 0) { //idCounter wrapped around!! id = idCounter = 1; } if ((id & 0x000000FF) == 0) { cachedTime = (int) System.currentTimeMillis(); } } return new SimpleSessionKey( prefix + cachedTime, //suffix + System.identityHashCode(new Object()), id suffix + SharedSecureRandom.get().nextInt(), id ); }
/** * Create and return the sessionKey. * @return the sessionKey object */ public SimpleSessionKey createSessionKey() { int id = 0; synchronized (this) { id = ++idCounter; if (id < 0) { //idCounter wrapped around!! id = idCounter = 1; } if ((id & 0x000000FF) == 0) { cachedTime = (int) System.currentTimeMillis(); } } return new SimpleSessionKey( prefix + cachedTime, //suffix + System.identityHashCode(new Object()), id suffix + SharedSecureRandom.get().nextInt(), id ); }
/** * Create the SSL socket factory. Initialize the key managers and * trust managers which are passed to the SSL context. */ public SSLSocketFactory () { try { if(keyManagers == null || trustManagers == null) { initStoresAtStartup(); } context = SSLContext.getInstance("TLS"); context.init(keyManagers, trustManagers, SharedSecureRandom.get()); factory = context.getServerSocketFactory(); cipherSuites = factory.getSupportedCipherSuites(); for(int i=0; i < cipherSuites.length; ++i) { if (_logger.isLoggable(Level.FINEST)) { _logger.log(Level.FINEST,"Suite: " + cipherSuites[i]); } } } catch(Exception e) { _logger.log(Level.SEVERE, "web_security.excep_sslsockfact", e.getMessage()); } }
public CustomSocketFactory() { SSLUtils sslUtils = Globals.getDefaultHabitat().getService(SSLUtils.class); SSLContext sc = null; try { sc = SSLContext.getInstance(SSL); sc.init(sslUtils.getKeyManagers(), sslUtils.getTrustManagers(), SharedSecureRandom.get()); socketFactory = sc.getSocketFactory(); } catch (Exception ex) { _logger.log(Level.WARNING, SecurityLoggerInfo.securityExceptionError, ex); } }
public CustomSocketFactory() { Habitat habitat = Globals.getDefaultHabitat(); SSLUtils sslUtils = habitat.getComponent(SSLUtils.class); SSLContext sc = null; try { sc = SSLContext.getInstance(SSL); sc.init(sslUtils.getKeyManagers(), sslUtils.getTrustManagers(), SharedSecureRandom.get()); } catch (Exception ex) { _logger.log(Level.WARNING, "security.exception", ex); } socketFactory = sc.getSocketFactory(); }
SecureRandom rng=SharedSecureRandom.get(); byte[] salt=new byte[SALT_SIZE]; rng.nextBytes(salt);