Package net.shibboleth.tool.xmlsectool
Class CommandLineArguments
- java.lang.Object
-
- net.shibboleth.tool.xmlsectool.CommandLineArguments
-
public class CommandLineArguments extends Object
Command line arguments for theXMLSecToolcommand line tool.
-
-
Field Summary
Fields Modifier and Type Field Description private static StringALLOW_ALL_DIGESTS_ARGprivate static StringALLOW_DIGEST_ARGprivate booleanallowAllDigestsOption requesting that all digest algorithms should be allowed.private List<String>allowDigestNamesOption requesting that algorithms associated with a specific digest be allowed.private static StringBASE64_IN_ARGprivate static StringBASE64_OUT_ARGprivate booleanbase64DecodeInputprivate booleanbase64EncodeOutputprivate static StringBLACKLIST_DIGEST_ARGDeprecated, for removal: This API element is subject to removal in a future version.private List<String>blacklistDigestNamesDeprecated, for removal: This API element is subject to removal in a future version.private Stringcertprivate static StringCERT_ARGprivate static StringCLEAR_BLACKLIST_ARGDeprecated, for removal: This API element is subject to removal in a future version.private booleanclearBlacklistDeprecated, for removal: This API element is subject to removal in a future version.private static StringDEFLATE_OUT_ARGprivate booleandeflateOutputprivate DigestChoicedigestDigest algorithm choice for all algorithms.private static StringDIGEST_ALGORITHM_ARGprivate static StringDIGEST_ARGprivate StringdigestAlgorithmDigest algorithm URI directly specified on the command line.private StringdigestNameSelected digest algorithm choice name for all algorithms.private static StringDISALLOW_DIGEST_ARGprivate List<String>disallowDigestNamesOption requesting that algorithms associated with a specific digest be disallowed.private DisallowedAlgorithmsdisallowedAlgorithmsLocal collection of disallowed signature and digest algorithms.private static StringGUNZIP_IN_ARGprivate booleangunzipInputprivate static StringGZIP_OUT_ARGprivate booleangzipOutputprivate booleanhelpprivate static StringHELP_ARGprivate static StringHTTP_PROXY_ARGprivate static StringHTTP_PROXY_PASSWORD_ARGprivate static StringHTTP_PROXY_PORT_ARGprivate static StringHTTP_PROXY_USERNAME_ARGprivate StringhttpProxyprivate StringhttpProxyPasswordprivate inthttpProxyPortprivate StringhttpProxyUsernameprivate static StringIN_FILE_ARGprivate static StringIN_URL_ARGprivate StringinFileprivate static StringINFLATE_IN_ARGprivate booleaninflateInputprivate StringinUrlprivate StringkeyDeprecated, for removal: This API element is subject to removal in a future version.private static StringKEY_ALIAS_ARGprivate static StringKEY_ARGDeprecated, for removal: This API element is subject to removal in a future version.private static StringKEY_FILE_ARGprivate static StringKEY_PASSWORD_ARGprivate StringkeyAliasprivate StringkeyFileprivate StringkeyPasswordprivate Stringkeystoreprivate static StringKEYSTORE_ARGprivate static StringKEYSTORE_PASSWORD_ARGprivate static StringKEYSTORE_PROVIDER_ARGprivate static StringKEYSTORE_TYPE_ARGprivate StringkeystorePasswordprivate StringkeystoreProviderprivate StringkeystoreTypeprivate static StringKI_CRL_ARGprivate static StringKI_KEY_NAME_ARGprivate List<String>kiCrlsprivate List<String>kiKeyNamesprivate static StringLIST_ALGORITHMS_ARGprivate static StringLIST_BLACKLIST_ARGDeprecated, for removal: This API element is subject to removal in a future version.private booleanlistAlgorithmsOption requesting that the signature verification algorithms be listed.private booleanlistBlacklistDeprecated, for removal: This API element is subject to removal in a future version.private static StringLOG_CONFIG_ARGprivate StringlogConfigprivate static StringOPTPrefix for all command-line option names.private static StringOUT_FILE_ARGprivate StringoutFileprivate static StringPKCS11_CONFIG_ARGprivate Stringpkcs11Configprivate booleanquietprivate static StringQUIET_ARGprivate StringrefIdAttributeNameprivate booleanrngSchemaprivate static StringSCHEMA_DIR_ARGprivate static StringSCHEMA_RNG_LANG_ARGprivate static StringSCHEMA_XSD_LANG_ARGprivate StringschemaDirectoryprivate booleanschemaValidateprivate static StringSIG_POS_ARGprivate static StringSIG_REF_ID_ATT_ARGprivate booleansignprivate static StringSIGN_ARGprivate static StringSIGNATURE_ALGORITHM_ARGprivate StringsignatureAlgorithmSignature algorithm URI directly specified on the command line.private StringsignaturePositionprivate booleansignatureVerifyprivate static StringV_SCHEMA_ARGprivate static StringV_SIG_ARGprivate booleanverboseprivate static StringVERBOSE_ARGprivate static StringWHITELIST_DIGEST_ARGDeprecated, for removal: This API element is subject to removal in a future version.private List<String>whitelistDigestNamesDeprecated, for removal: This API element is subject to removal in a future version.private booleanxsdSchema
-
Constructor Summary
Constructors Constructor Description CommandLineArguments()
-
Method Summary
-
-
-
Field Detail
-
OPT
private static final String OPT
Prefix for all command-line option names. Separated out to make it easer to replicate the old usage text.- See Also:
- Constant Field Values
-
HELP_ARG
private static final String HELP_ARG
- See Also:
- Constant Field Values
-
SIGN_ARG
private static final String SIGN_ARG
- See Also:
- Constant Field Values
-
V_SIG_ARG
private static final String V_SIG_ARG
- See Also:
- Constant Field Values
-
V_SCHEMA_ARG
private static final String V_SCHEMA_ARG
- See Also:
- Constant Field Values
-
IN_FILE_ARG
private static final String IN_FILE_ARG
- See Also:
- Constant Field Values
-
IN_URL_ARG
private static final String IN_URL_ARG
- See Also:
- Constant Field Values
-
BASE64_IN_ARG
private static final String BASE64_IN_ARG
- See Also:
- Constant Field Values
-
BASE64_OUT_ARG
private static final String BASE64_OUT_ARG
- See Also:
- Constant Field Values
-
INFLATE_IN_ARG
private static final String INFLATE_IN_ARG
- See Also:
- Constant Field Values
-
GUNZIP_IN_ARG
private static final String GUNZIP_IN_ARG
- See Also:
- Constant Field Values
-
HTTP_PROXY_ARG
private static final String HTTP_PROXY_ARG
- See Also:
- Constant Field Values
-
HTTP_PROXY_PORT_ARG
private static final String HTTP_PROXY_PORT_ARG
- See Also:
- Constant Field Values
-
HTTP_PROXY_USERNAME_ARG
private static final String HTTP_PROXY_USERNAME_ARG
- See Also:
- Constant Field Values
-
HTTP_PROXY_PASSWORD_ARG
private static final String HTTP_PROXY_PASSWORD_ARG
- See Also:
- Constant Field Values
-
SCHEMA_XSD_LANG_ARG
private static final String SCHEMA_XSD_LANG_ARG
- See Also:
- Constant Field Values
-
SCHEMA_RNG_LANG_ARG
private static final String SCHEMA_RNG_LANG_ARG
- See Also:
- Constant Field Values
-
SCHEMA_DIR_ARG
private static final String SCHEMA_DIR_ARG
- See Also:
- Constant Field Values
-
SIG_REF_ID_ATT_ARG
private static final String SIG_REF_ID_ATT_ARG
- See Also:
- Constant Field Values
-
SIG_POS_ARG
private static final String SIG_POS_ARG
- See Also:
- Constant Field Values
-
DIGEST_ARG
private static final String DIGEST_ARG
- See Also:
- Constant Field Values
-
DIGEST_ALGORITHM_ARG
private static final String DIGEST_ALGORITHM_ARG
- See Also:
- Constant Field Values
-
SIGNATURE_ALGORITHM_ARG
private static final String SIGNATURE_ALGORITHM_ARG
- See Also:
- Constant Field Values
-
KI_KEY_NAME_ARG
private static final String KI_KEY_NAME_ARG
- See Also:
- Constant Field Values
-
KI_CRL_ARG
private static final String KI_CRL_ARG
- See Also:
- Constant Field Values
-
CERT_ARG
private static final String CERT_ARG
- See Also:
- Constant Field Values
-
KEY_ARG
@Deprecated(since="3.0.0", forRemoval=true) private static final String KEY_ARG
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
- Constant Field Values
-
KEY_FILE_ARG
private static final String KEY_FILE_ARG
- See Also:
- Constant Field Values
-
KEY_ALIAS_ARG
private static final String KEY_ALIAS_ARG
- See Also:
- Constant Field Values
-
KEY_PASSWORD_ARG
private static final String KEY_PASSWORD_ARG
- See Also:
- Constant Field Values
-
KEYSTORE_ARG
private static final String KEYSTORE_ARG
- See Also:
- Constant Field Values
-
KEYSTORE_PASSWORD_ARG
private static final String KEYSTORE_PASSWORD_ARG
- See Also:
- Constant Field Values
-
KEYSTORE_TYPE_ARG
private static final String KEYSTORE_TYPE_ARG
- See Also:
- Constant Field Values
-
KEYSTORE_PROVIDER_ARG
private static final String KEYSTORE_PROVIDER_ARG
- See Also:
- Constant Field Values
-
PKCS11_CONFIG_ARG
private static final String PKCS11_CONFIG_ARG
- See Also:
- Constant Field Values
-
CLEAR_BLACKLIST_ARG
@Deprecated(since="3.0.0", forRemoval=true) private static final String CLEAR_BLACKLIST_ARG
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
- Constant Field Values
-
ALLOW_ALL_DIGESTS_ARG
private static final String ALLOW_ALL_DIGESTS_ARG
- See Also:
- Constant Field Values
-
BLACKLIST_DIGEST_ARG
@Deprecated(since="3.0.0", forRemoval=true) private static final String BLACKLIST_DIGEST_ARG
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
- Constant Field Values
-
DISALLOW_DIGEST_ARG
private static final String DISALLOW_DIGEST_ARG
- See Also:
- Constant Field Values
-
WHITELIST_DIGEST_ARG
@Deprecated(since="3.0.0", forRemoval=true) private static final String WHITELIST_DIGEST_ARG
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
- Constant Field Values
-
ALLOW_DIGEST_ARG
private static final String ALLOW_DIGEST_ARG
- See Also:
- Constant Field Values
-
LIST_BLACKLIST_ARG
@Deprecated(since="3.0.0", forRemoval=true) private static final String LIST_BLACKLIST_ARG
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
- Constant Field Values
-
LIST_ALGORITHMS_ARG
private static final String LIST_ALGORITHMS_ARG
- See Also:
- Constant Field Values
-
OUT_FILE_ARG
private static final String OUT_FILE_ARG
- See Also:
- Constant Field Values
-
DEFLATE_OUT_ARG
private static final String DEFLATE_OUT_ARG
- See Also:
- Constant Field Values
-
GZIP_OUT_ARG
private static final String GZIP_OUT_ARG
- See Also:
- Constant Field Values
-
VERBOSE_ARG
private static final String VERBOSE_ARG
- See Also:
- Constant Field Values
-
QUIET_ARG
private static final String QUIET_ARG
- See Also:
- Constant Field Values
-
LOG_CONFIG_ARG
private static final String LOG_CONFIG_ARG
- See Also:
- Constant Field Values
-
sign
private boolean sign
-
schemaValidate
private boolean schemaValidate
-
signatureVerify
private boolean signatureVerify
-
inFile
private String inFile
-
inUrl
private String inUrl
-
base64DecodeInput
private boolean base64DecodeInput
-
inflateInput
private boolean inflateInput
-
gunzipInput
private boolean gunzipInput
-
httpProxy
private String httpProxy
-
httpProxyPort
private int httpProxyPort
-
httpProxyUsername
private String httpProxyUsername
-
httpProxyPassword
private String httpProxyPassword
-
schemaDirectory
private String schemaDirectory
-
xsdSchema
private boolean xsdSchema
-
rngSchema
private boolean rngSchema
-
refIdAttributeName
private String refIdAttributeName
-
signaturePosition
private String signaturePosition
-
digest
private DigestChoice digest
Digest algorithm choice for all algorithms.
-
digestName
private String digestName
Selected digest algorithm choice name for all algorithms.
-
digestAlgorithm
private String digestAlgorithm
Digest algorithm URI directly specified on the command line.
-
signatureAlgorithm
private String signatureAlgorithm
Signature algorithm URI directly specified on the command line.
-
outFile
private String outFile
-
base64EncodeOutput
private boolean base64EncodeOutput
-
deflateOutput
private boolean deflateOutput
-
gzipOutput
private boolean gzipOutput
-
cert
private String cert
-
key
@Deprecated(since="3.0.0", forRemoval=true) private String key
Deprecated, for removal: This API element is subject to removal in a future version.
-
keyFile
private String keyFile
-
keyAlias
private String keyAlias
-
keyPassword
private String keyPassword
-
keystore
private String keystore
-
keystorePassword
private String keystorePassword
-
keystoreType
private String keystoreType
-
keystoreProvider
private String keystoreProvider
-
pkcs11Config
private String pkcs11Config
-
disallowedAlgorithms
private final DisallowedAlgorithms disallowedAlgorithms
Local collection of disallowed signature and digest algorithms.
-
allowAllDigests
private boolean allowAllDigests
Option requesting that all digest algorithms should be allowed.
-
clearBlacklist
@Deprecated(since="3.0.0", forRemoval=true) private boolean clearBlacklist
Deprecated, for removal: This API element is subject to removal in a future version.
-
listAlgorithms
private boolean listAlgorithms
Option requesting that the signature verification algorithms be listed.
-
listBlacklist
@Deprecated(since="3.0.0", forRemoval=true) private boolean listBlacklist
Deprecated, for removal: This API element is subject to removal in a future version.
-
disallowDigestNames
private List<String> disallowDigestNames
Option requesting that algorithms associated with a specific digest be disallowed.
-
blacklistDigestNames
@Deprecated(since="3.0.0", forRemoval=true) private List<String> blacklistDigestNames
Deprecated, for removal: This API element is subject to removal in a future version.
-
allowDigestNames
private List<String> allowDigestNames
Option requesting that algorithms associated with a specific digest be allowed.
-
whitelistDigestNames
@Deprecated(since="3.0.0", forRemoval=true) private List<String> whitelistDigestNames
Deprecated, for removal: This API element is subject to removal in a future version.
-
verbose
private boolean verbose
-
quiet
private boolean quiet
-
logConfig
private String logConfig
-
help
private boolean help
-
-
Method Detail
-
parseCommandLineArguments
public void parseCommandLineArguments(String[] args)
Parse the command-line arguments.As well as basic parsing, this also:
- validates the options used: results in fatal errors if they are invalid
- applies some defaults
- processes the options related to the disallowed algorithm list
- Parameters:
args- array of command-line arguments to parse
-
checkForDeprecations
public void checkForDeprecations()
Checks for any deprecations in the command-line options.The logging system must have been set up before this is called.
-
processDisallowedAlgorithmOptions
private void processDisallowedAlgorithmOptions()
Handle options related to setting up the disallowed algorithm collection. These are--allowAllDigests,--disallowDigestand--allowDigest. The legacy forms (--clearBlacklist,--blacklistDigestand--whitelistDigestare also handled here.
-
getHttpProxy
public String getHttpProxy()
-
getHttpProxyPort
public int getHttpProxyPort()
-
getHttpProxyUsername
public String getHttpProxyUsername()
-
getHttpProxyPassword
public String getHttpProxyPassword()
-
doSign
public boolean doSign()
-
doSchemaValidation
public boolean doSchemaValidation()
-
doSignatureVerify
public boolean doSignatureVerify()
-
getReferenceIdAttributeName
public String getReferenceIdAttributeName()
-
getSignaturePosition
public String getSignaturePosition()
-
getDigest
public DigestChoice getDigest()
Returns the choice of digest algorithm.- Returns:
- selected digest algorithm
-
getDigestAlgorithm
public String getDigestAlgorithm()
Returns the digest algorithm URI if specified on the command line.- Returns:
- a digest algorithm identifier, or
null.
-
getSignatureAlgorithm
public String getSignatureAlgorithm()
Returns the signature algorithm URI if specified on the command line.- Returns:
- a signature algorithm identifier, or
null.
-
getInputFile
public String getInputFile()
-
getInputUrl
public String getInputUrl()
-
isBase64DecodeInput
public boolean isBase64DecodeInput()
-
isInflateInput
public boolean isInflateInput()
-
isGunzipInput
public boolean isGunzipInput()
-
getSchemaDirectory
public String getSchemaDirectory()
-
isXsdSchema
public boolean isXsdSchema()
-
isRngSchema
public boolean isRngSchema()
-
getOutputFile
public String getOutputFile()
-
isBase64EncodedOutput
public boolean isBase64EncodedOutput()
-
isDeflateOutput
public boolean isDeflateOutput()
-
isGzipOutput
public boolean isGzipOutput()
-
getCertificate
public String getCertificate()
-
getKeyFile
public String getKeyFile()
-
getKeyAlias
public String getKeyAlias()
-
getKeyPassword
public String getKeyPassword()
-
getKeystore
public String getKeystore()
-
getKeystorePassword
public String getKeystorePassword()
-
getKeystoreType
public String getKeystoreType()
-
getKeystoreProvider
public String getKeystoreProvider()
-
getPkcs11Config
public String getPkcs11Config()
-
getDisallowedAlgorithms
public DisallowedAlgorithms getDisallowedAlgorithms()
Returns the {link @DisallowedAlgorithms}.- Returns:
- a
DisallowedAlgorithmsinstance
-
doListAlgorithms
public boolean doListAlgorithms()
Indicates whether the option to list the disallowed algorithms has been selected.- Returns:
trueif option selected
-
doVerboseOutput
public boolean doVerboseOutput()
-
doQuietOutput
public boolean doQuietOutput()
-
getLoggingConfiguration
public String getLoggingConfiguration()
-
doHelp
public boolean doHelp()
-
validateCommandLineArguments
private void validateCommandLineArguments()
-
printHelp
public void printHelp(PrintStream out)
Print command line help instructions.- Parameters:
out- location where to print the output
-
errorAndExit
private void errorAndExit(String error)
Prints the error message to STDERR and then exits.- Parameters:
error- the error message
-
-