def test_sslChainLoads(self):
"""
Specifying a chain file loads the contained certificates in the right
order.
"""
server = endpoints.serverFromString(
object(),
self.SSL_CHAIN_TEMPLATE % (escapedPEMPathName,
escapedChainPathName,)
)
# Test chain file is just a concatenation of thing1.pem and thing2.pem
# so we can check that loading has succeeded and order has been
# preserved.
expectedChainCerts = [
Certificate.loadPEM(casPath.child("thing%d.pem" % (n,))
.getContent())
for n in [1, 2]
]
cf = server._sslContextFactory
self.assertEqual(cf.extraCertChain[0].digest('sha1'),
expectedChainCerts[0].digest('sha1'))
self.assertEqual(cf.extraCertChain[1].digest('sha1'),
expectedChainCerts[1].digest('sha1'))
评论列表
文章目录