Como carregar keystore no android para conexao socket ssl?
já tentei de varias formas e nao consigo carregar o arquivo.
private SSLSocket criaSSLSocket(String host, int port) {
KeyStore ks;
SSLSocket Socket = null;
try {
ks = KeyStore.getInstance("JKS");
System.out.println("Loaded client certificates: " + ks.size());
//InputStream keystore = getResources().openRawResource(R.raw.mykeystore);
ks.load(getResources().openRawResource(R.raw.mykeystore), password);
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
kmf.init(ks, password);
SSLContext sslcontext = SSLContext.getInstance("SSLv3");
sslcontext.init(kmf.getKeyManagers(), null, null);
SSLSocketFactory ssf = getSSLSocketFactory();
Socket = (SSLSocket) ssf.createSocket(host, port);Pedro Menezes
Curtidas 0