diff --git a/node/src/main/kotlin/com/r3corda/node/internal/AbstractNode.kt b/node/src/main/kotlin/com/r3corda/node/internal/AbstractNode.kt index 2b16592913..6a8eb1fd67 100644 --- a/node/src/main/kotlin/com/r3corda/node/internal/AbstractNode.kt +++ b/node/src/main/kotlin/com/r3corda/node/internal/AbstractNode.kt @@ -1,8 +1,6 @@ package com.r3corda.node.internal import com.codahale.metrics.MetricRegistry -import com.google.common.util.concurrent.Futures -import com.google.common.util.concurrent.JdkFutureAdapters import com.google.common.util.concurrent.ListenableFuture import com.google.common.util.concurrent.SettableFuture import com.r3corda.core.RunOnCallerThread @@ -49,7 +47,6 @@ import java.security.KeyPair import java.time.Clock import java.time.Instant import java.util.* -import java.util.concurrent.CompletableFuture /** * A base node implementation that can be customised either for production (with real implementations that do real @@ -130,9 +127,12 @@ abstract class AbstractNode(val dir: Path, val configuration: NodeConfiguration, checkpointStorage = storageServices.second net = makeMessagingService() wallet = NodeWalletService(services) - keyManagement = E2ETestKeyManagementService() makeInterestRatesOracleService() identity = makeIdentityService() + // Place the long term identity key in the KMS. Eventually, this is likely going to be separated again because + // the KMS is meant for derived temporary keys used in transactions, and we're not supposed to sign things with + // the identity key. But the infrastructure to make that easy isn't here yet. + keyManagement = E2ETestKeyManagementService(setOf(storage.myLegalIdentityKey)) api = APIServerImpl(this) smm = StateMachineManager(services, listOf(storage, net, wallet, keyManagement, identity, platformClock), checkpointStorage, serverThread) diff --git a/node/src/main/kotlin/com/r3corda/node/services/keys/E2ETestKeyManagementService.kt b/node/src/main/kotlin/com/r3corda/node/services/keys/E2ETestKeyManagementService.kt index 05c4247caf..b5abfacada 100644 --- a/node/src/main/kotlin/com/r3corda/node/services/keys/E2ETestKeyManagementService.kt +++ b/node/src/main/kotlin/com/r3corda/node/services/keys/E2ETestKeyManagementService.kt @@ -22,13 +22,21 @@ import javax.annotation.concurrent.ThreadSafe * etc */ @ThreadSafe -class E2ETestKeyManagementService() : SingletonSerializeAsToken(), KeyManagementService { +class E2ETestKeyManagementService(initialKeys: Set) : SingletonSerializeAsToken(), KeyManagementService { private class InnerState { val keys = HashMap() } private val mutex = ThreadBox(InnerState()) + init { + mutex.locked { + for (key in initialKeys) { + keys[key.public] = key.private + } + } + } + // Accessing this map clones it. override val keys: Map get() = mutex.locked { HashMap(keys) }