Package unibg.overencrypt.client.view

Examples of unibg.overencrypt.client.view.IndefiniteProgressDialog


      }
    }
    if(pinConfirmed){

      JFrame frame = new JFrame();
      IndefiniteProgressDialog inst = new IndefiniteProgressDialog(frame, "Diffie Hellman Key Agreement", "Waiting for server response...", new DHKeyAgreementManager().new CancelListener(frame));
      inst.setVisible(true);

      //Diffie Hellman key pairs generation
      String tempFilePath = ClientConfiguration.getLOCAL_PRIVATE_RESOURCES_PATH() + "/dhkeys.txt";

      dhKeyPairsCreation(tempFilePath, String.valueOf(pinField.getPassword()));
View Full Code Here


    }
    String fileName = fileChooser.getSelectedFile().getName();
    String realFilePath = fileChooser.getSelectedFile().getParent();

    JFrame frame = new JFrame();
    IndefiniteProgressDialog inpd = new IndefiniteProgressDialog(frame, "File encryption process", "Encrypting file...", new CancelListener(frame));
    inpd.setVisible(true);

    inpd.setMessage("Retrieve local resources...");
    LocalPrivateResource localPrivateResource = new LocalPrivateResource();
    try {
      passphrase = localPrivateResource.retrieveValue("UserInfo.pin");
      userId = localPrivateResource.retrieveValue("UserInfo.userId");
    } catch (Exception e) {
      LOGGER.error("Error while retrieving user id from local private file - " + e.getMessage());
    }

    inpd.setMessage("Retrieve token resource...");
    LOGGER.debug("filePath: " + filePath);
    boolean requestDone = OverEncryptRequest.generateRequest(ClientPrimitives.OE_UPLMANAGER_FILE, OverEncryptRequestType.LOCK, userId, filePath, "", userId);
    if (requestDone) {
      String[] returnedValues = ResponseManager.retrieveCommunication(filePath, ServerPrimitives.OE_LOCK, "value");       
      LOGGER.debug("returned values [0]: " + returnedValues[0]);
      if (!Boolean.parseBoolean(returnedValues[0])) {
        JOptionPane.showMessageDialog(null, "The folder is locked. Please, retry later", "Locked", JOptionPane.INFORMATION_MESSAGE);
        System.exit(0);
      }
    }
   
    TokensResource token = new TokensResource(filePath.substring(0, filePath.lastIndexOf("/")));
    TokenStruct tokenStruct = token.getTokens(filePath.substring(filePath.lastIndexOf("/") + 1));
    aclBEL = ClientTokensManager.getACLsFromToken(filePath, OperationType.DOWNLOAD, tokenStruct, inpd)[0];
    inpd.setVisible(true);

    inpd.setMessage("Starting upload file process..");
    // creating uploadManager for the current user
    if(UploadManager.initUploadFile(filePath, aclBEL, userId)){
      ResponseManager.retrieveCommunication(filePath, ServerPrimitives.OE_SUCCESSFUL);
    }

    inpd.setMessage("DSA generation...");
    //Generazione del file DSAKey.txt
    String dsaFileName = DSARetriever.getDSA(filePath, userId, userId, true);

    String aesFileName = ClientTokensManager.getAESKeyFromToken(filePath, tokenStruct, aclBEL, "BEL", true, inpd);

    String command[] = {
        ClientConfiguration.getEXECUTABLES_PATH() + "/wpes2_linux",
        "eBEL",
        ClientConfiguration.getLOCAL_PRIVATE_RESOURCES_PATH() + "/" + dsaFileName,
        ClientConfiguration.getLOCAL_PRIVATE_RESOURCES_PATH() + "/" + aesFileName,
        realFilePath + "/" + fileName,
        ClientConfiguration.getLOCAL_TMP_PATH() + "/" + fileName,
        passphrase
    };
    RunnerExecutables.execute(command);
   
    if(ClientConfiguration.debug)
      JOptionPane.showMessageDialog(null, "salva la chiave BEL di cifratura");
   
    String localFilePath = ClientConfiguration.getLOCAL_TMP_PATH() + "/" + fileName;
   
    WebDAVClientManager.uploadFileIntoWebDAV(localFilePath, filePath + "/" + fileName);

    LOGGER.debug("File uploaded to server.");

    File fileEncryptedBEL = new File(localFilePath);
    fileEncryptedBEL.delete();

    LOGGER.debug("Local file deleted");

    String[] splitted = aclBEL.split("-");
    String users = "";
    for (int i = 0; i < splitted.length; i++) {
      if(!splitted[i].equals(userId)){
        users += splitted[i];
      }
    }
    users = userId + "," + users;
    if(ClientConfiguration.debug)
      JOptionPane.showMessageDialog(null, "users to encrypt SEL Level: " + users);
    if(tokenStruct.hasSEL) {
      if(UploadManager.encryptSEL(filePath, userId, fileName, users)) {
        inpd.setMessage("Encryption SEL started...");
        ResponseManager.retrieveCommunication(filePath, ServerPrimitives.OE_SUCCESSFUL);
      }
    }
    OverEncryptRequest.generateRequest(ClientPrimitives.OE_ENCRYPT_SEL, OverEncryptRequestType.UNLOCK, userId, filePath);
    inpd.dispose();
   
    //TODO
    //Aggiornare i riferimenti alle risorse condivise e i permessi agli utenti relative
    //TODO
    if(ClientConfiguration.debug)
