Ban common name. (#1568)

This commit is contained in:
Andrzej Cichocki 2017-09-21 11:08:07 +01:00 committed by josecoll
parent 0314e650a4
commit d1e5fbb73d
2 changed files with 3 additions and 2 deletions

View File

@ -155,7 +155,7 @@ abstract class AbstractNode(open val configuration: NodeConfiguration,
* or has loaded network map data from local database */
val nodeReadyFuture: CordaFuture<Unit>
get() = _nodeReadyFuture
/** A [CordaX500Name] with null common name. */
protected val myLegalName: CordaX500Name by lazy {
val cert = loadKeyStore(configuration.nodeKeystore, configuration.keyStorePassword).getX509Certificate(X509Utilities.CORDA_CLIENT_CA)
CordaX500Name.build(cert.subjectX500Principal).copy(commonName = null)
@ -643,7 +643,7 @@ abstract class AbstractNode(open val configuration: NodeConfiguration,
val (id, name) = if (serviceInfo == null) {
// Create node identity if service info = null
Pair("identity", myLegalName.copy(commonName = null))
Pair("identity", myLegalName)
} else {
val name = serviceInfo.name ?: myLegalName.copy(commonName = serviceInfo.type.id)
Pair(serviceInfo.type.id, name)

View File

@ -79,6 +79,7 @@ data class FullNodeConfiguration(
rpcUsers.forEach {
require(it.username.matches("\\w+".toRegex())) { "Username ${it.username} contains invalid characters" }
}
require(myLegalName.commonName == null) { "Common name must be null: $myLegalName" }
}
fun calculateServices(): Set<ServiceInfo> {