两个具有相同域名的证书

时间:2012-03-06 01:27:25

标签: jboss certificate

我已将两个证书添加到我的服务器(jboss)密钥库中,其域名均为“localhost”。所以现在如果本地客户端访问服务器,哪些证书将被发送到客户端 jboss中没有抛出错误,它运行正常。我只是想知道jboss如何选择要发送的证书?

列出java程序使用的信任库的内容。

Your keystore contains 2 entries

tomcat, 5 Mar, 2012, trustedCertEntry,
Certificate fingerprint (SHA1): B0:F0:98:5F:E5:D0:D6:24:58:B6:38:07:97:38:95:D5:
AB:28:E1:1E
tomcat1, 6 Mar, 2012, trustedCertEntry,
Certificate fingerprint (SHA1): C4:2B:E8:14:F9:85:5A:05:F2:1F:58:AE:65:FB:0E:8F:
DD:23:97:87


tomcat和tomcat1都有cn=localhost
列出jboss使用的keysttore的内容 密钥库类型:JKS 密钥库提供商:SUN

您的密钥库包含2个条目

tomcat, 5 Mar, 2012, PrivateKeyEntry,
Certificate fingerprint (SHA1): B0:F0:98:5F:E5:D0:D6:24:58:B6:38:07:97:38:95:D5:
AB:28:E1:1E
tomcat1, 6 Mar, 2012, PrivateKeyEntry,
Certificate fingerprint (SHA1): C4:2B:E8:14:F9:85:5A:05:F2:1F:58:AE:65:FB:0E:8F:
DD:23:97:87<br>


使用keytool的列表“-v”选项显示密钥库条目asper Kevin的请求。

Keystore type: JKS
Keystore provider: SUN

Your keystore contains 2 entries

Alias name: tomcat
Creation date: 5 Mar, 2012
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=localhost
Issuer: CN=localhost
Serial number: 5aaac34c
Valid from: Mon Mar 05 15:04:46 IST 2012 until: Sun Jun 03 15:04:46 IST 2012
Certificate fingerprints:
         MD5:  6A:9D:10:37:4F:98:7F:85:D5:93:95:CC:C3:84:07:D8
         SHA1: B0:F0:98:5F:E5:D0:D6:24:58:B6:38:07:97:38:95:D5:AB:28:E1:1E
         SHA256: FB:F5:BC:9F:17:E9:28:8C:77:1B:40:17:8B:D3:12:71:05:0D:CF:9C
99:00:C4:25:76:46:CE:E0:0C:E6:6B
         Signature algorithm name: SHA256withRSA
         Version: 3

Extensions:

#1: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: F6 B3 2E B5 A0 76 78 7E   9D B6 2A D6 4A 6A 8D 96  .....vx...*.Jj..
0010: FA 7D 47 9B                                        ..G.
]
]



*******************************************
*******************************************


Alias name: tomcat1
Creation date: 6 Mar, 2012
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=localhost
Issuer: CN=localhost
Serial number: 4891416
Valid from: Tue Mar 06 06:41:21 IST 2012 until: Mon Jun 04 06:41:21 IST 2012
Certificate fingerprints:
         MD5:  B9:31:FE:75:E9:28:E6:BC:F2:94:60:93:7B:0C:00:63
         SHA1: C4:2B:E8:14:F9:85:5A:05:F2:1F:58:AE:65:FB:0E:8F:DD:23:97:87
         SHA256: 58:7B:D3:A1:2C:8E:C1:C9:26:0A:9F:A1:86:D1:79:76:34:D2:83:6A
88:0C:E1:36:F5:88:3F:DC:F7:D7:89
         Signature algorithm name: SHA256withRSA
         Version: 3

Extensions:

#1: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: F1 BF 69 B4 CA D6 9E 72   AC C3 26 9F CD 57 58 7A  ..i....r..&..WXz
0010: 62 19 8B B8                                        b...
]
]



*******************************************
*******************************************

2 个答案:

答案 0 :(得分:1)

你到底想要达到什么目的? 证书存储在密钥库中,并根据主机名匹配呈现给用户。这是不正确的,请参阅下文。

从逻辑上讲,它只会加载其中一个,而这些又将被提供给用户。

- Edit--
尝试通过指向另一个link

进行简化
  1. 假设您在jboss配置中将“keyAlias”指定为“tomcat”;然后将拾取tomcat别名
  2. 如果您未指定别名,则“将使用密钥库中的第一个密钥读取”

答案 1 :(得分:1)

默认情况下,JBoss(或Apache Tomcat)将使用默认设置默认X509KeyManager来选择要使用的证书:它将选择在密钥库中找到的第一个对密钥类型有效的证书(例如,基于RSA的密码套件的RSA)和连接时。

如果失败,如果在keyAlias中明确指定了别名,它将在该别名中选择证书(如果密钥类型不正确,它将失败)。

如果在SSLImplementation属性中给出了实现SSLImplementation的自定义类的名称,那么它将用于提供SSLSocketFactory(因此别名选择将但是要配置它SSLContext / KeyManager

支持服务器名称指示(SNI),这将允许密钥管理器使用所请求的主机名来帮助做出选择was only introduced in Java 7, and only on the client side,因此JSSE目前无法在服务器端使用它。