Exemplo n.º 1
0
  /**
   * This class can be called with "encrypt" password as the arguments where encrypt is a literal
   * and password is replaced with the clear text password to be encrypted.
   *
   * @param args The arguments in the form "command" parm1, parm2.
   * @throws Exception If an error occurs.
   */
  public static void main(String[] args) throws Exception {
    if (args.length != 2 || !(args[0].equals("encrypt"))) {
      System.err.println("Usage: \"EncryptUtil encrypt\" password");
      System.err.println("     password : The clear text password to encrypt");
      System.exit(0);
    }
    Cryptor cryptor = CryptorFactory.getCryptor();

    if (args[0].equals("encrypt")) {
      System.out.println(cryptor.encrypt(args[1]));
    }
  }