Package javax.net.ssl

Examples of javax.net.ssl.X509TrustManager


     */
    public DummySSLSocketFactory()
    {
        try
        {
            TrustManager tm = new X509TrustManager()
            {
                public X509Certificate[] getAcceptedIssuers()
                {
                    return new X509Certificate[0];
                }
View Full Code Here


      if(isClientMode && !isServerAuthMode())
      {
         // we are in client mode and do not want to perform server cert authentication
         // return a trust manager that trusts all certs
         trustManagers = new TrustManager[] {
               new X509TrustManager() {
                  public void checkClientTrusted( X509Certificate[] chain, String authType ) {}
                  public void checkServerTrusted( X509Certificate[] chain, String authType ) {}
                  public X509Certificate[] getAcceptedIssuers()  { return null; }
               }};
      }
View Full Code Here

      if (clientMode)
      {
         // we are in client mode and do not want to perform server cert
         // authentication
         // return a trust manager that trusts all certs
         return new TrustManager[] { new X509TrustManager()
         {
            public void checkClientTrusted(final X509Certificate[] chain, final String authType)
            {
            }
View Full Code Here

    {
        // Create a trust manager that does not validate certificate
        // chains
        TrustManager[] trustAllCerts = new TrustManager[]
        {
            new X509TrustManager()
            {
                public java.security.cert.X509Certificate[] getAcceptedIssuers()
                {
                    return null;
                }
View Full Code Here

            map.put(prefix + key, value);
        }
    }

    private void acceptSelfSignedCertificates() {
        TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
            public X509Certificate[] getAcceptedIssuers() {
                return null;
            }

            public void checkClientTrusted(X509Certificate[] certs, String authType) {
View Full Code Here

   
   
    @Before
    public void setup()
    {
        X509TrustManager X509 = new X509TrustManager()
        {
            public void checkClientTrusted( X509Certificate[] x509Certificates, String s ) throws CertificateException
            {
            }
View Full Code Here

    /**
     * this is completely temporary.  It allows SSL and HTTPS connections to just accept all certificates.
     */
    private static void disableCerts() {
        // Create a trust manager that does not validate certificate chains
        TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager(){
            public java.security.cert.X509Certificate[] getAcceptedIssuers() {
                return null;
            }
            public void checkClientTrusted( java.security.cert.X509Certificate[] certs, String authType ) {
            }
View Full Code Here

    // Wrap for trusting all the certificates
    public static DefaultHttpClient wrapHttpClient(DefaultHttpClient base) {
        try {
            // Create and assign a dummy TrustManager
            SSLContext ctx = SSLContext.getInstance("TLS");
            X509TrustManager tm = new X509TrustManager() {
                @Override
        public X509Certificate[] getAcceptedIssuers() {
                    return null;
                }
                @Override
View Full Code Here

            // Set up the socket factory with the KeyStore
            SSLContext context = SSLContext.getInstance("TLS");
            TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
            tmf.init(ks);
            X509TrustManager defaultTrustManager = (X509TrustManager)tmf.getTrustManagers()[0];
            SavingTrustManager tm = new SavingTrustManager(defaultTrustManager);
            context.init(null, new TrustManager[] { tm }, null);
            SSLSocketFactory factory = context.getSocketFactory();

            sslsocket = (SSLSocket)factory.createSocket(server, port);
View Full Code Here

  public static String httpGet(String url) throws Exception {
   
    DefaultHttpClient base = new DefaultHttpClient();
   
    SSLContext ctx = SSLContext.getInstance("TLS");
    X509TrustManager tm = new X509TrustManager() {

        @Override
      public void checkClientTrusted(X509Certificate[] xcs, String string) throws CertificateException {
          // just ignore => dirty trick, better import certificate in your trust store!
        }
View Full Code Here

TOP

Related Classes of javax.net.ssl.X509TrustManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.