title: KeyManagementException: FIPS mode: only SunJSSE TrustManagers may be used
body: <p>i use custom <strong>DummySocketFactory</strong> and <strong>DummyTrustMAnager</strong> to connect to smtp over TLS.
  DummySocketFactory:</p>
  
  <pre><code>package XMailMessenger;
  
  public class DummySSLSocketFactory extends SSLSocketFactory {
  private SSLSocketFactory factory;
  
  public DummySSLSocketFactory() {
  try {
  
  
      SSLContext sslcontext = SSLContext.getInstance("TLS");
      //Security.removeProvider("SunJSSE");
      sslcontext.init(null,
               new TrustManager[] { new DummyTrustManager()},
              null );
      factory = (SSLSocketFactory)sslcontext.getSocketFactory();
  
  } catch(Exception ex) {
      System.out.println(ex.toString());
  }
  }
  
  public static SocketFactory getDefault() {
      SocketFactory a = new DummySSLSocketFactory();
      if ( a == null ) { System.out.println("1"); }
      return a;
  }
   ...
  </code></pre>
  
  <p>DummyTrustManager:</p>
  
  <pre><code>public class DummyTrustManager implements X509TrustManager{
  
  public void checkClientTrusted(X509Certificate[] cert, String authType) {
  // everything is trusted
  
  
  }
  
  public void checkServerTrusted(X509Certificate[] cert, String authType) {
  // everything is trusted
  }
  
  public X509Certificate[] getAcceptedIssuers() {
  return new X509Certificate[0];
      //return null;
  }
  }
  </code></pre>
  
  <p>in sending e-mail i receive exception as in subject, this exception goes from function <strong>sslcontext.init</strong> in <strong>DummySSLSocketFactory</strong>. I debug it and noticed , that in code:</p>
  
  <pre><code>    private X509TrustManager chooseTrustManager(TrustManager[] tm)
          throws KeyManagementException {
      // We only use the first instance of X509TrustManager passed to us.
      for (int i = 0; tm != null &amp;&amp; i &lt; tm.length; i++) {
          if (tm[i] instanceof X509TrustManager) {
              if (SunJSSE.isFIPS() &amp;&amp;
                      !(tm[i] instanceof X509TrustManagerImpl)) {
                  throw new KeyManagementException
                      ("FIPS mode: only SunJSSE TrustManagers may be used");
              }
  
              if (tm[i] instanceof X509ExtendedTrustManager) {
                  return (X509TrustManager)tm[i];
              } else {
                  return new AbstractTrustManagerWrapper(
                                      (X509TrustManager)tm[i]);
              }
          }
      }
  
      // nothing found, return a dummy X509TrustManager.
      return DummyX509TrustManager.INSTANCE;
  }
  </code></pre>
  
  <p>exception occures in <strong>if (SunJSSE.isFIPS() &amp;&amp;
                          !(tm[i] instanceof X509TrustManagerImpl))</strong> expression.</p>
  
  <p>I suppose that tm[i] contains my <strong>DummyTrustManager</strong> , it can not be extended from X509TrustManagerImpl so my question is : <strong>How to disable Fips in SunJSSE</strong> ?</p>