fluid-ws-java-client/src/main/java/com/fluidbpm/ws/client/v1/user/LoginClient.java
private AuthEncryptedData initializeSession(
            String passwordParam,
            AuthResponse authResponseParam) {
        
        //IV...
        byte[] ivBytes = UtilGlobal.decodeBase64(
                authResponseParam.getIvBase64());

        //Seed...
        byte[] seedBytes = UtilGlobal.decodeBase64(
                authResponseParam.getSeedBase64());

        //Encrypted Data...
        byte[] encryptedData = UtilGlobal.decodeBase64(
                authResponseParam.getEncryptedDataBase64());

        //HMac from Response...
        byte[] hMacFromResponse = UtilGlobal.decodeBase64(
                authResponseParam.getEncryptedDataHmacBase64());

        //Local HMac...
        byte[] localGeneratedHMac = AES256Local.generateLocalHMAC(
                encryptedData, passwordParam, authResponseParam.getSalt(), seedBytes);

        //Password mismatch...
        if (!Arrays.equals(hMacFromResponse, localGeneratedHMac)) {
            throw new FluidClientException(
                    "Login attempt failure.",
                    FluidClientException.ErrorCode.LOGIN_FAILURE);
        }

        //Decrypted Initialization Data...
        byte[] decryptedEncryptedData =
                AES256Local.decryptInitPacket(encryptedData,
                        passwordParam,
                        authResponseParam.getSalt(),
                        ivBytes,
                        seedBytes);

        try {
            
            JSONObject jsonObj = new JSONObject(new String(decryptedEncryptedData));

            return new AuthEncryptedData(jsonObj);
        }
        catch (JSONException jsonExcept) {

            throw new FluidClientException(jsonExcept.getMessage(),
                    FluidClientException.ErrorCode.JSON_PARSING);
        }
    }
private AuthEncryptedData initializeSession(
            String passwordParam,
            AuthResponse authResponseParam) {
        
        //IV...
        byte[] ivBytes = UtilGlobal.decodeBase64(
                authResponseParam.getIvBase64());

        //Seed...
        byte[] seedBytes = UtilGlobal.decodeBase64(
                authResponseParam.getSeedBase64());

        //Encrypted Data...
        byte[] encryptedData = UtilGlobal.decodeBase64(
                authResponseParam.getEncryptedDataBase64());

        //HMac from Response...
        byte[] hMacFromResponse = UtilGlobal.decodeBase64(
                authResponseParam.getEncryptedDataHmacBase64());

        //Local HMac...
        byte[] localGeneratedHMac = AES256Local.generateLocalHMAC(
                encryptedData, passwordParam, authResponseParam.getSalt(), seedBytes);

        //Password mismatch...
        if (!Arrays.equals(hMacFromResponse, localGeneratedHMac)) {
            throw new FluidClientException(
                    "Login attempt failure.",
                    FluidClientException.ErrorCode.LOGIN_FAILURE);
        }

        //Decrypted Initialization Data...
        byte[] decryptedEncryptedData =
                AES256Local.decryptInitPacket(encryptedData,
                        passwordParam,
                        authResponseParam.getSalt(),
                        ivBytes,
                        seedBytes);

        try {
            
            JSONObject jsonObj = new JSONObject(new String(decryptedEncryptedData));

            return new AuthEncryptedData(jsonObj);
        }
        catch (JSONException jsonExcept) {

            throw new FluidClientException(jsonExcept.getMessage(),
                    FluidClientException.ErrorCode.JSON_PARSING);
        }
    }
Performs HMAC and encryption to initialize the session.

@param passwordParam The user password in the clear.
@param authResponseParam Response of the initial authentication request (handshake).
@return Authenticated encrypted data.