Package unibg.overencrypt.utility

Examples of unibg.overencrypt.utility.Executable


        // Save viewInfos in a temp files
        FileSystemUtils.writePrivateFile("viewInfos.txt", viewInfos);

        // Decrypt acl informations
        Executable exec = new Executable("wpes1_linux");
        exec.add("dACL");
        exec.add(token.getEncryptedAclBEL());
        exec.add(token.getEncryptedAclSEL());
        // Tested with token.folderIDGraph and doesn't work.
        exec.add(token.getFolderIdDB());
        exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH + "/viewInfos.txt");
        exec.add(passphrase);
        exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH + "/aclBEL.txt");
        exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH + "/aclSEL.txt");
        exec.run();

        String decryptedAclBEL = FileSystemUtils.readPrivateFile("aclBEL.txt");
        String decryptedAclSEL = FileSystemUtils.readPrivateFile("aclSEL.txt");

        FileSystemUtils.deletePrivateFiles();
View Full Code Here


            String json = client.sendAndWait(ClientPrimitives.OE_JSON_UPLOAD,
                    folderPath, userID, "", String.valueOf(true)).getValue(
                    "json");
            FileSystemUtils.writePrivateFile("json.txt", json);

            Executable exec = new Executable("wpes1_linux");
            exec.add("new1");
            exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH + "/json.txt");
            exec.add(passphrase);
            exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH + "/AESKey.txt");
            exec.add(token.getFolderIdGraph());
            exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH + "/next.txt");
            exec.add(acl);
            exec.run();
        } else {
            String tokenID = client
                    .sendAndWait(ClientPrimitives.OE_GET_INFO, folderPath, acl,
                            encryptionLevel, token.getOwnerID(), userID,
                            token.getFolderIdGraph()).getValue("tokenID")
                    .trim();

            if ("BEL".equals(encryptionLevel)) {
                updateToken(token.getOwnerID(), passphrase, acl);
            }

            String nextToken = "";
            boolean finished = true;
            int i = 1;
            do {
                boolean firstStep = (i == 1);

                String json = client.sendAndWait(
                        ClientPrimitives.OE_CREATE_JSON_DL, folderPath,
                        Boolean.toString(firstStep), nextToken, userID)
                        .getValue("json");

                FileSystemUtils.writePrivateFile("Json.txt", json);

                // Decrypt acl informations
                Executable exec = new Executable("wpes1_linux");
                exec.add(firstStep ? "dec1" : "decn");
                exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH
                        + "/Json.txt");
                exec.add(firstStep ? passphrase
                        : Configuration.LOCAL_PRIVATE_RESOURCES_PATH
                                + "/AESKey.txt");
                exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH
                        + "/AESKey.txt");
                exec.add(tokenID);
                exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH
                        + "/nextToken.txt");
                exec.run();

                nextToken = FileSystemUtils.readPrivateFile("nextToken.txt");

                FileSystemUtils.deletePrivateFile("Json.txt");
View Full Code Here

                        FileSystemUtils.writePrivateFile("Json.txt", jsonUp);
                    }

                    firstStepUpdate = false;

                    Executable exec = new Executable("wpes1_linux");
                    exec.add(firstStepUpdate ? "upd1" : "unpdn");
                    exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH
                            + "/Json.txt");
                    exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH
                            + "/Note.txt");
                    if (firstStepUpdate) {
                        exec.add(passphrase);
                    }
                    exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH
                            + "/AesKey.txt");
                    if (!firstStepUpdate) {
                        exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH
                                + "/AesKey.txt");
                    }
                    exec.add(destId);
                    exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH
                            + "/next.txt");
                    if (!firstStepUpdate) {
                        exec.add(passphrase);
                    }
                    exec.add(acl);
                    exec.run();

                    nextToken = FileSystemUtils.readPrivateFile("next.txt");
                    String jsonOut = FileSystemUtils
                            .readPrivateFile("Noteout.txt");

                    finishedUpdateToken = client.sendAndWait(
                            ClientPrimitives.OE_PUT_UPDATE_TOKEN, folderPath,
                            owner, jsonOut, nextToken).getValue(
                            "finishedUpdateToken");
                } while ("false".equals(finishedUpdateToken));

                currentEmpty = Boolean.valueOf(client.sendAndWait(
                        ClientPrimitives.OE_CURR, folderPath, owner).getValue(
                        "currEmpty"));
            }

            String nextTokenLast = "{\"next_token\":\"" + acl + "\"}";
            boolean stepLast = false;
            String jsonUpLast = client.sendAndWait(
                    ClientPrimitives.OE_JSON_UPDATE, folderPath, owner,
                    nextTokenLast, String.valueOf(stepLast)).getValue("jsonUp");

            FileSystemUtils.writePrivateFile("JsonLast.txt", jsonUpLast);

            Executable exec = new Executable("wpes1_linux");
            exec.add("updL");
            exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH
                    + "/JsonLast.txt");
            exec.add(passphrase);
            exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH + "/AesKey.txt");
            exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH + "/Note.txt");
            exec.add(acl);
            exec.run();

            String jsonOut = FileSystemUtils.readPrivateFile("Noteout.txt");

            client.sendAndWait(ClientPrimitives.OE_TOKEN, folderPath, owner,
                    jsonOut);
