Allow for epoch start/expire times; add verboseSigning to jdnssec-signrrset
This commit is contained in:
		
							parent
							
								
									b291bb430b
								
							
						
					
					
						commit
						55a139db82
					
				@ -247,6 +247,19 @@ public abstract class CLBase
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  public static long parseLong(String s, long def)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    try
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      long v = Long.parseLong(s);
 | 
				
			||||||
 | 
					      return v;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    catch (NumberFormatException e)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      return def;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /**
 | 
					  /**
 | 
				
			||||||
   * Calculate a date/time from a command line time/offset duration string.
 | 
					   * Calculate a date/time from a command line time/offset duration string.
 | 
				
			||||||
   *
 | 
					   *
 | 
				
			||||||
@ -272,6 +285,11 @@ public abstract class CLBase
 | 
				
			|||||||
      long offset = (long) parseInt(duration.substring(1), 0) * 1000;
 | 
					      long offset = (long) parseInt(duration.substring(1), 0) * 1000;
 | 
				
			||||||
      return new Date(start.getTime() + offset);
 | 
					      return new Date(start.getTime() + offset);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    if (duration.length() <= 10)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      long epoch = parseLong(duration, 0) * 1000;
 | 
				
			||||||
 | 
					      return new Date(epoch);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyyMMddHHmmss");
 | 
					    SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyyMMddHHmmss");
 | 
				
			||||||
    dateFormatter.setTimeZone(TimeZone.getTimeZone("GMT"));
 | 
					    dateFormatter.setTimeZone(TimeZone.getTimeZone("GMT"));
 | 
				
			||||||
 | 
				
			|||||||
@ -61,6 +61,7 @@ public class SignRRset extends CLBase
 | 
				
			|||||||
    public String   inputfile    = null;
 | 
					    public String   inputfile    = null;
 | 
				
			||||||
    public String   outputfile   = null;
 | 
					    public String   outputfile   = null;
 | 
				
			||||||
    public boolean  verifySigs   = false;
 | 
					    public boolean  verifySigs   = false;
 | 
				
			||||||
 | 
					    public boolean  verboseSigning = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public CLIState()
 | 
					    public CLIState()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
@ -74,6 +75,7 @@ public class SignRRset extends CLBase
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
      // boolean options
 | 
					      // boolean options
 | 
				
			||||||
      opts.addOption("a", "verify", false, "verify generated signatures>");
 | 
					      opts.addOption("a", "verify", false, "verify generated signatures>");
 | 
				
			||||||
 | 
					      opts.addOption("V", "verbose-signing", false, "Display verbose signing activity.");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      OptionBuilder.hasArg();
 | 
					      OptionBuilder.hasArg();
 | 
				
			||||||
      OptionBuilder.withArgName("dir");
 | 
					      OptionBuilder.withArgName("dir");
 | 
				
			||||||
@ -104,6 +106,7 @@ public class SignRRset extends CLBase
 | 
				
			|||||||
      String optstr = null;
 | 
					      String optstr = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (cli.hasOption('a')) verifySigs = true;
 | 
					      if (cli.hasOption('a')) verifySigs = true;
 | 
				
			||||||
 | 
					      if (cli.hasOption('V')) verboseSigning = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if ((optstr = cli.getOptionValue('D')) != null)
 | 
					      if ((optstr = cli.getOptionValue('D')) != null)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
@ -310,7 +313,7 @@ public class SignRRset extends CLBase
 | 
				
			|||||||
      state.outputfile = state.inputfile + ".signed";
 | 
					      state.outputfile = state.inputfile + ".signed";
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    JCEDnsSecSigner signer = new JCEDnsSecSigner();
 | 
					    JCEDnsSecSigner signer = new JCEDnsSecSigner(state.verboseSigning);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    List<RRSIGRecord> sigs = signer.signRRset(rrset, keypairs, state.start, state.expire);
 | 
					    List<RRSIGRecord> sigs = signer.signRRset(rrset, keypairs, state.start, state.expire);
 | 
				
			||||||
    for (RRSIGRecord s : sigs)
 | 
					    for (RRSIGRecord s : sigs)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user