Return a set of SSL options with the file-based options expanded into actual files/buffers.
The file-based fields are key, cert, pfx, and ca, where ca can also be an array of files
@param options
@returns An expanded clone of the original options
336028
function resolveSSLOptions(options) {
    var toReturn = _.clone(options);
    //Resolve the file-based properties
    _.forEach(_.keys(toReturn), function(key) {
        if (key === 'cert' || key === 'key' || key === 'pfx') {
            toReturn[key] = fs.readFileSync(path.resolve(global.__appDir, toReturn[key]));
        } else if (key === 'ca') { //this can be an array
            if (_.isArray(toReturn[key])) {
                //array
                toReturn[key] = _.map(toReturn[key], function(val) {
                    return fs.readFileSync(path.resolve(global.__appDir, val));
                });
            } else {
                //Single value
                toReturn[key] = fs.readFileSync(path.resolve(global.__appDir, toReturn[key]));
            }
        }
    });
    return toReturn;
}
306993
public static SSLSocket getSocket(EncryptionOptions options, InetAddress address, int port, InetAddress localAddress, int localPort) throws IOException
    {
        SSLContext ctx = createSSLContext(options, true);
        SSLSocket socket = (SSLSocket) ctx.getSocketFactory().createSocket(address, port, localAddress, localPort);
        String[] suits = filterCipherSuites(socket.getSupportedCipherSuites(), options.cipher_suites);
        socket.setEnabledCipherSuites(suits);
        socket.setEnabledProtocols(ACCEPTED_PROTOCOLS);
        return socket;
    }
855056
public X509Certificate[] getCertificates() {
        if (this.certSubjectDNMap == null) {
            return null;
        }
        Collection certs = this.certSubjectDNMap.values();
        return (X509Certificate[]) certs.toArray(new X509Certificate[certs.size()]);
    }
1221031
public SSLFactory sslFactory()
  {
    String opensslKey = _env.get(portName() + ".openssl.key");
    
    if (opensslKey != null) {
      return opensslFactory();
    }
    
    String keyStore = _env.get(portName() + ".ssl.key-store");
    
    boolean isSsl = _env.get(portName() + ".ssl.enabled", boolean.class, false);
    
    if (! isSsl) {
      return null;
    }
    
    
    if (keyStore != null) {
      isSsl = true;
    }
    
    SSLFactoryJsse sslFactory = new SSLFactoryJsse(_env, portName());
    
    /*
    if (keyStore != null) {
      Path path = Vfs.path(keyStore);
      
      sslFactory.setKeyStoreFile(path);
      
      String password = _env.get(portName() + ".ssl.password");
      
      if (password != null) {
        sslFactory.setPassword(password);
      }
    }
    else {
      sslFactory.setSelfSignedCertificateName("baratine");
    }
    */
    
    sslFactory.init();

    return sslFactory;
  }
603358
private X509Certificate[] getPeerCertificates() {
        X509Certificate[] rc = null;
        SSLContext ssl = this.connection.getSSLContext();
        if (null != ssl && (ssl.getNeedClientAuth() || ssl.getWantClientAuth())) {
            try {
                Object[] objs = ssl.getSession().getPeerCertificates();
                if (null != objs) {
                    rc = (X509Certificate[]) objs;
                }
            } catch (Throwable t) {
                FFDCFilter.processException(t,
                                            getClass().getName(), "peercerts",
                                            new Object[] { this, ssl });
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                    Tr.event(tc, "Error getting peer certs; " + t);
                }
            }
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            if (null == rc) {
                Tr.debug(tc, "getPeerCertificates: none");
            } else {
                Tr.debug(tc, "getPeerCertificates: " + rc.length);
            }
        }
        return rc;
    }
241688
public static sslpolicylabel[] get(nitro_service service) throws Exception{
		sslpolicylabel obj = new sslpolicylabel();
		sslpolicylabel[] response = (sslpolicylabel[])obj.get_resources(service);
		return response;
	}
593905
public static ImmutableSet<OpenOption> getOptionsForChannel(Set<? extends OpenOption> options) {
    if (options.isEmpty()) {
      return DEFAULT_READ;
    }

    boolean append = options.contains(APPEND);
    boolean write = append || options.contains(WRITE);
    boolean read = !write || options.contains(READ);

    if (read) {
      if (append) {
        throw new UnsupportedOperationException("'READ' + 'APPEND' not allowed");
      }

      if (!write) {
        // ignore all write related options
        return options.contains(LinkOption.NOFOLLOW_LINKS)
            ? DEFAULT_READ_NOFOLLOW_LINKS
            : DEFAULT_READ;
      }
    }

    // options contains write or append and may also contain read
    // it does not contain both read and append
    return addWrite(options);
  }
1008786
public static sslpolicy[] get_filtered(nitro_service service, String filter) throws Exception{
		sslpolicy obj = new sslpolicy();
		options option = new options();
		option.set_filter(filter);
		sslpolicy[] response = (sslpolicy[]) obj.getfiltered(service, option);
		return response;
	}
