Code example for IvParameterSpec

Methods: getIV

0
        if (params instanceof javax.crypto.spec.IvParameterSpec)
        { 
            IvParameterSpec iv = (IvParameterSpec) params;
            param = new ParametersWithIV(param, iv.getIV());
        } 
 
        if (param instanceof KeyParameter && ivSize != 0)
        { 
            iv = new byte[ivSize];
            random.nextBytes(iv);
            param = new ParametersWithIV(param, iv);
        } 
 
        switch (opmode)
        { 
        case Cipher.WRAP_MODE:
            wrapEngine.init(true, param);
            break; 
        case Cipher.UNWRAP_MODE:
            wrapEngine.init(false, param);
            break;