From 7eabee124173af9372076045baca91fc4cba96ec Mon Sep 17 00:00:00 2001 From: josecoll Date: Tue, 12 Dec 2017 14:20:59 +0000 Subject: [PATCH] Fixed Doorman dependencies and compilation errors following rebase from OS. --- network-management/build.gradle | 10 +++------- .../corda/networkmanage/doorman/DoormanParameters.kt | 2 +- .../kotlin/com/r3/corda/networkmanage/doorman/Main.kt | 5 ++--- .../doorman/NetworkParametersConfiguration.kt | 2 +- .../corda/networkmanage/doorman/signer/LocalSigner.kt | 2 +- .../networkmanage/hsm/configuration/Configuration.kt | 2 +- .../com/r3/corda/networkmanage/hsm/utils/X509Utils.kt | 2 +- 7 files changed, 10 insertions(+), 15 deletions(-) diff --git a/network-management/build.gradle b/network-management/build.gradle index c47f136689..445f46a975 100644 --- a/network-management/build.gradle +++ b/network-management/build.gradle @@ -50,15 +50,11 @@ task integrationTest(type: Test) { dependencies { compile fileTree(dir: 'libs', include: '*.jar') + + compile project(':node-api') + compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile "net.corda:corda-node-api:$corda_release_version" - - // TODO remove this when AMQP P2P serialization context is supported. - compile "net.corda:corda-rpc:$corda_release_version" - testCompile "net.corda:corda-node-driver:$corda_release_version" - testCompile "net.corda:corda-test-common:$corda_release_version" - // Log4J: logging framework (with SLF4J bindings) compile "org.apache.logging.log4j:log4j-slf4j-impl:${log4j_version}" compile "org.apache.logging.log4j:log4j-core:${log4j_version}" diff --git a/network-management/src/main/kotlin/com/r3/corda/networkmanage/doorman/DoormanParameters.kt b/network-management/src/main/kotlin/com/r3/corda/networkmanage/doorman/DoormanParameters.kt index 6c8a694fd3..ca22c89a78 100644 --- a/network-management/src/main/kotlin/com/r3/corda/networkmanage/doorman/DoormanParameters.kt +++ b/network-management/src/main/kotlin/com/r3/corda/networkmanage/doorman/DoormanParameters.kt @@ -6,7 +6,7 @@ import com.typesafe.config.ConfigParseOptions import net.corda.core.internal.div import net.corda.core.internal.isRegularFile import net.corda.core.utilities.seconds -import net.corda.nodeapi.config.parseAs +import net.corda.nodeapi.internal.config.parseAs import java.nio.file.Path import java.nio.file.Paths import java.util.* diff --git a/network-management/src/main/kotlin/com/r3/corda/networkmanage/doorman/Main.kt b/network-management/src/main/kotlin/com/r3/corda/networkmanage/doorman/Main.kt index 8d5da0798a..80d347a5e7 100644 --- a/network-management/src/main/kotlin/com/r3/corda/networkmanage/doorman/Main.kt +++ b/network-management/src/main/kotlin/com/r3/corda/networkmanage/doorman/Main.kt @@ -5,13 +5,13 @@ import com.r3.corda.networkmanage.common.persistence.* import com.r3.corda.networkmanage.common.persistence.CertificationRequestStorage.Companion.DOORMAN_SIGNATURE import com.r3.corda.networkmanage.common.signer.NetworkMapSigner import com.r3.corda.networkmanage.common.utils.ShowHelpException +import com.r3.corda.networkmanage.common.utils.toX509Certificate import com.r3.corda.networkmanage.doorman.signer.DefaultCsrHandler import com.r3.corda.networkmanage.doorman.signer.JiraCsrHandler import com.r3.corda.networkmanage.doorman.signer.LocalSigner import com.r3.corda.networkmanage.doorman.webservice.MonitoringWebService import com.r3.corda.networkmanage.doorman.webservice.NodeInfoWebService import com.r3.corda.networkmanage.doorman.webservice.RegistrationWebService -import net.corda.client.rpc.internal.KryoClientSerializationScheme import net.corda.core.crypto.Crypto import net.corda.core.identity.CordaX500Name import net.corda.core.internal.createDirectories @@ -192,7 +192,7 @@ fun generateRootKeyPair(rootStorePath: Path, rootKeystorePass: String?, rootPriv rootStore.save(rootStorePath, rootKeystorePassword) // TODO: remove this once we create truststore for nodes. - X509Utilities.saveCertificateAsPEMFile(selfSignCert, rootStorePath.parent / "rootcert.pem") + X509Utilities.saveCertificateAsPEMFile(selfSignCert.toX509Certificate(), rootStorePath.parent / "rootcert.pem") println("Root CA keypair and certificate stored in ${rootStorePath.toAbsolutePath()}.") println(loadKeyStore(rootStorePath, rootKeystorePassword).getCertificate(X509Utilities.CORDA_ROOT_CA).publicKey) @@ -304,7 +304,6 @@ private fun initialiseSerialization() { val context = KRYO_P2P_CONTEXT nodeSerializationEnv = SerializationEnvironmentImpl( SerializationFactoryImpl().apply { - registerScheme(KryoClientSerializationScheme()) registerScheme(AMQPClientSerializationScheme()) }, context) diff --git a/network-management/src/main/kotlin/com/r3/corda/networkmanage/doorman/NetworkParametersConfiguration.kt b/network-management/src/main/kotlin/com/r3/corda/networkmanage/doorman/NetworkParametersConfiguration.kt index 112cc145a1..472d0418ad 100644 --- a/network-management/src/main/kotlin/com/r3/corda/networkmanage/doorman/NetworkParametersConfiguration.kt +++ b/network-management/src/main/kotlin/com/r3/corda/networkmanage/doorman/NetworkParametersConfiguration.kt @@ -7,7 +7,7 @@ import net.corda.core.identity.Party import net.corda.core.internal.exists import net.corda.core.utilities.days import net.corda.core.utilities.parsePublicKeyBase58 -import net.corda.nodeapi.config.parseAs +import net.corda.nodeapi.internal.config.parseAs import net.corda.nodeapi.internal.NetworkParameters import net.corda.nodeapi.internal.NotaryInfo import java.nio.file.Path diff --git a/network-management/src/main/kotlin/com/r3/corda/networkmanage/doorman/signer/LocalSigner.kt b/network-management/src/main/kotlin/com/r3/corda/networkmanage/doorman/signer/LocalSigner.kt index 900c8c8017..8f65d4d29e 100644 --- a/network-management/src/main/kotlin/com/r3/corda/networkmanage/doorman/signer/LocalSigner.kt +++ b/network-management/src/main/kotlin/com/r3/corda/networkmanage/doorman/signer/LocalSigner.kt @@ -33,7 +33,7 @@ class LocalSigner(private val caKeyPair: KeyPair, private val caCertPath: Array< val nameConstraints = NameConstraints( arrayOf(GeneralSubtree(GeneralName(GeneralName.directoryName, request.subject))), arrayOf()) - val clientCertificate = X509Utilities.createCertificate(CertificateType.CLIENT_CA, + val clientCertificate = X509Utilities.createCertificate(CertificateType.NODE_CA, caCertPath.first().toX509CertHolder(), caKeyPair, CordaX500Name.parse(request.subject.toString()).copy(commonName = X509Utilities.CORDA_CLIENT_CA_CN), diff --git a/network-management/src/main/kotlin/com/r3/corda/networkmanage/hsm/configuration/Configuration.kt b/network-management/src/main/kotlin/com/r3/corda/networkmanage/hsm/configuration/Configuration.kt index 71a9823646..020b937ac4 100644 --- a/network-management/src/main/kotlin/com/r3/corda/networkmanage/hsm/configuration/Configuration.kt +++ b/network-management/src/main/kotlin/com/r3/corda/networkmanage/hsm/configuration/Configuration.kt @@ -13,7 +13,7 @@ import com.r3.corda.networkmanage.hsm.configuration.Parameters.Companion.DEFAULT import com.typesafe.config.ConfigFactory import com.typesafe.config.ConfigParseOptions import net.corda.core.internal.div -import net.corda.nodeapi.config.parseAs +import net.corda.nodeapi.internal.config.parseAs import net.corda.nodeapi.internal.crypto.X509Utilities import net.corda.nodeapi.internal.persistence.DatabaseConfig import java.nio.file.Path diff --git a/network-management/src/main/kotlin/com/r3/corda/networkmanage/hsm/utils/X509Utils.kt b/network-management/src/main/kotlin/com/r3/corda/networkmanage/hsm/utils/X509Utils.kt index 4876c721d0..671841746d 100644 --- a/network-management/src/main/kotlin/com/r3/corda/networkmanage/hsm/utils/X509Utils.kt +++ b/network-management/src/main/kotlin/com/r3/corda/networkmanage/hsm/utils/X509Utils.kt @@ -181,7 +181,7 @@ object X509Utilities { val nameConstraints = NameConstraints(arrayOf(GeneralSubtree(GeneralName(GeneralName.directoryName, CordaX500Name.parse(jcaRequest.subject.toString()).copy(commonName = null).x500Name))), arrayOf()) val issuerCertificate = caCertAndKey.certificate val issuerKeyPair = caCertAndKey.keyPair - val certificateType = CertificateType.CLIENT_CA + val certificateType = CertificateType.NODE_CA val validityWindow = getCertificateValidityWindow(0, validDays, issuerCertificate.notBefore, issuerCertificate.notAfter) val serial = BigInteger.valueOf(random63BitValue(provider)) val subject = CordaX500Name.parse(jcaRequest.subject.toString()).copy(commonName = X509Utilities.CORDA_CLIENT_CA_CN).x500Name