java.lang.Object
net.i2p.router.JobImpl
net.i2p.router.startup.CreateRouterInfoJob
All Implemented Interfaces:
Job

public class CreateRouterInfoJobextends JobImpl
Warning - misnamed. This creates a new RouterIdentity, i.e. new router keys and hash. It then builds a new RouterInfo and saves all the keys. This is generally run only once, on a new install.
  • Field Details

    • _log

      private final Log _log
      Logger for this class.
    • _next

      private final Job _next
      The job to run after the router info is published.
    • INFO_FILENAME

      public static final String INFO_FILENAME
      Router info filename.
      See Also:
    • KEYS_FILENAME

      public static final String KEYS_FILENAME
      Old router keys filename.
      See Also:
    • KEYS2_FILENAME

      public static final String KEYS2_FILENAME
      Router keys filename.
      See Also:
    • PROP_ROUTER_SIGTYPE

      static final String PROP_ROUTER_SIGTYPE
      Property for router signature type.
      See Also:
    • PROP_ROUTER_ENCTYPE

      static final String PROP_ROUTER_ENCTYPE
      Property for router encryption type.
      See Also:
    • DEFAULT_SIGTYPE

      private static final SigType DEFAULT_SIGTYPE
      Signature type chosen for a new router.
    • DEFAULT_ENCTYPE

      private static final EncType DEFAULT_ENCTYPE
      Encryption type chosen for a new router.
    • PADDING_ENTROPY

      private static final int PADDING_ENTROPY
      Bits of entropy in the packet padding choice.
      See Also:
  • Constructor Details

    • CreateRouterInfoJob

      CreateRouterInfoJob(RouterContext ctx, Job next)
      Creates a new CreateRouterInfoJob.
      Parameters:
      ctx - the router context
      next - the job to run after creation
  • Method Details

    • getName

      public String getName()
      Description copied from interface: Job
      Descriptive name of the task.
      Returns:
      the descriptive name of the task
    • runJob

      public void runJob()
      Description copied from interface: Job
      Actually perform the task. This call blocks until the Job is complete.
    • createRouterInfo

      RouterInfo createRouterInfo()
      Writes 6 files: router.info (standard RI format), router.keys.dat, and 4 individual key files under keyBackup/

      router.keys.dat file format: This is the same "eepPriv.dat" format used by the client code, as documented in PrivateKeyFile.

      Old router.keys file format: Note that this is NOT the same "eepPriv.dat" format used by the client code.

       - Private key (256 bytes)
       - Signing Private key (20 bytes)
       - Public key (256 bytes)
       - Signing Public key (128 bytes)
       Total 660 bytes
      

      Caller must hold Router.routerInfoFileLock.

      Returns:
      the created RouterInfo, or null on failure
    • getSigTypeConfig

      public static SigType getSigTypeConfig(RouterContext ctx)
      The configured SigType to expect on read-in.
      Parameters:
      ctx - the router context
      Returns:
      the configured signature type
    • getEncTypeConfig

      public static EncType getEncTypeConfig(RouterContext ctx)
      The configured EncType to expect on read-in.
      Parameters:
      ctx - the router context
      Returns:
      the configured encryption type
    • getCurrentPublishDate

      static long getCurrentPublishDate(RouterContext context)
      We probably don't want to expose the exact time at which a router published its info. perhaps round down to the nearest minute? 10 minutes? 30 minutes? day?
      Parameters:
      context - the router context
      Returns:
      the current time as publish date
    • createCertificate

      private static Certificate createCertificate(RouterContext ctx, SigningPublicKey spk, PublicKey pk)
      Only called at startup via LoadRouterInfoJob and RebuildRouterInfoJob. Not called by periodic RepublishLocalRouterInfoJob. We don't want to change the cert on the fly as it changes the router hash. RouterInfo.isHidden() checks the capability, but RouterIdentity.isHidden() checks the cert. There's no reason to ever add a hidden cert?
      Parameters:
      ctx - the router context, consulted for the hidden property
      spk - the signing public key to certify
      pk - the encryption public key to certify
      Returns:
      the certificate for a new RouterInfo - probably a null cert.