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

io.vertx.up.uca.micro.ssl.CertPipe Maven / Gradle / Ivy

There is a newer version: 0.9.0
Show newest version
package io.vertx.up.uca.micro.ssl;

import io.vertx.core.Handler;
import io.vertx.core.json.JsonObject;
import io.vertx.core.net.TCPSSLOptions;
import io.vertx.up.eon.em.CertType;
import io.vertx.up.uca.micro.ssl.server.JksCert;
import io.vertx.up.uca.micro.ssl.server.PemCert;
import io.vertx.up.uca.micro.ssl.server.PfxCert;
import io.vertx.up.util.Ut;

/**
 * Different ssl pipe
 *
 * @param 
 */
public interface CertPipe {
    static CertPipe get(final CertType type) {
        // 1. OpenSSL
        CertPipe pipe = null;
        switch (type) {
            case PKCS12:
                pipe = Ut.singleton(PfxCert.class);
                break;
            case JKS:
                pipe = Ut.singleton(JksCert.class);
                break;
            case PEM:
                pipe = Ut.singleton(PemCert.class);
                break;
        }
        return pipe;
    }

    /**
     * Different pipe to parse JsonObject to generate Options
     *
     * @param options
     * @return
     */
    Handler parse(I options);
}