static void setCertOptions(TCPSSLOptions options, KeyCertOptions keyCertOptions) { if (keyCertOptions == null) { return; } if (keyCertOptions instanceof JksOptions) { options.setKeyStoreOptions((JksOptions) keyCertOptions); } else if (keyCertOptions instanceof PfxOptions) { options.setPfxKeyCertOptions((PfxOptions) keyCertOptions); } else { options.setPemKeyCertOptions((PemKeyCertOptions) keyCertOptions); } }
@Override public EventBusOptions setSsl(boolean ssl) { super.setSsl(ssl); return this; }
@Override public EventBusOptions addCrlPath(String crlPath) throws NullPointerException { super.addCrlPath(crlPath); return this; }
static void setTrustOptions(TCPSSLOptions sslOptions, TrustOptions options) { if (options == null) { return; } if (options instanceof JksOptions) { sslOptions.setTrustStoreOptions((JksOptions) options); } else if (options instanceof PfxOptions) { sslOptions.setPfxTrustOptions((PfxOptions) options); } else { sslOptions.setPemTrustOptions((PemTrustOptions) options); } }
((Iterable<Object>)member.getValue()).forEach( item -> { if (item instanceof String) obj.addCrlPath((String)item); }); ((Iterable<Object>)member.getValue()).forEach( item -> { if (item instanceof String) obj.addCrlValue(io.vertx.core.buffer.Buffer.buffer(java.util.Base64.getDecoder().decode((String)item))); }); ((Iterable<Object>)member.getValue()).forEach( item -> { if (item instanceof String) obj.addEnabledCipherSuite((String)item); }); list.add((String)item); }); obj.setEnabledSecureTransportProtocols(list); obj.setIdleTimeout(((Number)member.getValue()).intValue()); obj.setIdleTimeoutUnit(java.util.concurrent.TimeUnit.valueOf((String)member.getValue())); obj.setJdkSslEngineOptions(new io.vertx.core.net.JdkSSLEngineOptions((JsonObject)member.getValue())); obj.setKeyStoreOptions(new io.vertx.core.net.JksOptions((JsonObject)member.getValue())); obj.setOpenSslEngineOptions(new io.vertx.core.net.OpenSSLEngineOptions((JsonObject)member.getValue()));
private static TCPSSLOptions buildTCPSSLOptions(SSLOption sslOption, SSLCustom sslCustom, TCPSSLOptions tcpClientOptions) { tcpClientOptions.setSsl(true); tcpClientOptions.setOpenSslEngineOptions(new OpenSSLEngineOptions()); keyPfxOptions.setPath(sslCustom.getFullPath(sslOption.getKeyStore())); keyPfxOptions.setPassword(new String(sslCustom.decode(sslOption.getKeyStoreValue().toCharArray()))); tcpClientOptions.setPfxKeyCertOptions(keyPfxOptions); } else if (STORE_JKS.equalsIgnoreCase(sslOption.getKeyStoreType())) { JksOptions keyJksOptions = new JksOptions(); keyJksOptions.setPath(sslCustom.getFullPath(sslOption.getKeyStore())); keyJksOptions.setPassword(new String(sslCustom.decode(sslOption.getKeyStoreValue().toCharArray()))); tcpClientOptions.setKeyStoreOptions(keyJksOptions); } else { throw new IllegalArgumentException("invalid key store type."); trustPfxOptions .setPassword(new String(sslCustom.decode(sslOption.getTrustStoreValue().toCharArray()))); tcpClientOptions.setPfxTrustOptions(trustPfxOptions); } else if (STORE_JKS.equalsIgnoreCase(sslOption.getTrustStoreType())) { JksOptions trustJksOptions = new JksOptions(); trustJksOptions .setPassword(new String(sslCustom.decode(sslOption.getTrustStoreValue().toCharArray()))); tcpClientOptions.setTrustStoreOptions(trustJksOptions); } else { throw new IllegalArgumentException("invalid trust store type."); .setEnabledSecureTransportProtocols(new HashSet<String>(Arrays.asList(sslOption.getProtocols().split(","))));
private static TCPSSLOptions buildTCPSSLOptions(SSLOption sslOption, SSLCustom sslCustom, TCPSSLOptions httpClientOptions) { httpClientOptions.setSsl(true); if (isFileExists(sslCustom.getFullPath(sslOption.getKeyStore()))) { if (STORE_PKCS12.equalsIgnoreCase(sslOption.getKeyStoreType())) { keyPfxOptions.setPath(sslCustom.getFullPath(sslOption.getKeyStore())); keyPfxOptions.setPassword(new String(sslCustom.decode(sslOption.getKeyStoreValue().toCharArray()))); httpClientOptions.setPfxKeyCertOptions(keyPfxOptions); } else if (STORE_JKS.equalsIgnoreCase(sslOption.getKeyStoreType())) { JksOptions keyJksOptions = new JksOptions(); keyJksOptions.setPath(sslCustom.getFullPath(sslOption.getKeyStore())); keyJksOptions.setPassword(new String(sslCustom.decode(sslOption.getKeyStoreValue().toCharArray()))); httpClientOptions.setKeyStoreOptions(keyJksOptions); } else { throw new IllegalArgumentException("invalid key store type."); trustPfxOptions .setPassword(new String(sslCustom.decode(sslOption.getTrustStoreValue().toCharArray()))); httpClientOptions.setPfxTrustOptions(trustPfxOptions); } else if (STORE_JKS.equalsIgnoreCase(sslOption.getTrustStoreType())) { JksOptions trustJksOptions = new JksOptions(); trustJksOptions .setPassword(new String(sslCustom.decode(sslOption.getTrustStoreValue().toCharArray()))); httpClientOptions.setTrustStoreOptions(trustJksOptions); } else { throw new IllegalArgumentException("invalid trust store type."); httpClientOptions.addEnabledSecureTransportProtocol(protocol);
@Override public Handler<TCPSSLOptions> parse(final JsonObject options) { return Fn.getNull(() -> { final PemKeyCertOptions pem = Fn.getSemi( null == options || !options.containsKey(PATH_KEY) || !options.containsKey(PATH_CERT), LOGGER, Cert.SERVER_PEM, () -> new PemKeyCertOptions().setKeyPath(PATH_KEY).setCertPath(PATH_CERT) ); return option -> option .setSsl(true) .setUseAlpn(true) .setPemKeyCertOptions(pem) .setOpenSslEngineOptions(new OpenSSLEngineOptions()); }, options); } }
@Override public EventBusOptions setKeyStoreOptions(JksOptions options) { super.setKeyStoreOptions(options); return this; }
@Override public ClientOptionsBase setPfxKeyCertOptions(PfxOptions options) { return (ClientOptionsBase) super.setPfxKeyCertOptions(options); }
@Override public EventBusOptions setPemKeyCertOptions(PemKeyCertOptions options) { super.setPemKeyCertOptions(options); return this; }
@Override public EventBusOptions setTrustStoreOptions(JksOptions options) { super.setTrustStoreOptions(options); return this; }
@Override public EventBusOptions addEnabledCipherSuite(String suite) { super.addEnabledCipherSuite(suite); return this; }
@Override public EventBusOptions setPfxTrustOptions(PfxOptions options) { super.setPfxTrustOptions(options); return this; }
@Override public ClientOptionsBase setOpenSslEngineOptions(OpenSSLEngineOptions sslEngineOptions) { return (ClientOptionsBase) super.setOpenSslEngineOptions(sslEngineOptions); }
@Override public NetServerOptions addEnabledSecureTransportProtocol(final String protocol) { super.addEnabledSecureTransportProtocol(protocol); return this; }
((Iterable<Object>)member.getValue()).forEach( item -> { if (item instanceof String) obj.addCrlPath((String)item); }); ((Iterable<Object>)member.getValue()).forEach( item -> { if (item instanceof String) obj.addCrlValue(io.vertx.core.buffer.Buffer.buffer(java.util.Base64.getDecoder().decode((String)item))); }); ((Iterable<Object>)member.getValue()).forEach( item -> { if (item instanceof String) obj.addEnabledCipherSuite((String)item); }); list.add((String)item); }); obj.setEnabledSecureTransportProtocols(list); obj.setIdleTimeout(((Number)member.getValue()).intValue()); obj.setIdleTimeoutUnit(java.util.concurrent.TimeUnit.valueOf((String)member.getValue())); obj.setJdkSslEngineOptions(new io.vertx.core.net.JdkSSLEngineOptions((JsonObject)member.getValue())); obj.setKeyStoreOptions(new io.vertx.core.net.JksOptions((JsonObject)member.getValue())); obj.setOpenSslEngineOptions(new io.vertx.core.net.OpenSSLEngineOptions((JsonObject)member.getValue()));
private static TCPSSLOptions buildTCPSSLOptions(SSLOption sslOption, SSLCustom sslCustom, TCPSSLOptions tcpClientOptions) { tcpClientOptions.setSsl(true); tcpClientOptions.setOpenSslEngineOptions(new OpenSSLEngineOptions()); keyPfxOptions.setPath(sslCustom.getFullPath(sslOption.getKeyStore())); keyPfxOptions.setPassword(new String(sslCustom.decode(sslOption.getKeyStoreValue().toCharArray()))); tcpClientOptions.setPfxKeyCertOptions(keyPfxOptions); } else if (STORE_JKS.equalsIgnoreCase(sslOption.getKeyStoreType())) { JksOptions keyJksOptions = new JksOptions(); keyJksOptions.setPath(sslCustom.getFullPath(sslOption.getKeyStore())); keyJksOptions.setPassword(new String(sslCustom.decode(sslOption.getKeyStoreValue().toCharArray()))); tcpClientOptions.setKeyStoreOptions(keyJksOptions); } else { throw new IllegalArgumentException("invalid key store type."); trustPfxOptions .setPassword(new String(sslCustom.decode(sslOption.getTrustStoreValue().toCharArray()))); tcpClientOptions.setPfxTrustOptions(trustPfxOptions); } else if (STORE_JKS.equalsIgnoreCase(sslOption.getTrustStoreType())) { JksOptions trustJksOptions = new JksOptions(); trustJksOptions .setPassword(new String(sslCustom.decode(sslOption.getTrustStoreValue().toCharArray()))); tcpClientOptions.setTrustStoreOptions(trustJksOptions); } else { throw new IllegalArgumentException("invalid trust store type."); .setEnabledSecureTransportProtocols(new HashSet<String>(Arrays.asList(sslOption.getProtocols().split(","))));
@Override public Handler<TCPSSLOptions> parse(final JsonObject options) { return Fn.getNull(() -> { final PemKeyCertOptions pem = Fn.getSemi( null == options || !options.containsKey(PATH_KEY) || !options.containsKey(PATH_CERT), LOGGER, Cert.SERVER_PEM, () -> new PemKeyCertOptions().setKeyPath(PATH_KEY).setCertPath(PATH_CERT) ); return option -> option .setSsl(true) .setUseAlpn(true) .setPemKeyCertOptions(pem) .setOpenSslEngineOptions(new OpenSSLEngineOptions()); }, options); } }
@Override public NetServerOptions setKeyStoreOptions(JksOptions options) { super.setKeyStoreOptions(options); return this; }