2014-02-24 13 views
0

我正在开发一个Web应用程序,它使用用客户CA颁发的证书签名的小程序。该证书包含到CRL分发点的URL,该URL不定义主机和端口。证书属性“CRL分发点”和“授权信息访问”包含类似于“ldap:/// CN = my-cn ...”的URL。小程序证书CRL分发点LDAP URL没有主机

证书吊销检查API(C:\ Users [my_user] \ AppData \ LocalLow \ Sun \ Java \ Deployment \ log)生成的日志文件表明正在使用值“localhost”和“389”为主机和端口。这是日志文件的一部分:

... 
certpath: DistributionPointFetcher.getCRLs: Checking CRLDPs for CN=xxx, O=yyy, L=zzz, C=PT 
certpath: Trying to fetch CRL from DP ldap:///CN=_my-cn_?certificateRevocationList?base?objectClass=cRLDistributionPoint 
certpath: CertStore URI:ldap:///CN=_my-cn_?certificateRevocationList?base?objectClass=cRLDistributionPoint 
... 
network: Connecting http://localhost:389/ with proxy=DIRECT 
... 
certpath: LDAPCertStore.engineInit about to throw InvalidAlgorithmParameterException 
javax.naming.CommunicationException: localhost:389 [Root exception is java.net.ConnectException: Connection refused: connect] 
    at com.sun.jndi.ldap.Connection.<init>(Unknown Source) 
... 

任何人都可以确认主机是强制性的,否则使用默认值“localhost”?

我在LDAP RFC(http://www.ietf.org/rfc/rfc4516.txt)中读到,如果“host”字段不存在,则客户端必须具有一些关于要联系的适当LDAP服务器的先验知识。可以配置“主机”属性吗?

我正在使用JRE版本1.7.0_45(build 1.7.0_45-b18)。

谢谢 圣特尔莫西蒙斯

回答

0

是,主机是强制性的。

它取决于你的代码如何创建LDAPCertStore对象。当您调用构造函数时,您需要将一个LDAPCertStoreParameters对象传递给它。该类包含一个构造器,它允许您指定主机(和端口)。

尝试创建LDAPCertStore这样的:

LDAPCertStoreParameters params = new LDAPCertStoreParameters("hostname", 389); 
CertStore store = CertStore.getInstance("LDAP", params); 

好运。