Use ObjectBuilder statically (this was generating warnings for me)
git-svn-id: https://svn.verisignlabs.com/jdnssec/tools/trunk@123 4cbd57fe-54e5-0310-bd9a-f30fe5ea5e6e
This commit is contained in:
parent
8b61f84308
commit
531dc115aa
@ -74,23 +74,23 @@ public class DSTool
|
|||||||
// boolean options
|
// boolean options
|
||||||
opts.addOption("h", "help", false, "Print this message.");
|
opts.addOption("h", "help", false, "Print this message.");
|
||||||
|
|
||||||
opts.addOption(OptionBuilder.withLongOpt("dlv")
|
OptionBuilder.withLongOpt("dlv");
|
||||||
.withDescription("Generate a DLV record instead.")
|
OptionBuilder.withDescription("Generate a DLV record instead.");
|
||||||
.create());
|
opts.addOption(OptionBuilder.create());
|
||||||
|
|
||||||
|
OptionBuilder.hasOptionalArg();
|
||||||
|
OptionBuilder.withLongOpt("verbose");
|
||||||
|
OptionBuilder.withArgName("level");
|
||||||
|
OptionBuilder.withDescription("verbosity level -- 0 is silence, 5 is debug information, 6 is trace information.\n"
|
||||||
|
+ "default is level 5.");
|
||||||
// Argument options
|
// Argument options
|
||||||
opts.addOption(OptionBuilder.hasOptionalArg()
|
opts.addOption(OptionBuilder.create('v'));
|
||||||
.withLongOpt("verbose")
|
|
||||||
.withArgName("level")
|
|
||||||
.withDescription("verbosity level -- 0 is silence, 5 is debug information, 6 is trace information.\n"
|
|
||||||
+ "default is level 5.")
|
|
||||||
.create('v'));
|
|
||||||
|
|
||||||
opts.addOption(OptionBuilder.hasArg()
|
OptionBuilder.hasArg();
|
||||||
.withLongOpt("digest")
|
OptionBuilder.withLongOpt("digest");
|
||||||
.withArgName("id")
|
OptionBuilder.withArgName("id");
|
||||||
.withDescription("The Digest ID to use (numerically): either 1 for SHA1 or 2 for SHA256")
|
OptionBuilder.withDescription("The Digest ID to use (numerically): either 1 for SHA1 or 2 for SHA256");
|
||||||
.create('d'));
|
opts.addOption(OptionBuilder.create('d'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void parseCommandLine(String[] args)
|
public void parseCommandLine(String[] args)
|
||||||
|
@ -93,22 +93,21 @@ public class KeyGen
|
|||||||
OptionBuilder.withLongOpt("verbose");
|
OptionBuilder.withLongOpt("verbose");
|
||||||
OptionBuilder.withArgName("level");
|
OptionBuilder.withArgName("level");
|
||||||
OptionBuilder.withDescription("verbosity level -- 0 is silence, "
|
OptionBuilder.withDescription("verbosity level -- 0 is silence, "
|
||||||
+ "5 is debug information, " + "6 is trace information.\n"
|
+ "5 is debug information, 6 is trace information.\n"
|
||||||
+ "default is level 5.");
|
+ "default is level 5.");
|
||||||
opts.addOption(OptionBuilder.create('v'));
|
opts.addOption(OptionBuilder.create('v'));
|
||||||
|
|
||||||
OptionBuilder.hasArg();
|
OptionBuilder.hasArg();
|
||||||
OptionBuilder.withArgName("algorithm");
|
OptionBuilder.withArgName("algorithm");
|
||||||
OptionBuilder.withDescription("RSA | RSASHA1 | RSAMD5 | DH | DSA | alias, "
|
OptionBuilder.withDescription("RSA | RSASHA1 | RSAMD5 | DH | DSA "
|
||||||
+ "RSASHA1 is default.");
|
+ "| RSA-NSEC3-SHA1 | DSA-NSEC3-SHA1 "
|
||||||
|
+ "| RSASHA256 | RSASHA512 | alias, RSASHA1 is default.");
|
||||||
opts.addOption(OptionBuilder.create('a'));
|
opts.addOption(OptionBuilder.create('a'));
|
||||||
|
|
||||||
OptionBuilder.hasArg();
|
OptionBuilder.hasArg();
|
||||||
OptionBuilder.withArgName("size");
|
OptionBuilder.withArgName("size");
|
||||||
OptionBuilder.withDescription("key size, in bits. (default = 1024)\n"
|
OptionBuilder.withDescription("key size, in bits. (default = 1024)\n"
|
||||||
+ "RSA|RSASHA1|RSAMD5: [512..4096]\n"
|
+ "RSA: [512..4096]\n" + "DSA: [512..1024]\n" + "DH: [128..4096]");
|
||||||
+ "DSA: [512..1024]\n"
|
|
||||||
+ "DH: [128..4096]");
|
|
||||||
opts.addOption(OptionBuilder.create('b'));
|
opts.addOption(OptionBuilder.create('b'));
|
||||||
|
|
||||||
OptionBuilder.hasArg();
|
OptionBuilder.hasArg();
|
||||||
|
@ -32,7 +32,7 @@ import com.verisignlabs.dnssec.security.DnsKeyAlgorithm;
|
|||||||
import com.verisignlabs.dnssec.security.DnsKeyPair;
|
import com.verisignlabs.dnssec.security.DnsKeyPair;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class forms the command line implementation of a DNSSEC DS/DLV generator
|
* This class forms the command line implementation of a key introspection tool.
|
||||||
*
|
*
|
||||||
* @author David Blacka (original)
|
* @author David Blacka (original)
|
||||||
* @author $Author: davidb $
|
* @author $Author: davidb $
|
||||||
@ -67,16 +67,14 @@ public class KeyInfoTool
|
|||||||
// boolean options
|
// boolean options
|
||||||
opts.addOption("h", "help", false, "Print this message.");
|
opts.addOption("h", "help", false, "Print this message.");
|
||||||
|
|
||||||
|
OptionBuilder.hasOptionalArg();
|
||||||
|
OptionBuilder.withLongOpt("verbose");
|
||||||
|
OptionBuilder.withArgName("level");
|
||||||
|
OptionBuilder.withDescription("verbosity level -- 0 is silence, "
|
||||||
|
+ "5 is debug information, 6 is trace information.\n"
|
||||||
|
+ "default is level 5.");
|
||||||
// Argument options
|
// Argument options
|
||||||
opts.addOption(OptionBuilder.hasOptionalArg()
|
opts.addOption(OptionBuilder.create('v'));
|
||||||
.withLongOpt("verbose")
|
|
||||||
.withArgName("level")
|
|
||||||
.withDescription(
|
|
||||||
"verbosity level -- 0 is silence, "
|
|
||||||
+ "5 is debug information, "
|
|
||||||
+ "6 is trace information.\n"
|
|
||||||
+ "default is level 5.")
|
|
||||||
.create('v'));
|
|
||||||
|
|
||||||
OptionBuilder.hasArg();
|
OptionBuilder.hasArg();
|
||||||
OptionBuilder.withLongOpt("alg-alias");
|
OptionBuilder.withLongOpt("alg-alias");
|
||||||
|
@ -79,27 +79,25 @@ public class VerifyZone
|
|||||||
+ "signatures could be cryptographically verified");
|
+ "signatures could be cryptographically verified");
|
||||||
|
|
||||||
// Argument options
|
// Argument options
|
||||||
opts.addOption(OptionBuilder.hasArg()
|
OptionBuilder.hasArg();
|
||||||
.withLongOpt("keydir")
|
OptionBuilder.withLongOpt("keydir");
|
||||||
.withArgName("dir")
|
OptionBuilder.withArgName("dir");
|
||||||
.withDescription("directory to find " + "trusted key files")
|
OptionBuilder.withDescription("directory to find " + "trusted key files");
|
||||||
.create('d'));
|
opts.addOption(OptionBuilder.create('d'));
|
||||||
|
|
||||||
opts.addOption(OptionBuilder.hasOptionalArg()
|
OptionBuilder.hasOptionalArg();
|
||||||
.withLongOpt("verbose")
|
OptionBuilder.withLongOpt("verbose");
|
||||||
.withArgName("level")
|
OptionBuilder.withArgName("level");
|
||||||
.withDescription(
|
OptionBuilder.withDescription("verbosity level -- 0 is silence, "
|
||||||
"verbosity level -- 0 is silence, "
|
+ "5 is debug information, 6 is trace information.\n"
|
||||||
+ "5 is debug information, 6 is trace information.\n"
|
+ "default is level 5.");
|
||||||
+ "default is level 5.")
|
opts.addOption(OptionBuilder.create('v'));
|
||||||
.create('v'));
|
|
||||||
|
|
||||||
opts.addOption(OptionBuilder.hasArg()
|
|
||||||
.withArgName("alias:original:mnemonic")
|
|
||||||
.withLongOpt("alg-alias")
|
|
||||||
.withDescription("Define an alias for an algorithm")
|
|
||||||
.create('A'));
|
|
||||||
|
|
||||||
|
OptionBuilder.hasArg();
|
||||||
|
OptionBuilder.withArgName("alias:original:mnemonic");
|
||||||
|
OptionBuilder.withLongOpt("alg-alias");
|
||||||
|
OptionBuilder.withDescription("Define an alias for an algorithm");
|
||||||
|
opts.addOption(OptionBuilder.create('A'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void parseCommandLine(String[] args)
|
public void parseCommandLine(String[] args)
|
||||||
@ -118,16 +116,16 @@ public class VerifyZone
|
|||||||
Logger rootLogger = Logger.getLogger("");
|
Logger rootLogger = Logger.getLogger("");
|
||||||
switch (value)
|
switch (value)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
rootLogger.setLevel(Level.OFF);
|
rootLogger.setLevel(Level.OFF);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
default:
|
default:
|
||||||
rootLogger.setLevel(Level.FINE);
|
rootLogger.setLevel(Level.FINE);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
rootLogger.setLevel(Level.ALL);
|
rootLogger.setLevel(Level.ALL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,7 +189,7 @@ public class VerifyZone
|
|||||||
PrintWriter out = new PrintWriter(System.err);
|
PrintWriter out = new PrintWriter(System.err);
|
||||||
|
|
||||||
// print our own usage statement:
|
// print our own usage statement:
|
||||||
f.printHelp(out, 75, "verifyZone.sh [..options..] zonefile "
|
f.printHelp(out, 75, "jdnssec-verifyzone [..options..] zonefile "
|
||||||
+ "[keyfile [keyfile...]]", null, opts,
|
+ "[keyfile [keyfile...]]", null, opts,
|
||||||
HelpFormatter.DEFAULT_LEFT_PAD,
|
HelpFormatter.DEFAULT_LEFT_PAD,
|
||||||
HelpFormatter.DEFAULT_DESC_PAD, null);
|
HelpFormatter.DEFAULT_DESC_PAD, null);
|
||||||
@ -329,19 +327,19 @@ public class VerifyZone
|
|||||||
|
|
||||||
switch (result)
|
switch (result)
|
||||||
{
|
{
|
||||||
case DNSSEC.Failed:
|
case DNSSEC.Failed:
|
||||||
System.out.println("zone did not verify.");
|
|
||||||
System.exit(1);
|
|
||||||
break;
|
|
||||||
case DNSSEC.Insecure:
|
|
||||||
if (state.strict)
|
|
||||||
{
|
|
||||||
System.out.println("zone did not verify.");
|
System.out.println("zone did not verify.");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
break;
|
||||||
case DNSSEC.Secure:
|
case DNSSEC.Insecure:
|
||||||
System.out.println("zone verified.");
|
if (state.strict)
|
||||||
break;
|
{
|
||||||
|
System.out.println("zone did not verify.");
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
case DNSSEC.Secure:
|
||||||
|
System.out.println("zone verified.");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,14 @@ import org.xbill.DNS.Section;
|
|||||||
|
|
||||||
import com.verisignlabs.dnssec.security.RecordComparator;
|
import com.verisignlabs.dnssec.security.RecordComparator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class forms the command line implementation of a zone file normalizer.
|
||||||
|
* That is, a tool to rewrite zones in a consistent, comparable format.
|
||||||
|
*
|
||||||
|
* @author David Blacka (original)
|
||||||
|
* @author $Author: davidb $
|
||||||
|
* @version $Revision: 2218 $
|
||||||
|
*/
|
||||||
public class ZoneFormat
|
public class ZoneFormat
|
||||||
{
|
{
|
||||||
// private static Logger log;
|
// private static Logger log;
|
||||||
@ -79,16 +87,16 @@ public class ZoneFormat
|
|||||||
Logger rootLogger = Logger.getLogger("");
|
Logger rootLogger = Logger.getLogger("");
|
||||||
switch (value)
|
switch (value)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
rootLogger.setLevel(Level.OFF);
|
rootLogger.setLevel(Level.OFF);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
default:
|
default:
|
||||||
rootLogger.setLevel(Level.FINE);
|
rootLogger.setLevel(Level.FINE);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
rootLogger.setLevel(Level.ALL);
|
rootLogger.setLevel(Level.ALL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user