java.lang.Object
net.i2p.router.tunnel.OutboundGatewayProcessor
Turn the preprocessed tunnel data into something that can be delivered to the first hop in the tunnel. The crypto used in this class is also used by the InboundEndpointProcessor, as it's the same 'undo' function of the tunnel crypto.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TunnelCreatorConfigThe tunnel this processor runs.private final I2PAppContextThe router context the tunnel runs in.Constructor Summary
ConstructorsConstructorDescriptionBinds the router context and tunnel creator config.Method Summary
Modifier and TypeMethodDescription(package private) static voiddecrypt(I2PAppContext ctx, byte[] orig, int offset, int length, HopConfig config) Undo the crypto for a single hop.private voiddecrypt(TunnelCreatorConfig cfg, byte[] orig, int offset, int length) Iteratively undo the crypto that the various layers in the tunnel added.voidprocess(byte[] orig, int offset, int length) Pick a random IV and wrap the preprocessed data so that it will be exposed at the endpoint - we are the outbound gateway.
Field Details
_context
The router context the tunnel runs in._config
The tunnel this processor runs.
Constructor Details
OutboundGatewayProcessor
Binds the router context and tunnel creator config.- Parameters:
ctx- the router context supplying the AES engine used for the cryptocfg- the tunnel creator config describing the hops to undo the crypto for
Method Details
process
public void process(byte[] orig, int offset, int length) Pick a random IV and wrap the preprocessed data so that it will be exposed at the endpoint - we are the outbound 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.
decrypt
Iteratively undo the crypto that the various layers in the tunnel added. This is used by the outbound gateway (preemptively undoing the crypto peers will add).- Parameters:
cfg- the tunnel config whose layers to undoorig- 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.
decrypt
Undo the crypto for a single hop. This is used by both the outbound gateway (preemptively undoing the crypto peers will add) and by the inbound endpoint.- Parameters:
ctx- the router context providing the AES engine used for the decryptionorig- 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.config- the hop config supplying the IV key and the layer key for this hop