mirror of
https://github.com/corda/corda.git
synced 2024-12-20 13:33:12 +00:00
* remove x500 name validation when loading config file (#1137)
* added x500 name validation in Network registration. * fix for github issue #1130
This commit is contained in:
parent
1f71a6aed2
commit
3a63f0c606
@ -113,7 +113,7 @@ private class X500NameRule : Rule<String> {
|
|||||||
private class MustHaveAtLeastTwoLettersRule : Rule<String> {
|
private class MustHaveAtLeastTwoLettersRule : Rule<String> {
|
||||||
override fun validate(legalName: String) {
|
override fun validate(legalName: String) {
|
||||||
// Try to exclude names like "/", "£", "X" etc.
|
// Try to exclude names like "/", "£", "X" etc.
|
||||||
require(legalName.count { it.isLetter() } >= 3) { "Illegal input legal name '$legalName'. Legal name must have at least two letters" }
|
require(legalName.count { it.isLetter() } >= 2) { "Illegal input legal name '$legalName'. Legal name must have at least two letters" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ private fun Config.getSingleValue(path: String, type: KType): Any? {
|
|||||||
Path::class -> Paths.get(getString(path))
|
Path::class -> Paths.get(getString(path))
|
||||||
URL::class -> URL(getString(path))
|
URL::class -> URL(getString(path))
|
||||||
Properties::class -> getConfig(path).toProperties()
|
Properties::class -> getConfig(path).toProperties()
|
||||||
X500Name::class -> X500Name(getString(path)).apply(::validateX500Name)
|
X500Name::class -> X500Name(getString(path))
|
||||||
else -> if (typeClass.java.isEnum) {
|
else -> if (typeClass.java.isEnum) {
|
||||||
parseEnum(typeClass.java, getString(path))
|
parseEnum(typeClass.java, getString(path))
|
||||||
} else {
|
} else {
|
||||||
|
@ -9,9 +9,9 @@ import net.corda.core.crypto.X509Utilities.CORDA_ROOT_CA
|
|||||||
import net.corda.core.crypto.cert
|
import net.corda.core.crypto.cert
|
||||||
import net.corda.core.internal.*
|
import net.corda.core.internal.*
|
||||||
import net.corda.core.utilities.seconds
|
import net.corda.core.utilities.seconds
|
||||||
|
import net.corda.core.utilities.validateX500Name
|
||||||
import net.corda.node.services.config.NodeConfiguration
|
import net.corda.node.services.config.NodeConfiguration
|
||||||
import net.corda.node.utilities.*
|
import net.corda.node.utilities.*
|
||||||
import org.bouncycastle.cert.path.CertPath
|
|
||||||
import org.bouncycastle.openssl.jcajce.JcaPEMWriter
|
import org.bouncycastle.openssl.jcajce.JcaPEMWriter
|
||||||
import org.bouncycastle.util.io.pem.PemObject
|
import org.bouncycastle.util.io.pem.PemObject
|
||||||
import java.io.StringWriter
|
import java.io.StringWriter
|
||||||
@ -39,6 +39,7 @@ class NetworkRegistrationHelper(val config: NodeConfiguration, val certService:
|
|||||||
private val privateKeyPassword = config.keyStorePassword
|
private val privateKeyPassword = config.keyStorePassword
|
||||||
|
|
||||||
fun buildKeystore() {
|
fun buildKeystore() {
|
||||||
|
validateX500Name(config.myLegalName)
|
||||||
config.certificatesDirectory.createDirectories()
|
config.certificatesDirectory.createDirectories()
|
||||||
val caKeyStore = loadOrCreateKeyStore(config.nodeKeystore, keystorePassword)
|
val caKeyStore = loadOrCreateKeyStore(config.nodeKeystore, keystorePassword)
|
||||||
if (!caKeyStore.containsAlias(CORDA_CLIENT_CA)) {
|
if (!caKeyStore.containsAlias(CORDA_CLIENT_CA)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user