Java 8 TrustManagerFactory - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 TrustManagerFactory class.

This code example shows how to use the following methods: getTrustManagers
  } 
 
  private HttpsURLConnection getConnection(String urlFragment, String method) throws IOException {
    try { 
      SSLContext context = SSLContext.getInstance("TLS");
      context.init(null, trustManagerFactory.getTrustManagers(), null);
 
      URL url = new URL(String.format("https://gcm.textsecure.whispersystems.org%s", urlFragment));
      HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
      connection.setSSLSocketFactory(context.getSocketFactory());
      connection.setRequestMethod(method);
      connection.setRequestProperty("Content-Type", "application/json");
 
      if (password != null) {
        System.out.println("Adding authorization header: " + getAuthorizationHeader());
        connection.setRequestProperty("Authorization", getAuthorizationHeader());
      } 
 
      return connection;
    } catch (NoSuchAlgorithmException e) {
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getTrustManagers, init
    private void checkResult(TrustManagerFactory tmf) throws Exception {
        KeyStore kStore = null;
        ManagerFactoryParameters mfp = null;
         
        try { 
            tmf.init(kStore);
            fail("KeyStoreException must be thrown");
        } catch (KeyStoreException e) {
        } 
        try { 
            tmf.init(mfp);
            fail("InvalidAlgorithmParameterException must be thrown");
        } catch (InvalidAlgorithmParameterException e) {
        } 
        assertNull("getTrustManagers() should return null object", tmf
                .getTrustManagers());     
         
        try { 
            kStore = KeyStore.getInstance(KeyStore.getDefaultType());
            kStore.load(null, null);            

4
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getTrustManagers, TrustManagerFactory.init
This code example shows how to use the following methods: getTrustManagers, init
        TrustManagerFactory fac =
                     tmc.isSetProvider()
                     ? TrustManagerFactory.getInstance(alg, tmc.getProvider())
                     : TrustManagerFactory.getInstance(alg);
 
        fac.init(keyStore);
 
        return fac.getTrustManagers();
    } 
} 
Full Snippet Info
4
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: init
		try 
		{ 
			getKeys(keyfile, pwd);
 
			tmf = TrustManagerFactory.getInstance("SunX509");
			tmf.init(serverKeyStore);
 
			// Sets the key Manager to use X.509 protocol 
			kmf = KeyManagerFactory.getInstance("SunX509");
			kmf.init(serverKeyStore, pwd.toCharArray());
 
			secureRandom = new SecureRandom();
			secureRandom.nextInt();
		} catch (Exception e) {
			e.printStackTrace();
			throw new TransportException(e.getMessage());
		} 
	} 
 
	/** 
Full Snippet Info
3
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Java 8 TrustManagerFactory Questions & Answers:

See Code Examples for Java 8 TrustManagerFactory Methods: