Code example for SecureRandom

Methods: nextBytes

0
        } 
    } 
 
    public static byte[] generateSalt(int size) {
        byte[] salt = new byte[size];
        secureRandom.nextBytes(salt);
        return salt;
    } 
 
    public static String generateSaltBase64(int size) {
        byte[] salt = generateSalt(size);
        return Base64.encodeToString(salt, Base64.NO_WRAP);
    } 
}