,也可以用一些線條的原稿的Sun JDK修補(引導類路徑)來獲得服務器SNI的工作。
類別:sun.security.ssl.ServerHandshaker
添加字段
/** Use for SNI */
private ServerNameExtension serverNameExtension = null;
修補方法的ClientHello(添加這些行)
/* Use for SNI */
this.serverNameExtension = (ServerNameExtension)mesg.extensions.get(ExtensionType.EXT_SERVER_NAME);
修補方法setupPrivateKeyAndChain(變化)
if (this.conn != null) { alias = km.chooseServerAlias(algorithm , null, this.conn);
} else { alias = km.chooseEngineServerAlias(algorithm, null, this.engine); }
to
final Principal[] principals = (this.serverNameExtension == null) ? null : this.serverNameExtension.getHostnamePrincipals();
if (this.conn != null) { alias = km.chooseServerAlias(algorithm , principals, this.conn);
} else { alias = km.chooseEngineServerAlias(algorithm, principals, this.engine); }
添加到類sun.security.ssl.ServerNameExtension
static final class ServerNamePrincipal implements Principal {
private final String name;
ServerNamePrincipal(final String name) { this.name = name; }
@Override public String getName() { return this.name; }
@Override public String toString() { return this.name; }
}
public Principal[] getHostnamePrincipals() {
final List<Principal> principals = new LinkedList<>();
for(final ServerName name : this.names) {
if(name.type == NAME_HOST_NAME) { principals.add(new ServerNamePrincipal(name.hostname)); }
}
return principals.toArray(new Principal[principals.size()]);
}
如果你有從服務器(不能在JSSE客戶端被忽略unrecognized_name警報的問題,請參見http://bugs.sun.com/ bugdatabase/view_bug.do?bug_id = 7127374)你可以關閉發送SNI:jsse.enableSNIExtension = false – eckes 2012-01-07 12:43:31
任何想法如何關閉這個小程序? – ivb 2012-05-13 09:01:58
您可以在系統控制面板中爲Applets和WebStart添加(全局)系統屬性。 JNLP文件不能指定不在安全白名單中的系統參數。 (我認爲這個列表可以在某個地方修改,但那不是官方的界面)。 – eckes 2012-06-14 05:50:32