From ac99b81ba895b174b885dad18aed3c90ed66beca Mon Sep 17 00:00:00 2001 From: Patrick Kuo Date: Wed, 18 Apr 2018 17:10:04 +0100 Subject: [PATCH] added optional config property for keystore file path (#748) --- network-management/registration-tool/README.md | 2 ++ .../networkmanage/registration/NotaryRegistrationTool.kt | 4 +++- .../networkmanage/registration/RegistrationConfigTest.kt | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/network-management/registration-tool/README.md b/network-management/registration-tool/README.md index b6837abc35..362bdceb96 100644 --- a/network-management/registration-tool/README.md +++ b/network-management/registration-tool/README.md @@ -25,6 +25,8 @@ networkRootTrustStorePassword Network root trust store password, to be provide keyStorePassword Generated keystore's password. Optional, the tool will prompt for password input if not provided. trustStorePassword Generated trust store's password. Optional, the tool will prompt for password input if not provided. + +keystorePath [Optional] Path of the generated keystore file, default to certificates/notaryidentitykeystore.jks ``` Example config file diff --git a/network-management/registration-tool/src/main/kotlin/com/r3/corda/networkmanage/registration/NotaryRegistrationTool.kt b/network-management/registration-tool/src/main/kotlin/com/r3/corda/networkmanage/registration/NotaryRegistrationTool.kt index 7acf37cdd8..7d3cee7e33 100644 --- a/network-management/registration-tool/src/main/kotlin/com/r3/corda/networkmanage/registration/NotaryRegistrationTool.kt +++ b/network-management/registration-tool/src/main/kotlin/com/r3/corda/networkmanage/registration/NotaryRegistrationTool.kt @@ -43,6 +43,7 @@ fun RegistrationOption.runRegistration() { override val trustStorePassword: String by lazy { config.trustStorePassword ?: readPassword("Node TrustStore password:") } val parent = configFile.parent override val certificatesDirectory: Path = if (parent != null) parent / "certificates" else Paths.get("certificates") + override val nodeKeystore: Path get() = config.keystorePath ?: certificatesDirectory/"notaryidentitykeystore.jks" } NetworkRegistrationHelper(sslConfig, @@ -59,4 +60,5 @@ data class NotaryRegistrationConfig(val legalName: CordaX500Name, val networkRootTrustStorePath: Path, val keyStorePassword: String?, val networkRootTrustStorePassword: String?, - val trustStorePassword: String?) + val trustStorePassword: String?, + val keystorePath: Path?) diff --git a/network-management/registration-tool/src/test/kotlin/com/r3/corda/networkmanage/registration/RegistrationConfigTest.kt b/network-management/registration-tool/src/test/kotlin/com/r3/corda/networkmanage/registration/RegistrationConfigTest.kt index 3979db6f02..b99eef3f6f 100644 --- a/network-management/registration-tool/src/test/kotlin/com/r3/corda/networkmanage/registration/RegistrationConfigTest.kt +++ b/network-management/registration-tool/src/test/kotlin/com/r3/corda/networkmanage/registration/RegistrationConfigTest.kt @@ -32,6 +32,7 @@ legalName { email = "test@email.com" compatibilityZoneURL = "http://doorman.url.com" networkRootTrustStorePath = "networkRootTrustStore.jks" +keystorePath = "notaryidentitykeystore.jks" networkRootTrustStorePassword = "password" keyStorePassword = "password" @@ -47,5 +48,6 @@ trustStorePassword = "password" assertEquals("test@email.com", config.email) assertEquals(Paths.get("networkRootTrustStore.jks"), config.networkRootTrustStorePath) assertEquals("password", config.networkRootTrustStorePassword) + assertEquals(Paths.get("notaryidentitykeystore.jks"), config.keystorePath) } } \ No newline at end of file