mirror of
https://github.com/corda/corda.git
synced 2025-06-02 07:30:53 +00:00
Correct usage of hostName and cannonicalHostName in certificates to ensure the SSL certificates validate on Linux
This commit is contained in:
parent
00f897d58d
commit
c7bc5ae652
@ -522,7 +522,7 @@ object X509Utilities {
|
|||||||
val serverCert = X509Utilities.createServerCert(subject,
|
val serverCert = X509Utilities.createServerCert(subject,
|
||||||
serverKey.public,
|
serverKey.public,
|
||||||
intermediateCA,
|
intermediateCA,
|
||||||
listOf(),
|
if(host.canonicalHostName == host.hostName) listOf() else listOf(host.hostName),
|
||||||
listOf(host.hostAddress))
|
listOf(host.hostAddress))
|
||||||
|
|
||||||
val keypass = keyPassword.toCharArray()
|
val keypass = keyPassword.toCharArray()
|
||||||
|
@ -162,7 +162,7 @@ class X509UtilitiesTest {
|
|||||||
serverCertAndKey.certificate.verify(caCertAndKey.certificate.publicKey)
|
serverCertAndKey.certificate.verify(caCertAndKey.certificate.publicKey)
|
||||||
val host = InetAddress.getLocalHost()
|
val host = InetAddress.getLocalHost()
|
||||||
|
|
||||||
assertTrue { serverCertAndKey.certificate.subjectDN.name.contains("CN=" + host.hostName) }
|
assertTrue { serverCertAndKey.certificate.subjectDN.name.contains("CN=" + host.canonicalHostName) }
|
||||||
|
|
||||||
// Now sign something with private key and verify against certificate public key
|
// Now sign something with private key and verify against certificate public key
|
||||||
val testData = "123456".toByteArray()
|
val testData = "123456".toByteArray()
|
||||||
@ -261,7 +261,7 @@ class X509UtilitiesTest {
|
|||||||
val peerX500Principal = (peerChain[0] as X509Certificate).subjectX500Principal
|
val peerX500Principal = (peerChain[0] as X509Certificate).subjectX500Principal
|
||||||
val x500name = X500Name(peerX500Principal.name)
|
val x500name = X500Name(peerX500Principal.name)
|
||||||
val cn = x500name.getRDNs(BCStyle.CN).first().first.value.toString()
|
val cn = x500name.getRDNs(BCStyle.CN).first().first.value.toString()
|
||||||
val hostname = InetAddress.getLocalHost().hostName
|
val hostname = InetAddress.getLocalHost().canonicalHostName
|
||||||
assertEquals(hostname, cn)
|
assertEquals(hostname, cn)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user