Advertisement
Guest User

Untitled

a guest
Jan 19th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. public EncryptionApp(String args[]) {
  2. if (args.length != 4) {
  3. JOptionPane.showMessageDialog(null, "Arguments error");
  4. System.exit(0);
  5. }
  6.  
  7. if (args[0].equalsIgnoreCase("") || args[1].equalsIgnoreCase("") || args[2].equalsIgnoreCase("") || args[3].equalsIgnoreCase("")) {
  8. JOptionPane.showMessageDialog(null, "Arguments cannot be empty");
  9. System.exit(0);
  10. }
  11.  
  12. if (args[2].length() != 16) {
  13. JOptionPane.showMessageDialog(null, "Encryption key not valid");
  14. System.exit(0);
  15. }
  16.  
  17. inputPath = args[0];
  18. databasePath = args[1];
  19. encryptionKey = args[2];
  20. outputPath = args[3];
  21.  
  22. if (!inputPath.endsWith("/")) {
  23. inputPath += "/";
  24. }
  25.  
  26. if (!outputPath.endsWith("/")) {
  27. outputPath += "/";
  28. }
  29.  
  30. initComponents();
  31.  
  32. this.setLocationRelativeTo(null);
  33.  
  34. ctrl = new Controller(databasePath);
  35. try {
  36. ctrl.populateStorage(inputPath);
  37. } catch (Exception e) {
  38. System.out.println(e.getMessage());
  39. JOptionPane.showMessageDialog(null, e.getMessage());
  40. System.exit(0);
  41. }
  42.  
  43. storage = ctrl.decryptStorage();
  44.  
  45. fileHelpers = new FileHelpers();
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement