All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.i2p.router.tunnel.InboundGatewayProcessor Maven / Gradle / Ivy

There is a newer version: 2.6.0
Show newest version
package net.i2p.router.tunnel;

import net.i2p.I2PAppContext;

/**
 * Override the hop processor to seed the message with a random
 * IV.
 */
class InboundGatewayProcessor extends HopProcessor {
    public InboundGatewayProcessor(I2PAppContext ctx, HopConfig config) {
        super(ctx, config, DummyValidator.getInstance());
    }

    /**
     * Since we are the inbound gateway, use the IV given to us as the first 
     * 16 bytes, ignore the 'prev' hop, and encrypt the message like every 
     * other participant.
     *
     */
    public void process(byte orig[], int offset, int length) {
        boolean ok = super.process(orig, offset, length, null);
        if (!ok) 
            throw new RuntimeException("we are the gateway, how did it fail?");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy