Fórum Como carregar keystore no android para conexao socket ssl? #481449
05/06/2014
0
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
Curtir tópico
+ 0
Responder
Clique aqui para fazer login e interagir na Comunidade :)