View Full Code Here

        String dsaFileName = "DSAKey.txt";
        FileSystemUtils.writePrivateFile(dsaFileName, dsaKey);

        logger.debug(destinationPath);

        Executable exec = new Executable("wpes2_linux");
        if (token.hasSEL()) {
            exec.add("dSELBEL");
        } else {
            exec.add("dBEL");
        }
        exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH + "/"
                + dsaFileName);
        exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH + "/"
                + aesBELFileName);
        if (token.hasSEL()) {
            exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH + "/"
                    + tokenFile.getAESKey(folderName, aclSEL, "SEL", false));
        }
        exec.add(tempEncryptedFilePath);

        logger.debug(destinationPath);

        exec.add(destinationPath);
        exec.run();

        logger.debug(exec.toString());

        // FileSystemUtils.deletePrivateFiles();
        // FileSystemUtils.deleteAllTempPrivateResources();

        System.out.println("[OK] File downloaded successfully.");
View Full Code Here

        FileSystemUtils.writePrivateFile(dsaFileName, dsaKey);

        String aesFileName = tokenFile.getAESKey(remoteFolderName, aclBEL,
                "BEL", true);

        Executable exec = new Executable("wpes2_linux");
        exec.add("eBEL");
        exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH + "/" + dsaFileName);
        exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH + "/" + aesFileName);
        exec.add(localFolder + "/" + fileName);
        exec.add(Configuration.LOCAL_TMP_PATH + "/" + fileName);
        exec.add(passphrase);
        exec.run();

        String localFilePath = Configuration.LOCAL_TMP_PATH + "/" + fileName;

        WebDAVClient davClient = new ApacheWebDAVClient();
        davClient.upload(localFilePath, remoteFolder + fileName);
View Full Code Here

                        .getValue("tokenHBEL");

                // HBEL Tokens creation
                FileSystemUtils.writePrivateFile("json.txt", tokenHBEL);

                Executable exec = new Executable("wpes1_linux");
                exec.add("h");
                exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH + "/"
                        + aesKeyBEL);
                exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH
                        + "/json.txt");
                exec.add(acl);
                exec.add(idToken);
                exec.add(passphrase);
                exec.run();

                String jsonout = FileSystemUtils.readPrivateFile("jsonout.txt");

                // Put new tokens HBEL in server DB
                hasMoreTokens = Boolean.valueOf(client.sendAndWait(
                        ClientPrimitives.OE_PUT_TOKEN_HBEL, path, userId,
                        jsonout).getValue("hasMoreTokens"));

                FileSystemUtils.deletePrivateFile("jsonout.txt");
            }
            // End HBEL tokens creation

            FileSystemUtils.deletePrivateFiles();

            // Update View Informations for added and deleted users
            if (!addUser.isEmpty()) {
                json = client.sendAndWait(ClientPrimitives.OE_VIEW_INFO, path,
                        userId, (userId + "-" + addUser), String.valueOf(true))
                        .getValue("json");
                FileSystemUtils.writePrivateFile("json.txt", json);

                Executable exec = new Executable("wpes1_linux");
                exec.add("addID");
                exec.add(folderIdDB);
                exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH
                        + "/json.txt");
                exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH
                        + "/jsonout.txt");
                exec.add(passphrase);
                exec.add(userId);
                exec.run();

                jsout = FileSystemUtils.readPrivateFile("jsonout.txt");

                client.sendAndWait(ClientPrimitives.OE_SET_VIEW, path, jsout);

                FileSystemUtils.deletePrivateFiles();
            }

            if (!delUser.isEmpty()) {
                json = client.sendAndWait(ClientPrimitives.OE_VIEW_INFO, path,
                        userId, delUser, String.valueOf(true)).getValue("json");
                FileSystemUtils.writePrivateFile("json.txt", json);

                Executable exec = new Executable("wpes1_linux");
                exec.add("remID");
                exec.add(folderIdDB);
                exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH
                        + "/json.txt");
                exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH
                        + "/jsonout.txt");
                exec.add(passphrase);
                exec.run();
                jsout = FileSystemUtils.readFile("jsonout.txt");

                client.sendAndWait(ClientPrimitives.OE_SET_VIEW, path, jsout);
                FileSystemUtils.deletePrivateFiles();
            }

            // If has SEL level decrypt and re-encrypt at SEL Level
            client.sendAndWait(ClientPrimitives.OE_SEL_REQ, path, folderName,
                    folderIdDB, userId, users, aclSEL,
                    Boolean.toString(token.hasSEL()));

            // Retrieve ViewInformations to encrypt acl to put into server db
            String viewInfos = client.sendAndWait(
                    ClientPrimitives.OE_VIEW_INFO, path, userId, userId,
                    String.valueOf(true)).getValue("json");

            FileSystemUtils.writePrivateFile("viewInfos.txt", viewInfos);

            Executable exec = new Executable("wpes1_linux");
            exec.add("eACLsel");
            exec.add(folderIdDB);
            exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH
                    + "/viewInfos.txt");
            exec.add(passphrase);
            exec.add("0-" + newSEL);
            exec.add(Configuration.LOCAL_PRIVATE_RESOURCES_PATH + "/aclSEL.txt");
            exec.run();

            String newEncryptedAclSEL = FileSystemUtils
                    .readPrivateFile("aclSEL.txt");

            // SAVE IN .tokens
View Full Code Here

TOP

Related Classes of unibg.overencrypt.utility.Executable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.