Code example for SecureRandom

Methods: generateSeednextBytes

0
	 * @return 
	 */ 
	public byte[] generateInitializationVector(){ 
        if(iVectorGenerator == null) {
            log.debug("new securerandom"); 
            iVectorGenerator = new SecureRandom();
            log.debug("generating seed"); 
            iVectorGenerator.generateSeed(IV_SIZE);
        } 
		byte buff[] = new byte[IV_SIZE];
		iVectorGenerator.nextBytes(buff);
		return(buff);
	} 
	 
    /** 
     * Generates and returns a new random 128-bit AES key 
     * @return 
     */ 
    public Key generateKey() throws NoSuchAlgorithmException{
    	Key key = null;