Example usage for javax.net.ssl X509KeyManager chooseServerAlias

List of usage examples for javax.net.ssl X509KeyManager chooseServerAlias

Introduction

In this page you can find the example usage for javax.net.ssl X509KeyManager chooseServerAlias.

Prototype

public String chooseServerAlias(String keyType, Principal[] issuers, Socket socket);

Source Link

Document

Choose an alias to authenticate the server side of a secure socket given the public key type and the list of certificate issuer authorities recognized by the peer (if any).

Usage

From source file:de.betterform.connector.http.ssl.BetterFORMKeyStoreManager.java

public String chooseServerAlias(String keyType, Principal[] principals, Socket socket) {
    Iterator<X509KeyManager> iterator = this.customX509KeyManagers.iterator();
    while (iterator.hasNext()) {
        X509KeyManager x509KeyManager = iterator.next();
        if (x509KeyManager.chooseServerAlias(keyType, principals, socket) != null) {
            BetterFORMKeyStoreManager.LOGGER.trace(
                    "BetterFORMKeyStoreManager.chooseServerAlias: Found server alias in custom keystore: "
                            + x509KeyManager.toString());
            //Found server alias in a custom keystore return it.
            return x509KeyManager.chooseServerAlias(keyType, principals, socket);
        }/*  w w w.  j a  v a2 s . c o m*/
    }

    //Return server alias from JAVA VM keystor or null;
    return javaDefaultKeyManager.chooseServerAlias(keyType, principals, socket);
}