コード例 #1
0
ファイル: XTSAES.java プロジェクト: vananother/Tugas1Kripto
 public byte[] xtsBlockDecrypt(byte[] cipher, int j) {
   byte[] cc = xor(cipher, tTable[j]);
   aes.setKey(key1);
   byte[] pp = aes.decrypt(cc);
   byte[] pj = xor(pp, tTable[j]);
   return pj;
 }
コード例 #2
0
ファイル: XTSAES.java プロジェクト: vananother/Tugas1Kripto
 public byte[] xtsBlockEncrypt(byte[] plain, int j) {
   byte[] pp = xor(plain, tTable[j]);
   aes.setKey(key1);
   byte[] cc = aes.encrypt(pp);
   byte[] cj = xor(cc, tTable[j]);
   return cj;
 }
コード例 #3
0
 public static byte[] decrypt(final byte[] data, final String password) {
   return AES.decrypt(
       data,
       password,
       AES.getSimpleSalt(),
       AES.getSimpleIV(),
       AES.KEY_SIZE_DEFAULT,
       AES.ITERATION_COUNT_DEFAULT);
 }
コード例 #4
0
 public static byte[] encrypt(final byte[] data) {
   return AES.encrypt(
       data,
       AES.getSimplePassword(),
       AES.getSimpleSalt(),
       AES.getSimpleIV(),
       AES.KEY_SIZE_DEFAULT,
       AES.ITERATION_COUNT_DEFAULT);
 }