369464
public static SSLSocketFactory getSslSocketFactory(Options options) throws SQLException {

    TrustManager[] trustManager = null;
    KeyManager[] keyManager = null;

    if (options.trustServerCertificate || options.serverSslCert != null
        || options.trustStore != null) {
      trustManager = new X509TrustManager[]{new MariaDbX509TrustManager(options)};
    }

    if (options.keyStore != null) {
      keyManager = new KeyManager[]{
          loadClientCerts(options.keyStore, options.keyStorePassword, options.keyPassword, options.keyStoreType)};
    } else {
      String keyStore = System.getProperty("javax.net.ssl.keyStore");
      String keyStorePassword = System.getProperty("javax.net.ssl.keyStorePassword");
      if (keyStore != null) {
        try {
          keyManager = new KeyManager[]{
              loadClientCerts(keyStore, keyStorePassword, keyStorePassword, options.keyStoreType)};
        } catch (SQLException queryException) {
          keyManager = null;
          logger.error("Error loading keymanager from system properties", queryException);
        }
      }
    }

    try {
      SSLContext sslContext = SSLContext.getInstance("TLS");
      sslContext.init(keyManager, trustManager, null);
      return sslContext.getSocketFactory();
    } catch (KeyManagementException keyManagementEx) {
      throw ExceptionMapper.connException("Could not initialize SSL context", keyManagementEx);
    } catch (NoSuchAlgorithmException noSuchAlgorithmEx) {
      throw ExceptionMapper
          .connException("SSLContext TLS Algorithm not unknown", noSuchAlgorithmEx);
    }
  }
992799
public static sslservice[] get(nitro_service service) throws Exception{
		sslservice obj = new sslservice();
		sslservice[] response = (sslservice[])obj.get_resources(service);
		return response;
	}
871247
public static ssl_key[] get(nitro_service client) throws Exception
	{
		ssl_key resource = new ssl_key();
		resource.validate("get");
		return (ssl_key[]) resource.get_resources(client);
	}
924485
public static sslservice[] get_filtered(nitro_service service, String filter) throws Exception{
		sslservice obj = new sslservice();
		options option = new options();
		option.set_filter(filter);
		sslservice[] response = (sslservice[]) obj.getfiltered(service, option);
		return response;
	}
1347725
public SSLEngine get() {
    try {
      String pass = env.sslKeystorePassword();
      char[] password = pass == null || pass.isEmpty() ? null : pass.toCharArray();

      KeyStore ks = env.sslKeystore();
      if (ks == null) {
        ks = KeyStore.getInstance(KeyStore.getDefaultType());
        String ksFile = env.sslKeystoreFile();
        if (ksFile == null || ksFile.isEmpty()) {
          throw new IllegalArgumentException("Path to Keystore File must not be null or empty.");
        }
        ks.load(new FileInputStream(ksFile), password);
      }
      String defaultAlgorithm = KeyManagerFactory.getDefaultAlgorithm();
      KeyManagerFactory kmf = KeyManagerFactory.getInstance(defaultAlgorithm);
      TrustManagerFactory tmf = TrustManagerFactory.getInstance(defaultAlgorithm);
      kmf.init(ks, password);
      tmf.init(ks);

      SSLContext ctx = SSLContext.getInstance("TLS");
      ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);

      SSLEngine engine = ctx.createSSLEngine();
      engine.setUseClientMode(true);
      return engine;
    } catch (Exception ex) {
      throw new SSLException("Could not create SSLEngine.", ex);
    }
  }
219766
public static KeyManagerFactory getKeyManagerFactory(String keyStoreFilename, StoreProperties storeProperties)
      throws IOException, GeneralSecurityException {
    InputStream is = getResourceAsStream(keyStoreFilename);
    if (is == null) {
      throw new FileNotFoundException("Certificate file not found: " + getFilenameInfo(keyStoreFilename));
    }
    try {
      return getKeyManagerFactory(is, storeProperties);
    }
    finally {
      try {
        is.close();
      }
      catch (IOException ex) {
        // ignore
      }
    }
  }
1355178
public static java.security.cert.X509Certificate convert(javax.security.cert.X509Certificate cert) {
        try {
            byte[] encoded = cert.getEncoded();
            ByteArrayInputStream bis = new ByteArrayInputStream(encoded);
            java.security.cert.CertificateFactory cf
                = java.security.cert.CertificateFactory.getInstance("X.509");
            return (java.security.cert.X509Certificate)cf.generateCertificate(bis);
        } catch (java.security.cert.CertificateEncodingException e) {
        } catch (javax.security.cert.CertificateEncodingException e) {
        } catch (java.security.cert.CertificateException e) {
        }
        return null;
    }
131642
function(options) {
    options = options ? _.clone(options) : {};
    options.indexKeys = this.indexKeys || options.indexKeys;
    options.unionKey = this.unionKey || options.unionKey;
    if (this.indexKey) options.indexKeys.push(this.indexKey);
    var args = [this, options];
    return nodefn.apply(_.bind(this.indexDb.readFromIndexes, this.indexDb), args);
  }
636878
public static sslcipher[] get_filtered(nitro_service service, String filter) throws Exception{
		sslcipher obj = new sslcipher();
		options option = new options();
		option.set_filter(filter);
		sslcipher[] response = (sslcipher[]) obj.getfiltered(service, option);
		return response;
	}