java.lang.Object
net.i2p.router.JobImpl
net.i2p.router.startup.CreateRouterInfoJob
- All Implemented Interfaces:
Job
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 Summary
Modifier and TypeFieldDescriptionprivate final LogLogger for this class.private final JobThe job to run after the router info is published.private static final EncTypeEncryption type chosen for a new router.private static final SigTypeSignature type chosen for a new router.static final StringRouter info filename.static final StringOld router keys filename.static final StringRouter keys filename.private static final intBits of entropy in the packet padding choice.(package private) static final StringProperty for router encryption type.(package private) static final StringProperty for router signature type.Constructor Summary
ConstructorsConstructorDescriptionCreateRouterInfoJob(RouterContext ctx, Job next) Creates a new CreateRouterInfoJob.Method Summary
Modifier and TypeMethodDescriptionprivate static CertificatecreateCertificate(RouterContext ctx, SigningPublicKey spk, PublicKey pk) Only called at startup viaLoadRouterInfoJoband RebuildRouterInfoJob.(package private) RouterInfoWrites 6 files:router.info(standard RI format),router.keys.dat, and 4 individual key files under keyBackup/(package private) static longgetCurrentPublishDate(RouterContext context) We probably don't want to expose the exact time at which a router published its info.static EncTypeThe configured EncType to expect on read-in.getName()Descriptive name of the task.static SigTypeThe configured SigType to expect on read-in.voidrunJob()Actually perform the task.Methods inherited from class JobImpl
dropped, getContext, getJobId, getMadeReadyOn, getTiming, madeReady, requeue, toStringModifier and TypeMethodDescriptionvoiddropped()Default implementation does nothing.final RouterContextThe router context that this job belongs to.longgetJobId()The unique job ID for this job.longThe timestamp when this job was last made ready for execution.The timing object for this job.voidmadeReady(long now) For JobQueue only, not for external use.protected voidrequeue(long delayMs) Requeue this job to run after the specified delay.toString()
Field Details
_log
Logger for this class._next
The job to run after the router info is published.INFO_FILENAME
KEYS_FILENAME
KEYS2_FILENAME
PROP_ROUTER_SIGTYPE
Property for router signature type.- See Also:
PROP_ROUTER_ENCTYPE
Property for router encryption type.- See Also:
DEFAULT_SIGTYPE
Signature type chosen for a new router.DEFAULT_ENCTYPE
Encryption type chosen for a new router.PADDING_ENTROPY
private static final int PADDING_ENTROPYBits 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 contextnext- the job to run after creation
Method Details
getName
runJob
public void runJob()Description copied from interface:JobActually 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.datfile format: This is the same "eepPriv.dat" format used by the client code, as documented inPrivateKeyFile.Old
router.keysfile 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
The configured SigType to expect on read-in.- Parameters:
ctx- the router context- Returns:
- the configured signature type
getEncTypeConfig
The configured EncType to expect on read-in.- Parameters:
ctx- the router context- Returns:
- the configured encryption type
getCurrentPublishDate
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
Only called at startup viaLoadRouterInfoJoband 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, butRouterIdentity.isHidden()checks the cert. There's no reason to ever add a hidden cert?- Parameters:
ctx- the router context, consulted for the hidden propertyspk- the signing public key to certifypk- the encryption public key to certify- Returns:
- the certificate for a new RouterInfo - probably a null cert.