help(options);
return;
}
try {
final PasswordCipher cipher = PasswordCipherFactory.getPasswordCipher(cipherName);
if (line.hasOption("decrypt")) {
final String pwdArg = (String) line.getArgList().get(0);
final char[] encryptdPassword = pwdArg.toCharArray();
System.out.println(cipher.decrypt(encryptdPassword));
} else { // if option neither encrypt/decrypt is specified, we assume
// it is encrypt.
final String plainPassword = (String) line.getArgList().get(0);
System.out.println(new String(cipher.encrypt(plainPassword)));
}
} catch (final RuntimeException e) {
System.out.println("Could not load password cipher implementation class. Check your classpath.");