kdf.generateBytes(K, 0, K.length);
System.arraycopy(K, 0, K1, 0, K1.length);
System.arraycopy(K, K1.length, K2, 0, K2.length);
cipher.init(false, new KeyParameter(K1));
M = new byte[cipher.getOutputSize(inLen - V.length - mac.getMacSize())];
len = cipher.processBytes(in_enc, inOff + V.length, inLen - V.length - mac.getMacSize(), M, 0);
len += cipher.doFinal(M, len);
}
// Convert the length of the encoding vector into a byte array.
byte[] P2 = param.getEncodingV();
byte[] L2 = new byte[4];
if (V.length != 0 && P2 != null)
{
Pack.intToBigEndian(P2.length * 8, L2, 0);
}
// Verify the MAC.
int end = inOff + inLen;
byte[] T1 = Arrays.copyOfRange(in_enc, end - mac.getMacSize(), end);
byte[] T2 = new byte[T1.length];
mac.init(new KeyParameter(K2));
mac.update(in_enc, inOff + V.length, inLen - V.length - T2.length);
if (P2 != null)
{
mac.update(P2, 0, P2.length);