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

org.littleshoot.proxy.extras.SelfSignedMitmManager Maven / Gradle / Ivy

Go to download

LittleProxy is a high performance HTTP proxy written in Java and using the Netty networking framework.

There is a newer version: 2.3.2
Show newest version
package org.littleshoot.proxy.extras;

import io.netty.handler.codec.http.HttpRequest;
import org.littleshoot.proxy.MitmManager;

import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLSession;

/**
 * {@link MitmManager} that uses self-signed certs for everything.
 */
public class SelfSignedMitmManager implements MitmManager {
    private final SelfSignedSslEngineSource selfSignedSslEngineSource;

    public SelfSignedMitmManager() {
        selfSignedSslEngineSource = new SelfSignedSslEngineSource(true);
    }

    SelfSignedMitmManager(String keyStorePath, boolean trustAllServers, boolean sendCerts) {
        selfSignedSslEngineSource = new SelfSignedSslEngineSource(keyStorePath, trustAllServers, sendCerts);
    }

    public SelfSignedMitmManager(SelfSignedSslEngineSource selfSignedSslEngineSource) {
        this.selfSignedSslEngineSource = selfSignedSslEngineSource;
    }

    @Override
    public SSLEngine serverSslEngine(String peerHost, int peerPort) {
        return selfSignedSslEngineSource.newSslEngine(peerHost, peerPort);
    }

    @Override
    public SSLEngine serverSslEngine() {
        return selfSignedSslEngineSource.newSslEngine();
    }

    @Override
    public SSLEngine clientSslEngineFor(HttpRequest httpRequest, SSLSession serverSslSession) {
        return selfSignedSslEngineSource.newSslEngine();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy