Skip to main content
IBM  
Shop Support Downloads
IBM Home Products Consulting Industries News About IBM
IBM developerWorks : Java : Education - Tutorials
Using JSSE for secure socket communication
ZIPPDF (letter)PDF (A4)e-mail
Main menuSection menuFeedbackPreviousNext
5. Using JSSE sockets
  


Creating a SecureRandom page 5 of 11


Creating a SecureRandom object is easy; just use the following lines in your code:


      secureRandom = new SecureRandom();
      secureRandom.nextInt();

The first line actually creates the SecureRandom. Creating a SecureRandom takes a lot of computation, and this computation may not be executed until it's actually used. By calling the nextInt() method here, we get the creation process going and ensure the delay will happen at the start of the program, not later when it might inconvenience us.


Main menuSection menuFeedbackPreviousNext
Privacy Legal Contact