Class CLI2
- java.lang.Object
-
- org.apache.fulcrum.jce.crypto.cli.CLI2
-
public class CLI2 extends Object
Manifest main class. Command line tool for encrypting/decrypting a file or string file [enc|dec] passwd [file]* string [enc|dec] passwd plaintext Example :java -classpath target/classes org.apache.fulcrum.jce.crypto.cli.CLI2 string enc changeit mysecretgeheim
java -jar target/fulcrum-yaafi-crypto-1.0.8.jar string enc changeit mysecretgeheim
...java java -jar target/fulcrum-yaafi-crypto-1.0.8.jar string dec changeit anothersecret
- Author:
- gk@apache.org
-
-
Constructor Summary
Constructors Constructor Description CLI2()
-
Method Summary
Modifier and Type Method Description static boolean
isHexadecimal(String input)
static void
main(String[] args)
Allows usage on the command line.static void
printHelp()
Prints usage information.static void
processFile(String cipherMode, char[] password, File sourceFile, File targetFile)
Decrypt/encrypt a single filestatic void
processFiles(String[] args)
Decrypt/encrypt a list of filesstatic void
processString(String[] args)
Decrypt and encrypt a string.static String
processString(String cipherMode, char[] password, String value)
Decrypt and encrypt a string.
-
-
-
Method Detail
-
main
public static void main(String[] args)
Allows usage on the command line.- Parameters:
args
- the command line parameters
-
printHelp
public static void printHelp()
Prints usage information.
-
processFiles
public static void processFiles(String[] args) throws Exception
Decrypt/encrypt a list of files- Parameters:
args
- the command line- Throws:
Exception
- the operation failed
-
processFile
public static void processFile(String cipherMode, char[] password, File sourceFile, File targetFile) throws Exception
Decrypt/encrypt a single file- Parameters:
cipherMode
- the modepassword
- the passwordsourceFile
- the file to processtargetFile
- the target file- Throws:
Exception
- the operation failed
-
processString
public static void processString(String[] args) throws Exception
Decrypt and encrypt a string.- Parameters:
args
- the command line- Throws:
Exception
- the operation failed
-
processString
public static String processString(String cipherMode, char[] password, String value) throws Exception
Decrypt and encrypt a string.- Parameters:
cipherMode
- \"dec|enc\" + @link{TYPES}password
- as char arrayvalue
- String to be en/decrypted- Returns:
- the result - either the encrypted or decrypted string depending on cipherMode
- Throws:
Exception
- the operation failed
-
isHexadecimal
public static boolean isHexadecimal(String input)
-
-