Code example for SecureRandom

0
    { 
        try 
        { 
            // BEGIN android-added 
            if (random == null) {
                random = new SecureRandom();
            } 
            // END android-added 
            engine.init(new KeyGenerationParameters(random, keySize));
            uninitialised = false;
        } 
        catch (IllegalArgumentException e)
        { 
            throw new InvalidParameterException(e.getMessage());
        } 
    } 
 
    protected SecretKey engineGenerateKey()
    { 
        if (uninitialised)
        {