java.lang.Object
net.i2p.router.tunnel.InboundEndpointProcessor
Receive the inbound tunnel message, removing all of the layers added by earlier hops to recover the preprocessed data sent by the gateway. This delegates the crypto to the OutboundGatewayProcessor, since the tunnel creator does the same thing in both instances.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TunnelCreatorConfigThe tunnel's configuration.private final RouterContextThe router ending the tunnel.private final LogLogger for this class.private final IVValidatorRejects reused initialization vectors.Constructor Summary
ConstructorsConstructorDescriptionInboundEndpointProcessor(RouterContext ctx, TunnelCreatorConfig cfg, IVValidator validator) Binds the router context, tunnel creator config, and IV validator.Method Summary
Modifier and TypeMethodDescriptionprivate voiddecrypt(RouterContext ctx, TunnelCreatorConfig cfg, byte[] orig, int offset, int length) Iteratively undo the crypto that the various layers in the tunnel added.The tunnel creator config for this endpoint.The destination this inbound tunnel was created for.booleanretrievePreprocessedData(byte[] orig, int offset, int length, Hash prev) Undo all of the encryption done by the peers in the tunnel, recovering the preprocessed data sent by the gateway.
Field Details
_context
The router ending the tunnel._log
Logger for this class._config
The tunnel's configuration._validator
Rejects reused initialization vectors.
Constructor Details
InboundEndpointProcessor
Binds the router context, tunnel creator config, and IV validator.- Parameters:
ctx- the router context supplying the log and network databasecfg- the tunnel creator config describing the inbound tunnelvalidator- the IV validator that authenticates and strips the per-message IV
Method Details
getDestination
The destination this inbound tunnel was created for.- Returns:
- the destination hash this inbound tunnel serves, or null for exploratory tunnels
getConfig
The tunnel creator config for this endpoint.- Returns:
- the config passed to the constructor, describing the inbound tunnel this processor belongs to
retrievePreprocessedData
Undo all of the encryption done by the peers in the tunnel, recovering the preprocessed data sent by the gateway.- Parameters:
orig- original data with an extra 16 byte IV prepended.offset- index into the array where the extra 16 bytes (IV) beginslength- how much of orig can we write to (must be a multiple of 16). Should always be 1024 bytes.prev- the sending peer's hash, matched against the tunnel's second-to-last hop- Returns:
- true if the data was recovered (and written in place to orig), false if it was a duplicate or from the wrong peer.
decrypt
private void decrypt(RouterContext ctx, TunnelCreatorConfig cfg, byte[] orig, int offset, int length) Iteratively undo the crypto that the various layers in the tunnel added.- Parameters:
ctx- the router context, passed on to each layer's decryptioncfg- the tunnel's configuration, supplying the crypto settings of every hop except the endpoint (this gateway created the tunnel)orig- original data with an extra 16 byte IV prepended.offset- index into the array where the extra 16 bytes (IV) beginslength- how much of orig can we write to (must be a multiple of 16). Should always be 1024 bytes.