Code Monkey home page Code Monkey logo

Comments (2)

msfidelis avatar msfidelis commented on June 19, 2024 1

@viniciusls, mata essa no peito pra gente?

from pjbank-java-sdk.

juliosilvacwb avatar juliosilvacwb commented on June 19, 2024

Problema solucionado.

Trata-se de uma configuração de SSL, para corrigir foi necessário editar a classe PJBankClient, alterando o conteúdo do método getHttpClient para:

`try {
System.setProperty("jsse.enableSNIExtension", "true");
Security.insertProviderAt(new BouncyCastleProvider(), 1);
KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
SSLContextBuilder sslBuilder = new SSLContextBuilder();

	   	sslBuilder.loadTrustMaterial(trustStore, new TrustStrategy() {
	   		@Override
	   		public boolean isTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
	   			return true;
	   		}
	   	});

	   	@SuppressWarnings("deprecation")
		SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslBuilder.build(), new String[] { "TLSv1.2", "TLSv1.1", "TLSv1", "SSLv3"}, null, SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
	   
	   	PlainConnectionSocketFactory pcsf = new PlainConnectionSocketFactory();
	   	
	   	@SuppressWarnings("rawtypes")
		Registry socketFactoryRegistry = RegistryBuilder.create().register("https", sslsf).register("http", pcsf).build();
	   
	   	
	   	@SuppressWarnings("unchecked")
		PoolingHttpClientConnectionManager multiConnectionManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
	   	multiConnectionManager.setMaxTotal(100);
	   	multiConnectionManager.setDefaultMaxPerRoute(10);
	   
	   	HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
	   	httpClientBuilder.setConnectionManager(multiConnectionManager);
	   	
		return httpClientBuilder.disableContentCompression().setSSLSocketFactory(sslsf).build();
		
		
	} catch (KeyStoreException | NoSuchAlgorithmException | KeyManagementException e) {
		e.printStackTrace();
	}` 

from pjbank-java-sdk.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.