/**
* Method retrieves requested server name from ExtendedSSLSession and
* uses it to return proper alias for server certificate
*
* @param session
* @return
*/
private String chooseServerAlias(ExtendedSSLSession session) {
// Pick first SNIHostName in the list of SNI names.
String hostname = null;
for (SNIServerName name : session.getRequestedServerNames()) {
if (name.getType() == StandardConstants.SNI_HOST_NAME) {
hostname = ((SNIHostName) name).getAsciiName();
break;
}
}
// If we got given a hostname over SNI, check if we have a cert and
// key for that hostname. If so, we use it.
// Otherwise, we fall back to the default certificate.
if (hostname != null && (getCertificateChain(hostname) != null
&& getPrivateKey(hostname) != null)) {
return hostname;
} else {
return def_cert_alias;
}
}
SNISSLContextContainer.java 文件源码
java
阅读 29
收藏 0
点赞 0
评论 0
项目:tigase-server
作者:
评论列表
文章目录