private String decrypting(String message) {
    int i = 0;
    while (message.substring(i, i + 1).compareTo(":") != 0 && i + 1 < message.length()) {
      i++;
    }
    i += 2;
    if (i + 2 >= message.length()) {
      return message;
    }

    String cMessage = message.substring(i);
    // System.out.println(cMessage);
    switch (cSelect) {
      case 0:
        return message.substring(0, i) + cMessage;
      case 1:
        return message.substring(0, i)
            + decryptCaesar(cMessage, Integer.parseInt(textFieldShift.getText()));
      case 2:
        vig.setKey(textFieldVigPass.getText());
        return message.substring(0, i) + vig.decode(cMessage);
      case 3:
        tea.setKey(textFieldTEA.getText().getBytes());
        return message.substring(0, i) + tea.decrypt(cMessage);
      case 4:
        return message.substring(0, i) + rsa.decrypt(cMessage);
    }
    return message;
  }
Beispiel #2
0
  private int decryptKey(int[] a, int i) {
    long v;

    v = a[i + 0];
    v = a[i + 1] + v * MAX;
    v = a[i + 2] + v * MAX;
    v = a[i + 3] + v * MAX;

    return (int) rsa_.decrypt(v);
  }