View Full Code Here

    folderName = folderField.getText();
    hasSEL = hasSELBox.isSelected();

    JFrame frame = new JFrame();
    IndefiniteProgressDialog inpd = new IndefiniteProgressDialog(frame, "Creating new folder...", "Retrieving your friends...", new CancelListener(frame));
    LocalPrivateResource localPrivateResource = new LocalPrivateResource();
    try {
      owner = localPrivateResource.retrieveValue("UserInfo.userId");
      passphrase = localPrivateResource.retrieveValue("UserInfo.pin");
    } catch (Exception e) {
      LOGGER.error("Error while retrieving user id from local private file - " + e.getMessage());
    }

    Finder.showFinder(folderPath, owner, null, OperationType.UPLOAD);
    inpd.dispose();
  }
View Full Code Here

  /** Logger for this class. */
  private static final Logger LOGGER = Logger.getLogger(ClientTokensManager.class);

  public static String[] getACLsFromToken(String path, OperationType type, TokenStruct token){
    JFrame frame = new JFrame();
    IndefiniteProgressDialog inpd = new IndefiniteProgressDialog(frame, new CancelListener(frame));
    switch (type) {
    case DOWNLOAD:
      inpd.setTitle("Download process");     
      break;
    case EDIT:
      inpd.setTitle("Edit permissions");
    default:
      break;
    }
    return getACLsFromToken(path, type, token, inpd);
  }
View Full Code Here

      System.exit(0);
    }
   
   
    JFrame frame = new JFrame();
    IndefiniteProgressDialog inst = new IndefiniteProgressDialog(frame, "Logout", "Wait until logout from server...", new CancelListener(frame));
    inst.setVisible(true);

    LocalPrivateResource localPrivateResource = new LocalPrivateResource();
    try {

      userId = localPrivateResource.retrieveValue("UserInfo.userId");

      localPrivateResource.delete();

      //Send .request to insert DHKeyPairs in DB at OE Server
      boolean requestDone = OverEncryptRequest.generateRequest(ClientPrimitives.OE_LOGOUT, OverEncryptRequestType.LOCK, userId, path, userId);
      LOGGER.debug("path: " + path);
      if (requestDone) {
        String[] returnedValues = ResponseManager.retrieveCommunication(path, ServerPrimitives.OE_LOCK, "value");       
        LOGGER.debug("returned values [0]: " + returnedValues[0]);
        if (!Boolean.parseBoolean(returnedValues[0])) {
          inst.dispose();
          JOptionPane.showMessageDialog(null, "The folder is locked. Please, retry later", "Locked", JOptionPane.INFORMATION_MESSAGE);
          System.exit(0);
        }
      }

     
      if(OverEncryptRequest.generateRequest(ClientPrimitives.OE_LOGOUT, OverEncryptRequestType.CONTINUE, userId, path, userId)) {
        ResponseManager.retrieveCommunication(path, ServerPrimitives.OE_SUCCESSFUL);
      }
      OverEncryptRequest.generateRequest(ClientPrimitives.OE_LOGOUT, OverEncryptRequestType.UNLOCK, userId, path);

      inst.dispose();
      JOptionPane.showMessageDialog(null, "Please unmount WebDAV volume", "Logout", JOptionPane.INFORMATION_MESSAGE);

    } catch (Exception e) {
      LOGGER.error("Error while retrieving user id from local private file - ",e);
    }
