|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.vt.middleware.crypt.AbstractCli
edu.vt.middleware.crypt.AbstractEncryptionCli
edu.vt.middleware.crypt.symmetric.SymmetricCli
public class SymmetricCli
Command line interface for symmetric encryption operations.
| Field Summary | |
|---|---|
protected static String |
OPT_DIGEST
Digest algorithm used with PBE modes that allow it. |
protected static String |
OPT_GENKEY
Generate key option. |
protected static String |
OPT_ITERATIONS
Iteration count for PBE key generation. |
protected static String |
OPT_IV
Cipher initialization vector option. |
protected static String |
OPT_KEY
Cipher key option. |
protected static String |
OPT_KEYSIZE
Cipher key size. |
protected static String |
OPT_MODE
Cipher mode option. |
protected static String |
OPT_PADDING
Cipher padding option. |
protected static String |
OPT_PBE
Trigger password-based encryption key generation. |
protected static String |
OPT_SALT
Salt for PBE key generation. |
protected static String |
OPT_SCHEME
PBE key generation strategy, e.g. |
| Fields inherited from class edu.vt.middleware.crypt.AbstractEncryptionCli |
|---|
OPT_CIPHER, OPT_DECRYPT, OPT_ENCODING, OPT_ENCRYPT, OPT_OUTFILE, OPT_TAIL |
| Fields inherited from class edu.vt.middleware.crypt.AbstractCli |
|---|
BASE_64_ENCODING, HEX_ENCODING, OPT_EXAMPLE, OPT_INFILE, options, PEM_SUFFIX |
| Constructor Summary | |
|---|---|
SymmetricCli()
|
|
| Method Summary | |
|---|---|
protected void |
decrypt(org.apache.commons.cli.CommandLine line)
Perform a decryption operation using data specified on the command line. |
protected void |
dispatch(org.apache.commons.cli.CommandLine line)
Dispatch command line data to the handler that can perform the operation requested on the command line. |
protected void |
encrypt(org.apache.commons.cli.CommandLine line)
Perform an encryption operation using data specified on the command line. |
protected SecretKey |
generatePBEKey(SymmetricAlgorithm alg,
org.apache.commons.cli.CommandLine line)
Generates a PBE key from command line options including a password. |
protected void |
genKey(org.apache.commons.cli.CommandLine line)
Generate a new encryption key to using command line arguments. |
protected String |
getCommandName()
Gets the name of the command for which this class provides a CLI interface. |
protected EncryptionScheme |
getPBEScheme(SymmetricAlgorithm alg,
org.apache.commons.cli.CommandLine line)
Gets a password-based encryption scheme based on command line arguments. |
protected void |
initOptions()
Initialize CLI options. |
static void |
main(String[] args)
CLI entry point method. |
protected SymmetricAlgorithm |
newAlgorithm(org.apache.commons.cli.CommandLine line)
Creates a new symmetric encryption algorithm instance based on CLI options. |
protected SecretKey |
readKey(org.apache.commons.cli.CommandLine line)
Creates a symmetric key from a file defined by CLI arguments. |
protected void |
validateOptions(org.apache.commons.cli.CommandLine line)
Validates the existence of required options for an operation. |
| Methods inherited from class edu.vt.middleware.crypt.AbstractEncryptionCli |
|---|
decrypt, encrypt, getInputStream, getOutputStream |
| Methods inherited from class edu.vt.middleware.crypt.AbstractCli |
|---|
closeStream, closeStream, getInputStream, performAction, printExamples, printHelp |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final String OPT_MODE
protected static final String OPT_PADDING
protected static final String OPT_IV
protected static final String OPT_KEY
protected static final String OPT_KEYSIZE
protected static final String OPT_PBE
protected static final String OPT_SCHEME
protected static final String OPT_DIGEST
protected static final String OPT_SALT
protected static final String OPT_ITERATIONS
protected static final String OPT_GENKEY
| Constructor Detail |
|---|
public SymmetricCli()
| Method Detail |
|---|
public static void main(String[] args)
args - Command line arguments.protected void initOptions()
initOptions in class AbstractEncryptionCli
protected void dispatch(org.apache.commons.cli.CommandLine line)
throws Exception
dispatch in class AbstractCliline - Parsed command line arguments container.
Exception - On errors thrown by handler.protected SymmetricAlgorithm newAlgorithm(org.apache.commons.cli.CommandLine line)
line - Parsed command line arguments container.
protected String getCommandName()
getCommandName in class AbstractCli
protected void encrypt(org.apache.commons.cli.CommandLine line)
throws Exception
line - Parsed command line arguments container.
Exception - On encryption errors.
protected void decrypt(org.apache.commons.cli.CommandLine line)
throws Exception
line - Parsed command line arguments container.
Exception - On decryption errors.
protected void genKey(org.apache.commons.cli.CommandLine line)
throws Exception
line - Parsed command line arguments container.
Exception - On key generation errors.
protected SecretKey generatePBEKey(SymmetricAlgorithm alg,
org.apache.commons.cli.CommandLine line)
throws Exception
alg - Symmetric algorithm for which a compatible key should be
generated.line - Parsed command line arguments container.
Exception - On key generation errors.
protected SecretKey readKey(org.apache.commons.cli.CommandLine line)
throws CryptException,
IOException
line - Parsed command line arguments container.
CryptException - On cryptographic errors.
IOException - On IO errors.protected void validateOptions(org.apache.commons.cli.CommandLine line)
line - Parsed command line arguments container.
protected EncryptionScheme getPBEScheme(SymmetricAlgorithm alg,
org.apache.commons.cli.CommandLine line)
alg - Symmetric cipher algorithm.line - parsed command line arguments container.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||