You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@ws.apache.org by Eric BOYER <Er...@insa-toulouse.fr> on 2006/04/20 08:57:03 UTC

Pb with sslCtx.init

Hello

I have a problem with the line :
sslCtx.init(km, tm, null);

I explain :

sometimes it works, sometimes not : Grrrrrrrrrrrr
When it doesn't work, my code si blocked on this line and nothing happen

my method is :



public static SSLSocketFactory getSSLSocketFactory(String keyStoreFilename,
            String keyStorePassword) throws NoSuchAlgorithmException,
            CertificateException, UnrecoverableKeyException,
            KeyManagementException, IOException, KeyStoreException,
            ExceptionErreurInitialisation {

        char[] keyStorePasswordCharArray = keyStorePassword.toCharArray();
        KeyStore ks = KeyStore
                .getInstance(Configuration.getValue(
                        Donnee.XML_NOEUD_SERVEUR_RPC,
                        Donnee.XML_TAG_RPC_KEYSTORE_TYPE));
        ks.load(new FileInputStream(keyStoreFilename),
                keyStorePasswordCharArray);
       
        KeyManagerFactory kmf = KeyManagerFactory.getInstance(Configuration
                .getValue(Donnee.XML_NOEUD_SERVEUR_RPC,
                        Donnee.XML_TAG_RPC_SECURE_ALGORITHM));
        kmf.init(ks, keyStorePasswordCharArray);
        TrustManagerFactory tmf = 
TrustManagerFactory.getInstance(Configuration
                .getValue(Donnee.XML_NOEUD_SERVEUR_RPC,
                        Donnee.XML_TAG_RPC_SECURE_ALGORITHM));
        tmf.init(ks);
        SSLContext sslCtx = SSLContext.getInstance(Configuration.getValue(
                Donnee.XML_NOEUD_SERVEUR_RPC,
                Donnee.XML_TAG_RPC_SECURE_PROTOCOL));
        KeyManager km[] = kmf.getKeyManagers();
        TrustManager tm[] = tmf.getTrustManagers();
        sslCtx.init(km, tm, null);
     
        return (sslCtx.getSocketFactory());
    }


When I launch my code, the execution (sometimes) is blocked on this line :
sslCtx.init(km, tm, null);


Does somebody can explain me what is this line and where could it come 
from ?

thanks for your help