flink-instrumentation/workspace/flink-1.4.1-instrumented/flink-1.4.1/flink-runtime/src/main/java/org/apache/flink/runtime/net/SSLUtils.java
/**
	 * Creates the SSL Context for the server if SSL is configured.
	 *
	 * @param sslConfig
	 *        The application configuration
	 * @return The SSLContext object which can be used by the ssl transport server
	 * 	       Returns null if SSL is disabled
	 * @throws Exception
	 *         Thrown if there is any misconfiguration
	 */
Creates the SSL Context for the server if SSL is configured.
@param sslConfig
The application configuration
@return The SSLContext object which can be used by the ssl transport server
Returns null if SSL is disabled
@throws Exception
Thrown if there is any misconfiguration
Creates the SSL Context for the server if SSL is configured . @param sslConfig The application configuration @return The SSLContext object which can be used by the ssl transport server Returns null if SSL is disabled @throws Exception Thrown if there is any misconfiguration
public static SSLContext createSSLServerContext(Configuration sslConfig) throws Exception {
		Preconditions.checkNotNull(sslConfig);
		SSLContext serverSSLContext = null;
		if (getSSLEnabled(sslConfig)) {
			LOG.debug("Creating server SSL context from configuration");
			String keystoreFilePath = sslConfig.getString(SecurityOptions.SSL_KEYSTORE);
			String keystorePassword = sslConfig.getString(SecurityOptions.SSL_KEYSTORE_PASSWORD);
			String certPassword = sslConfig.getString(SecurityOptions.SSL_KEY_PASSWORD);
			String sslProtocolVersion = sslConfig.getString(SecurityOptions.SSL_PROTOCOL);
			Preconditions.checkNotNull(keystoreFilePath, SecurityOptions.SSL_KEYSTORE.key() + " was not configured.");
			Preconditions.checkNotNull(keystorePassword, SecurityOptions.SSL_KEYSTORE_PASSWORD.key() + " was not configured.");
			Preconditions.checkNotNull(certPassword, SecurityOptions.SSL_KEY_PASSWORD.key() + " was not configured.");
			KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
			FileInputStream keyStoreFile = null;
			try {
				keyStoreFile = new FileInputStream(new File(keystoreFilePath));
				ks.load(keyStoreFile, keystorePassword.toCharArray());
			} finally {
				if (keyStoreFile != null) {
					keyStoreFile.close();
				}
			}
			KeyManagerFactory kmf = KeyManagerFactory.getInstance(
					KeyManagerFactory.getDefaultAlgorithm());
			kmf.init(ks, certPassword.toCharArray());
			serverSSLContext = SSLContext.getInstance(sslProtocolVersion);
			serverSSLContext.init(kmf.getKeyManagers(), null, null);
		}
		return serverSSLContext;
	}
public static SSLContext createSSLServerContext ( Configuration sslConfig ) throws Exception { Preconditions . checkNotNull ( sslConfig ) ; SSLContext serverSSLContext = null ; if ( getSSLEnabled ( sslConfig ) ) { LOG . debug ( "Creating server SSL context from configuration" ) ; String keystoreFilePath = sslConfig . getString ( SecurityOptions . SSL_KEYSTORE ) ; String keystorePassword = sslConfig . getString ( SecurityOptions . SSL_KEYSTORE_PASSWORD ) ; String certPassword = sslConfig . getString ( SecurityOptions . SSL_KEY_PASSWORD ) ; String sslProtocolVersion = sslConfig . getString ( SecurityOptions . SSL_PROTOCOL ) ; Preconditions . checkNotNull ( keystoreFilePath , SecurityOptions . SSL_KEYSTORE . key ( ) + " was not configured." ) ; Preconditions . checkNotNull ( keystorePassword , SecurityOptions . SSL_KEYSTORE_PASSWORD . key ( ) + " was not configured." ) ; Preconditions . checkNotNull ( certPassword , SecurityOptions . SSL_KEY_PASSWORD . key ( ) + " was not configured." ) ; KeyStore ks = KeyStore . getInstance ( KeyStore . getDefaultType ( ) ) ; FileInputStream keyStoreFile = null ; try { keyStoreFile = new FileInputStream ( new File ( keystoreFilePath ) ) ; ks . load ( keyStoreFile , keystorePassword . toCharArray ( ) ) ; } finally { if ( keyStoreFile != null ) { keyStoreFile . close ( ) ; } } KeyManagerFactory kmf = KeyManagerFactory . getInstance ( KeyManagerFactory . getDefaultAlgorithm ( ) ) ; kmf . init ( ks , certPassword . toCharArray ( ) ) ; serverSSLContext = SSLContext . getInstance ( sslProtocolVersion ) ; serverSSLContext . init ( kmf . getKeyManagers ( ) , null , null ) ; } return serverSSLContext ; }
Creates the SSL Context for the server if SSL is configured.
Creates the SSL Context for the server if SSL is configured .
// Set up key manager factory to use the server key store // Initialize the SSLContext