View Full Code Here

    Object[] obj = {"Insert pass phrase:", pinField};

    if (JOptionPane.showOptionDialog(null, obj, realm, JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null) == JOptionPane.OK_OPTION) {

      JFrame frame = new JFrame();
      IndefiniteProgressDialog inst = new IndefiniteProgressDialog(frame, "Passphrase check", "Waiting for server response...", new CancelListener(frame));
      inst.setVisible(true);

      pin = String.valueOf(pinField.getPassword());

      //generating double hash of pin
      hashPin = SecurityAlgorithms.md5(SecurityAlgorithms.md5(pin));
      LOGGER.debug("hashPin value: " + hashPin);
      inst.setMessage("before generate request");
      boolean requestDone = OverEncryptRequest.generateRequest(ClientPrimitives.OE_PASSPHRASE, OverEncryptRequestType.LOCK, userId, path);
      if (requestDone) {
        String[] returnedValues = ResponseManager.retrieveCommunication(path, ServerPrimitives.OE_LOCK, "value");       
        LOGGER.debug("returned values [0]: " + returnedValues[0]);
        if (!Boolean.parseBoolean(returnedValues[0])) {
          JOptionPane.showMessageDialog(null, "The folder is locked. Please, retry later", "Locked", JOptionPane.INFORMATION_MESSAGE);
          System.exit(0);
        }
      }
     
      requestDone = OverEncryptRequest.generateRequest(ClientPrimitives.OE_PASSPHRASE, OverEncryptRequestType.CONTINUE, userId, path, hashPin, userId);
      inst.setMessage("after generate request");

      if(requestDone){
        inst.setMessage("request done");
        String[] returnedValues;
        //returnedValues = ResponseManager.retrieveCommunication(path, ServerPrimitives.OE_UPDATE_USER,"friends","msg");
        returnedValues = ResponseManager.retrieveCommunication(path, ServerPrimitives.OE_UPDATE_ALL_PERMS, "friends", "userInfos", "friendsInfos");

        inst.setMessage("Your passphrase is correct");

        LOGGER.debug("lpr started");
        LocalPrivateResource lpr = new LocalPrivateResource();
        String[] keys = {"pin", "userId"};
        String[] values = {pin, userId};
View Full Code Here

    //Reset private local fields
    userID = "";

    //Start message dialog
    JFrame frame = new JFrame();
    inpd = new IndefiniteProgressDialog(frame, "Dowload file: " + fileName, "Retrieving decryption BEL and SEL keys...", new CancelListener(frame));
    inpd.setVisible(true);

   
    //Retrieve user id from local resource
    LocalPrivateResource localPrivateResource = new LocalPrivateResource();
View Full Code Here

 
  @SuppressWarnings("static-access")
  public static void updatePermissionsManager(String path, String friends, String infos){
    String result = "";
    JFrame frame = new JFrame();
    IndefiniteProgressDialog inst = new IndefiniteProgressDialog(frame, "Update permissions", "Retrieving your permissions...", new CancelListener(frame));
    inst.setVisible(true);

    //Divide infos in relative json object
    String[] jsons = infos.split("---");

    LOGGER.debug("infos: " + infos);

    LOGGER.debug("jsons messages received: " + jsons.length);
    for (int i = 0; i < jsons.length; i++) {
      LOGGER.debug("jsons[" + i + "]: " + jsons[i]);
    }

    //Retrieve user session pin
    LocalPrivateResource lpr = new LocalPrivateResource();
    String userId = "";
    String userPin = "";
    try {
      userId = lpr.retrieveValue("UserInfo.userId");
      userPin = lpr.retrieveValue("UserInfo.pin");
    } catch (Exception e) {
      LOGGER.error("Error while retrieving user pin from local private file",e);
    }

    //Temp file path
    String tempFilePathIn = "cryptedInfo.txt";
    String tempFilePathOut = "decryptedPermissionsInfo.txt";

    //Iterate over splitted jsons
    for (int j = 0; j < jsons.length; j++) {

      FileSystemUtils.writePrivateFile(tempFilePathIn, jsons[j]);

      //Send command executable
      updatePermissions(tempFilePathIn, tempFilePathOut,userPin);

      try {
        Thread.sleep(2000);
      } catch (InterruptedException e) {
        LOGGER.error("Error while sleeping thread",e);
      }
     
      //Extratct executable result form out temp file
      if(j != 0) result += "---";
      result += FileSystemUtils.readPrivateFile(tempFilePathOut);
    }

    LOGGER.debug("result: " +result);
   
    //Send request to server and don't wait for response 
    OverEncryptRequest.generateRequest(ClientPrimitives.OE_UPLOAD_PERMS, OverEncryptRequestType.CONTINUE, userId, path, userId, friends, result);
   
    FileSystemUtils.deletePrivateFile();
   
    inst.setMessage("Permissions updated correctly.");
    try {
      Thread.currentThread().sleep(1000);
    } catch (InterruptedException e) {
      LOGGER.error("Error while sleeping OE client",e);
    }
    inst.dispose();
  }
View Full Code Here

 
  private static ArrayList<String> users = new ArrayList<String>();
 
  public static void generateProperties(String path, String folderName) {
    JFrame frame = new JFrame();
    IndefiniteProgressDialog inpd = new IndefiniteProgressDialog(frame, "Properties", "Retrive properties...", new CancelListener(frame));
   
    if(OverEncryptRequest.generateRequest(ClientPrimitives.OE_GET_USERNAMES, OverEncryptRequestType.LOCK, owner, path)) {
      String[] returnedValues = ResponseManager.retrieveCommunication(path, ServerPrimitives.OE_LOCK, "value");       
      LOGGER.debug("returned values [0]: " + returnedValues[0]);
      if (!Boolean.parseBoolean(returnedValues[0])) {
View Full Code Here

      return;
    }
   
    //Start message dialog
    JFrame frame = new JFrame();
    inpd = new IndefiniteProgressDialog(frame, "Deleting folder", "Your folder will be deleted...", new CancelListener(frame));
    inpd.setMessage("Retrieve local resources...");
    LocalPrivateResource localPrivateResource = new LocalPrivateResource();
    try {
      userId = localPrivateResource.retrieveValue("UserInfo.userId");
      passphrase = localPrivateResource.retrieveValue("UserInfo.pin");
View Full Code Here

TOP

Related Classes of unibg.overencrypt.client.view.IndefiniteProgressDialog

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.