fluid-ws-java-client/src/main/java/com/fluidbpm/ws/client/v1/user/LoginClient.java
private AppRequestToken issueAppRequestToken(
            String serviceTicketBase64Param,
            String usernameParam,
            AuthEncryptedData authEncryptDataParam)
    {
        byte[] iv = AES256Local.generateRandom(AES256Local.IV_SIZE_BYTES);
        byte[] seed = AES256Local.generateRandom(AES256Local.SEED_SIZE_BYTES);

        byte[] sessionKey = UtilGlobal.decodeBase64(
                authEncryptDataParam.getSessionKeyBase64());

        byte[] dataToEncrypt = usernameParam.getBytes();

        byte[] encryptedData = AES256Local.encrypt(
                sessionKey,
                dataToEncrypt,
                iv);

        byte[] encryptedDataHMac =
                AES256Local.generateLocalHMACForReqToken(encryptedData, sessionKey, seed);

        AppRequestToken requestToServer = new AppRequestToken();

        requestToServer.setEncryptedDataBase64(UtilGlobal.encodeBase64(encryptedData));
        requestToServer.setEncryptedDataHmacBase64(UtilGlobal.encodeBase64(encryptedDataHMac));
        requestToServer.setIvBase64(UtilGlobal.encodeBase64(iv));
        requestToServer.setSeedBase64(UtilGlobal.encodeBase64(seed));
        requestToServer.setServiceTicket(serviceTicketBase64Param);

        try {
            return new AppRequestToken(
                    this.postJson(requestToServer, WS.Path.User.Version1.userIssueToken()));
        }
        //
        catch (JSONException jsonExcept) {
            throw new FluidClientException(jsonExcept.getMessage(),
                    jsonExcept, FluidClientException.ErrorCode.JSON_PARSING);
        }
    }
private AppRequestToken issueAppRequestToken(
            String serviceTicketBase64Param,
            String usernameParam,
            AuthEncryptedData authEncryptDataParam)
    {
        byte[] iv = AES256Local.generateRandom(AES256Local.IV_SIZE_BYTES);
        byte[] seed = AES256Local.generateRandom(AES256Local.SEED_SIZE_BYTES);

        byte[] sessionKey = UtilGlobal.decodeBase64(
                authEncryptDataParam.getSessionKeyBase64());

        byte[] dataToEncrypt = usernameParam.getBytes();

        byte[] encryptedData = AES256Local.encrypt(
                sessionKey,
                dataToEncrypt,
                iv);

        byte[] encryptedDataHMac =
                AES256Local.generateLocalHMACForReqToken(encryptedData, sessionKey, seed);

        AppRequestToken requestToServer = new AppRequestToken();

        requestToServer.setEncryptedDataBase64(UtilGlobal.encodeBase64(encryptedData));
        requestToServer.setEncryptedDataHmacBase64(UtilGlobal.encodeBase64(encryptedDataHMac));
        requestToServer.setIvBase64(UtilGlobal.encodeBase64(iv));
        requestToServer.setSeedBase64(UtilGlobal.encodeBase64(seed));
        requestToServer.setServiceTicket(serviceTicketBase64Param);

        try {
            return new AppRequestToken(
                    this.postJson(requestToServer, WS.Path.User.Version1.userIssueToken()));
        }
        //
        catch (JSONException jsonExcept) {
            throw new FluidClientException(jsonExcept.getMessage(),
                    jsonExcept, FluidClientException.ErrorCode.JSON_PARSING);
        }
    }
Issue a new {@code AppRequestToken} from provided params.

@param serviceTicketBase64Param The service ticket from authentication.
@param usernameParam The users username.
@param authEncryptDataParam The encrypted packet.
@return Request Token.

@see AppRequestToken