コード例 #5
0
ファイル: XTSAES.java プロジェクト: vananother/Tugas1Kripto
 public void start() {
   try {
     System.out.println(0x100);
     // key
     FileReader fr = new FileReader(k);
     BufferedReader buff = new BufferedReader(fr);
     String temp = buff.readLine();
     key1 = temp.substring(0, 16).getBytes();
     key2 = temp.substring(16, 32).getBytes();
     aes.setKey(key2);
     String input = "";
     // input
     fr = new FileReader(i);
     buff = new BufferedReader(fr);
     temp = buff.readLine();
     if (temp != null) {
       input = temp;
     }
     while ((temp = buff.readLine()) != null) {
       input = input + "\r" + temp;
     }
     System.out.println(input);
     plain = input.getBytes();
     plainBlock = new byte[(int) Math.ceil(plain.length / 16)][16];
     for (int i = 0; i < plainBlock.length; i++) {
       System.arraycopy(plain, 16 * i, plainBlock[i], 0, 16);
     }
     for (int i = 0; i < plain.length; i++) {
       System.out.print(plain[i] + " ");
     }
     System.out.println();
     for (int i = 0; i < plainBlock.length; i++) {
       for (int j = 0; j < plainBlock[i].length; j++) {
         System.out.print(plainBlock[i][j] + " ");
       }
       System.out.println();
     }
     tTable = new byte[plainBlock.length][16];
     tweakAfterEncrypt = aes.encrypt(tweak);
     fillTTable();
     // output
     FileWriter fw = new FileWriter(o);
     BufferedWriter bw = new BufferedWriter(fw);
     for (int i = 0; i < plainBlock.length - 2; i++) {
       xtsBlockEncrypt(plain, i);
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
コード例 #6
0
 public static String encrypt(
     final String text, final String password, final byte[] salt, final byte[] iv) {
   final byte[] data = CryptoHelper.getRawBytes(text);
   final byte[] encryptedData =
       AES.encrypt(data, password, salt, iv, AES.KEY_SIZE_DEFAULT, AES.ITERATION_COUNT_DEFAULT);
   return CryptoHelper.base64Encode(encryptedData);
 }
コード例 #7
0
 public static byte[] encrypt(
     final byte[] data,
     final String password,
     final byte[] salt,
     final byte[] iv,
     final int keySize) {
   return AES.encrypt(data, password, salt, iv, keySize, AES.ITERATION_COUNT_DEFAULT);
 }
コード例 #8
0
ファイル: AESTest.java プロジェクト: freeroy/dw-commons-codec
  @Test
  public void test()
      throws NoSuchAlgorithmException, InvalidKeyException, NoSuchPaddingException,
          IllegalBlockSizeException, BadPaddingException, InvalidKeySpecException,
          UnsupportedEncodingException, InvalidAlgorithmParameterException {
    String data1 = "阿迪是发送发达撒地方";
    String key = "ABCDABCDABCDABCD12";

    System.out.println("原数据为:" + data1);
    System.out.println("密匙为:" + key);

    String data2 = AES.encrypt(key, data1, AES.ALGORITHM_ECB);
    System.out.println("加密后数据为:" + data2);

    String data3 = AES.decrypt(key, data2, AES.ALGORITHM_ECB);
    System.out.println("解密后数据为:" + data3);
    Assert.assertEquals(data1, data3);
  }
コード例 #9
0
 public static byte[] encrypt(
     final byte[] data,
     final String password,
     final byte[] salt,
     final byte[] iv,
     final int keySize,
     final int iterationCount) {
   return AES.process(data, Cipher.ENCRYPT_MODE, password, salt, iv, keySize, iterationCount);
 }
コード例 #10
0
 public void run() {
   while (true) {
     try {
       String msg = streamIn.readUTF();
       client.handle(AES.decrypt(msg, enc_key));
     } catch (IOException ioe) {
       JOptionPane.showMessageDialog(
           null, ioe.getMessage(), "Listening Error!", JOptionPane.ERROR_MESSAGE);
       client.stop();
     } catch (Exception ex) {
       JOptionPane.showMessageDialog(null, ex.getMessage(), "Error!", JOptionPane.ERROR_MESSAGE);
       client.stop();
     }
   }
 }
コード例 #11
0
 /** @throws java.lang.Exception */
 @BeforeClass
 public static void setUpBeforeClass() throws Exception {
   KeyGenerator generator = KeyGenerator.getInstance(AES.getName());
   generator.init(AES.getLength() * 8);
   SECRET_KEY = generator.generateKey();
 }
コード例 #12
0
 /**
  * Basic lookup, returns direct result
  *
  * @param b
  * @return
  */
 public State lookup(byte b) {
   return tbl[AES.posIdx(b)];
 }
コード例 #13
0
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == j1) {
      System.exit(0);
    }
    if (e.getSource() == j2) {

      try {
        InetAddress ia = InetAddress.getLocalHost();
        String ip = ia.getHostAddress();

        String name = JOptionPane.showInputDialog("Enter Your name");
        String owner = JOptionPane.showInputDialog("Enter Owner Name");

        String[] csname = {"Select Cloud Server", "CS1", "CS2", "CS3"};

        String ip1 = JOptionPane.showInputDialog("Enter cloud Ip address");
        String cloudname =
            (String)
                JOptionPane.showInputDialog(
                    null,
                    "Select Cloud Server",
                    "CloudName",
                    JOptionPane.QUESTION_MESSAGE,
                    null,
                    csname,
                    csname[0]);

        if (cloudname.equalsIgnoreCase("CS1")) {
          Socket sc = new Socket(ip1, 302);
          DataOutputStream dout = new DataOutputStream(sc.getOutputStream());
          dout.writeUTF("check");
          dout.writeUTF(name);
          dout.writeUTF(owner);
          dout.writeUTF(ip);

          DataInputStream din = new DataInputStream(sc.getInputStream());
          String msg = din.readUTF();
          if (msg.equalsIgnoreCase("success")) {
            String filename1 = JOptionPane.showInputDialog("Enter the filename");
            String sec = JOptionPane.showInputDialog("Enter secretkey");

            Socket sc1 = new Socket(ip1, 302);
            DataOutputStream dout1 = new DataOutputStream(sc1.getOutputStream());
            dout1.writeUTF("download");
            dout1.writeUTF(name);
            dout1.writeUTF(owner);
            dout1.writeUTF(filename1);
            dout1.writeUTF(sec);
            dout1.writeUTF(ip);

            DataInputStream oin = new DataInputStream(sc1.getInputStream());
            String msg1 = oin.readUTF();
            System.out.println(msg1);

            if (msg1.equalsIgnoreCase("success")) {
              System.out.println("success");
              AES a3 = new AES();
              String data1 = oin.readUTF();
              String data = a3.decrypt(data1, keyword);
              tf.setText(data);
              PrintStream p = new PrintStream("user/" + filename1);
              p.write(data.getBytes());

              JOptionPane.showMessageDialog(null, "FileDownloaded Successfully");
              int i =
                  JOptionPane.showConfirmDialog(null, "Do you want to open file Downloaded Folder");
              if (i == 0) {
                File f = new File("user");
                Desktop desktop = Desktop.getDesktop();
                desktop.open(f);

              } else if (i == 1) {

              }
            } else if (msg1.equalsIgnoreCase("failure")) {
              JOptionPane.showMessageDialog(
                  null, "you are trying to attack the file, You are Automatically blocked");
            } else if (msg1.equalsIgnoreCase("not")) {
              JOptionPane.showMessageDialog(null, "File Not Found in Cloud Server");
            }

          } else if (msg.equalsIgnoreCase("block")) {
            JOptionPane.showMessageDialog(
                null, "You are Curently blocked ..!!!! \n To access Contact Cloud Server");
          } else if (msg.equalsIgnoreCase("unblock")) {
            JOptionPane.showMessageDialog(null, "Remote user not Registered in Cloud Server");
          }

        } else if (cloudname.equalsIgnoreCase("CS2")) {
          Socket sc = new Socket(ip1, 352);
          DataOutputStream dout = new DataOutputStream(sc.getOutputStream());
          dout.writeUTF("check");
          dout.writeUTF(name);
          dout.writeUTF(owner);
          dout.writeUTF(ip);

          DataInputStream din = new DataInputStream(sc.getInputStream());
          String msg = din.readUTF();
          if (msg.equalsIgnoreCase("success")) {
            String filename1 = JOptionPane.showInputDialog("Enter the filename");
            String sec = JOptionPane.showInputDialog("Enter secretkey");
            // String ip1=JOptionPane.showInputDialog("Enter cloud Ip address");

            Socket sc1 = new Socket(ip1, 352);
            DataOutputStream dout1 = new DataOutputStream(sc1.getOutputStream());
            dout1.writeUTF("download");
            dout1.writeUTF(name);
            dout1.writeUTF(owner);
            dout1.writeUTF(filename1);
            dout1.writeUTF(sec);
            dout1.writeUTF(ip);

            DataInputStream oin = new DataInputStream(sc1.getInputStream());
            String msg1 = oin.readUTF();
            System.out.println(msg1);

            if (msg1.equalsIgnoreCase("success")) {
              System.out.println("success");
              AES a3 = new AES();
              String data1 = oin.readUTF();
              String data = a3.decrypt(data1, keyword);
              tf.setText(data);
              PrintStream p = new PrintStream("user/" + filename1);
              p.write(data.getBytes());

              JOptionPane.showMessageDialog(null, "FileDownloaded Successfully");
              int i =
                  JOptionPane.showConfirmDialog(null, "Do you want to open file Downloaded Folder");
              if (i == 0) {
                File f = new File("user");
                Desktop desktop = Desktop.getDesktop();
                desktop.open(f);

              } else if (i == 1) {

              }
            } else if (msg1.equalsIgnoreCase("failure")) {
              JOptionPane.showMessageDialog(
                  null, "you are trying to attack the file, You are Automatically blocked");
            } else if (msg1.equalsIgnoreCase("not")) {
              JOptionPane.showMessageDialog(null, "File Not Found in Cloud Server");
            }

          } else if (msg.equalsIgnoreCase("block")) {
            JOptionPane.showMessageDialog(
                null, "You are Curently blocked ..!!!! \n To access Contact Cloud Server");
          } else if (msg.equalsIgnoreCase("unblock")) {
            JOptionPane.showMessageDialog(null, "Remote user not Registered in Cloud Server");
          }

        } else if (cloudname.equalsIgnoreCase("CS3")) {
          Socket sc = new Socket(ip1, 362);
          DataOutputStream dout = new DataOutputStream(sc.getOutputStream());
          dout.writeUTF("check");
          dout.writeUTF(name);
          dout.writeUTF(owner);
          dout.writeUTF(ip);

          DataInputStream din = new DataInputStream(sc.getInputStream());
          String msg = din.readUTF();
          if (msg.equalsIgnoreCase("success")) {
            String filename1 = JOptionPane.showInputDialog("Enter the filename");
            String sec = JOptionPane.showInputDialog("Enter secretkey");
            // String ip1=JOptionPane.showInputDialog("Enter cloud Ip address");

            Socket sc1 = new Socket(ip1, 362);
            DataOutputStream dout1 = new DataOutputStream(sc1.getOutputStream());
            dout1.writeUTF("download");
            dout1.writeUTF(name);
            dout1.writeUTF(owner);
            dout1.writeUTF(filename1);
            dout1.writeUTF(sec);
            dout1.writeUTF(ip);

            DataInputStream oin = new DataInputStream(sc1.getInputStream());
            String msg1 = oin.readUTF();
            System.out.println(msg1);

            if (msg1.equalsIgnoreCase("success")) {
              System.out.println("success");
              AES a3 = new AES();
              String data1 = oin.readUTF();
              String data = a3.decrypt(data1, keyword);
              tf.setText(data);
              PrintStream p = new PrintStream("user/" + filename1);
              p.write(data.getBytes());

              JOptionPane.showMessageDialog(null, "FileDownloaded Successfully");
              int i =
                  JOptionPane.showConfirmDialog(null, "Do you want to open file Downloaded Folder");
              if (i == 0) {
                File f = new File("user");
                Desktop desktop = Desktop.getDesktop();
                desktop.open(f);

              } else if (i == 1) {

              }
            } else if (msg1.equalsIgnoreCase("failure")) {
              JOptionPane.showMessageDialog(
                  null, "you are trying to attack the file, You are Automatically blocked");
            } else if (msg1.equalsIgnoreCase("not")) {
              JOptionPane.showMessageDialog(null, "File Not Found in Cloud Server");
            }

          } else if (msg.equalsIgnoreCase("block")) {
            JOptionPane.showMessageDialog(
                null, "You are Curently blocked ..!!!! \n To access Contact Cloud Server");
          } else if (msg.equalsIgnoreCase("unblock")) {
            JOptionPane.showMessageDialog(null, "Remote user not Registered in Cloud Server");
          }
        }

      } catch (Exception e1) {
        e1.printStackTrace();
      }
    }

    if (e.getSource() == j3) {

      try {

        String owner = JOptionPane.showInputDialog("Enter Owner Name");
        String fname = JOptionPane.showInputDialog("Enter File Name");
        String[] csname = {"Select Cloud Server", "CS1", "CS2", "CS3"};

        String cloudname =
            (String)
                JOptionPane.showInputDialog(
                    null,
                    "Select Cloud Server",
                    "CloudName",
                    JOptionPane.QUESTION_MESSAGE,
                    null,
                    csname,
                    csname[0]);
        String ip = JOptionPane.showInputDialog(null, "Enter Cloud Server IP Address");

        if (cloudname.equalsIgnoreCase("CS1")) {
          Socket sc = new Socket(ip, 1717);
          DataOutputStream dout = new DataOutputStream(sc.getOutputStream());

          dout.writeUTF(owner);
          dout.writeUTF(fname);
          dout.writeUTF(cloudname);

          DataInputStream din = new DataInputStream(sc.getInputStream());
          String msg = din.readUTF();
          if (msg.equalsIgnoreCase("success")) {
            JOptionPane.showMessageDialog(null, "Note Down Your Secrete Key :" + din.readUTF());

          } else if (msg.equalsIgnoreCase("failure")) {
            JOptionPane.showMessageDialog(null, "File not found in cloud server");
          }

        } else if (cloudname.equalsIgnoreCase("CS2")) {
          Socket sc = new Socket(ip, 1717);
          DataOutputStream dout = new DataOutputStream(sc.getOutputStream());

          dout.writeUTF(owner);
          dout.writeUTF(fname);
          dout.writeUTF(cloudname);

          DataInputStream din = new DataInputStream(sc.getInputStream());
          String msg = din.readUTF();
          if (msg.equalsIgnoreCase("success")) {
            JOptionPane.showMessageDialog(null, "Note Down Your Secrete Key :" + din.readUTF());
          } else if (msg.equalsIgnoreCase("failure")) {
            JOptionPane.showMessageDialog(
                null, "you are trying to attack the file, You are Automatically blocked");
          }

        } else if (cloudname.equalsIgnoreCase("CS3")) {
          Socket sc = new Socket(ip, 1717);
          DataOutputStream dout = new DataOutputStream(sc.getOutputStream());

          dout.writeUTF(owner);
          dout.writeUTF(fname);
          dout.writeUTF(cloudname);

          DataInputStream din = new DataInputStream(sc.getInputStream());
          String msg = din.readUTF();
          if (msg.equalsIgnoreCase("success")) {
            JOptionPane.showMessageDialog(null, "Note Down Your Secrete Key :" + din.readUTF());
          } else if (msg.equalsIgnoreCase("failure")) {
            JOptionPane.showMessageDialog(
                null, "you are trying to attack the file, You are Automatically blocked");
          }
        }

      } catch (Exception e1) {
        e1.printStackTrace();
      }
    }
  }
コード例 #14
0
 private byte[] process(final byte[] data, final int mode) {
   return AES.process(
       data, mode, this.password, this.salt, this.iv, this.keySize, this.iterationCount);
 }
コード例 #15
0
 public static String decrypt(final String text) {
   return AES.decrypt(text, AES.getSimplePassword(), AES.getSimpleSalt(), AES.getSimpleIV());
 }
コード例 #16
0
 public static String encrypt(final String text, final String password, final byte[] salt) {
   return AES.encrypt(text, password, salt, AES.getSimpleIV());
 }
コード例 #17
0
 public static String encrypt(final String text, final String password) {
   return AES.encrypt(text, password, AES.getSimpleSalt(), AES.getSimpleIV());
 }
コード例 #18
0
  /** Load application settings from persistent store. */
  public void load() {
    Preferences preferences = getUnderlyingPreferences();

    // Authority certificates
    useCaCertificates = preferences.getBoolean(KSE3_USECACERTS, false);
    String cacertsPath =
        preferences.get(
            KSE3_CACERTSFILE, AuthorityCertificates.getDefaultCaCertificatesLocation().toString());
    caCertificatesFile = cleanFilePath(new File(cacertsPath));
    useWindowsTrustedRootCertificates = preferences.getBoolean(KSE3_USEWINTRUSTROOTCERTS, false);

    // Trust checks
    enableImportTrustedCertTrustCheck =
        preferences.getBoolean(KSE3_ENABLEIMPORTTRUSTEDCERTTRUSTCHECK, false);
    enableImportCaReplyTrustCheck =
        preferences.getBoolean(KSE3_ENABLEIMPORTCAREPLYTRUSTCHECK, false);

    // Key pair generation
    generateKeyPairType = KeyPairType.resolveJce(preferences.get(KSE3_KEYPAIRTYPE, RSA.jce()));
    if (generateKeyPairType == null) {
      generateKeyPairType = RSA;
    }
    int defaultKeyPairSize;
    if (generateKeyPairType == RSA) {
      defaultKeyPairSize = 2048;
    } else {
      defaultKeyPairSize = 1024; // DSA
    }
    generateKeyPairSize = preferences.getInt(KSE3_KEYPAIRSIZE, defaultKeyPairSize);

    // Secret key generation
    generateSecretKeyType = SecretKeyType.resolveJce(preferences.get(KSE3_SECKEYTYPE, AES.jce()));
    if (generateSecretKeyType == null) {
      generateSecretKeyType = AES;
    }
    generateSecretKeySize = preferences.getInt(KSE3_SECKEYSIZE, 192);

    // Certificate fingerprint
    certificateFingerprintType =
        DigestType.resolveJce(preferences.get(KSE3_CERTFINGERTYPE, SHA1.jce()));
    if (certificateFingerprintType == null) {
      certificateFingerprintType = SHA1;
    }

    // Password quality
    passwordQualityConfig =
        new PasswordQualityConfig(
            preferences.getBoolean(KSE3_PWDQUALENABLE, false),
            preferences.getBoolean(KSE3_MINPWDQUALENFORCE, false),
            preferences.getInt(KSE3_MINPWDQUAL, 60));

    // Internet proxy settings
    ProxyConfigurationType proxyConfigurationType =
        ProxyConfigurationType.resolve(
            preferences.get(KSE3_PROXY, ProxyConfigurationType.SYSTEM.name()));

    // default should be system settings because of "java.net.useSystemProxies=true", save it for
    // later usage
    SystemProxySelector.setSystemProxySelector(ProxySelector.getDefault());

    switch (proxyConfigurationType) {
      case NONE:
        ProxySelector.setDefault(new NoProxySelector());
        break;
      case PAC:
        // Use PAC URL for proxy configuration
        String pacUrl = preferences.get(KSE3_PACURL, null);
        if (pacUrl != null) {
          ProxySelector.setDefault(new PacProxySelector(pacUrl));
        } else {
          ProxySelector.setDefault(new NoProxySelector());
        }
        break;
      case MANUAL:
        // Use manual settings for HTTP, HTTPS and SOCKS
        ProxyAddress httpProxyAddress = null;
        ProxyAddress httpsProxyAddress = null;
        ProxyAddress socksProxyAddress = null;

        String httpHost = preferences.get(KSE3_HTTPHOST, null);
        int httpPort = preferences.getInt(KSE3_HTTPPORT, 0);

        if (httpHost != null && httpPort > 0) {
          httpProxyAddress = new ProxyAddress(httpHost, httpPort);
        }

        String httpsHost = preferences.get(KSE3_HTTPSHOST, null);
        int httpsPort = preferences.getInt(KSE3_HTTPSPORT, 0);

        if (httpsHost != null && httpsPort > 0) {
          httpsProxyAddress = new ProxyAddress(httpsHost, httpsPort);
        }

        String socksHost = preferences.get(KSE3_SOCKSHOST, null);
        int socksPort = preferences.getInt(KSE3_SOCKSPORT, 0);

        if (socksHost != null && socksPort > 0) {
          socksProxyAddress = new ProxyAddress(socksHost, socksPort);
        }

        if (httpProxyAddress != null || httpsProxyAddress != null) {
          ProxySelector.setDefault(
              new ManualProxySelector(
                  httpProxyAddress, httpsProxyAddress, null, socksProxyAddress));
        } else {
          // no manual settings - use no proxy to connect to the Internet
          ProxySelector.setDefault(new NoProxySelector());
        }
        break;
      case SYSTEM:
      default:
        ProxySelector.setDefault(new SystemProxySelector());
        break;
    }

    // Application size and position
    sizeAndPosition =
        new Rectangle(
            preferences.getInt(KSE3_XPOS, 0),
            preferences.getInt(KSE3_YPOS, 0),
            preferences.getInt(KSE3_WIDTH, KseFrame.DEFAULT_WIDTH),
            preferences.getInt(KSE3_HEIGHT, KseFrame.DEFAULT_HEIGHT));

    // User interface
    showToolBar = preferences.getBoolean(KSE3_SHOWTOOLBAR, true);
    showStatusBar = preferences.getBoolean(KSE3_SHOWSTATUSBAR, true);
    tabLayout = preferences.getInt(KSE3_TABLAYOUT, JTabbedPane.WRAP_TAB_LAYOUT);

    // Recent files
    ArrayList<File> recentFilesList = new ArrayList<File>();
    for (int i = 1; i <= KseFrame.RECENT_FILES_SIZE; i++) {
      String recentFile = preferences.get(KSE3_RECENTFILE + i, null);

      if (recentFile == null) {
        break;
      } else {
        recentFilesList.add(cleanFilePath(new File(recentFile)));
      }
    }
    recentFiles = recentFilesList.toArray(new File[recentFilesList.size()]);

    // Current directory
    String currentDirectoryStr = preferences.get(KSE3_CURRENTDIR, null);
    if (currentDirectoryStr != null) {
      currentDirectory = cleanFilePath(new File(currentDirectoryStr));
    }

    // Look and feel
    lookAndFeelClass = preferences.get(KSE3_LOOKFEEL, null);
    lookAndFeelDecorated = preferences.getBoolean(KSE3_LOOKFEELDECOR, false);

    // Licensing
    licenseAgreed = preferences.getBoolean(KSE3_LICENSEAGREED, false);

    // Tip of the day
    showTipsOnStartUp = preferences.getBoolean(KSE3_TIPSONSTARTUP, true);
    nextTipIndex = preferences.getInt(KSE3_TIPINDEX, 0);

    // Default distinguished name
    defaultDN = preferences.get(KSE3_DEFAULTDN, "");

    // SSL host names and ports for "Examine SSL"
    sslHosts = preferences.get(KSE3_SSLHOSTS, "www.google.com;www.amazon.com");
    sslPorts = preferences.get(KSE3_SSLPORTS, "443");

    // auto update check
    autoUpdateCheckEnabled = preferences.getBoolean(KSE3_AUTO_UPDATE_CHECK_ENABLED, true);
    autoUpdateCheckInterval = preferences.getInt(KSE3_AUTO_UPDATE_CHECK_INTERVAL, 14);
    autoUpdateCheckLastCheck = getDate(preferences, KSE3_AUTO_UPDATE_CHECK_LAST_CHECK, new Date());

    // PKCS#11 libraries
    p11Libs = preferences.get(KSE3_PKCS11_LIBS, "");
  }
コード例 #19
0
 public static byte[] encrypt(
     final byte[] data, final String password, final byte[] salt, final byte[] iv) {
   return AES.encrypt(
       data, password, salt, iv, AES.KEY_SIZE_DEFAULT, AES.ITERATION_COUNT_DEFAULT);
 }