mirror of
https://github.com/corda/corda.git
synced 2025-02-21 17:56:54 +00:00
Place the long term identity key into the KMS for now. This will all change later.
This commit is contained in:
parent
860353c4d4
commit
7d09a09070
@ -1,8 +1,6 @@
|
|||||||
package com.r3corda.node.internal
|
package com.r3corda.node.internal
|
||||||
|
|
||||||
import com.codahale.metrics.MetricRegistry
|
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.ListenableFuture
|
||||||
import com.google.common.util.concurrent.SettableFuture
|
import com.google.common.util.concurrent.SettableFuture
|
||||||
import com.r3corda.core.RunOnCallerThread
|
import com.r3corda.core.RunOnCallerThread
|
||||||
@ -49,7 +47,6 @@ import java.security.KeyPair
|
|||||||
import java.time.Clock
|
import java.time.Clock
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import java.util.*
|
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
|
* 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
|
checkpointStorage = storageServices.second
|
||||||
net = makeMessagingService()
|
net = makeMessagingService()
|
||||||
wallet = NodeWalletService(services)
|
wallet = NodeWalletService(services)
|
||||||
keyManagement = E2ETestKeyManagementService()
|
|
||||||
makeInterestRatesOracleService()
|
makeInterestRatesOracleService()
|
||||||
identity = makeIdentityService()
|
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)
|
api = APIServerImpl(this)
|
||||||
smm = StateMachineManager(services, listOf(storage, net, wallet, keyManagement, identity, platformClock), checkpointStorage, serverThread)
|
smm = StateMachineManager(services, listOf(storage, net, wallet, keyManagement, identity, platformClock), checkpointStorage, serverThread)
|
||||||
|
|
||||||
|
@ -22,13 +22,21 @@ import javax.annotation.concurrent.ThreadSafe
|
|||||||
* etc
|
* etc
|
||||||
*/
|
*/
|
||||||
@ThreadSafe
|
@ThreadSafe
|
||||||
class E2ETestKeyManagementService() : SingletonSerializeAsToken(), KeyManagementService {
|
class E2ETestKeyManagementService(initialKeys: Set<KeyPair>) : SingletonSerializeAsToken(), KeyManagementService {
|
||||||
private class InnerState {
|
private class InnerState {
|
||||||
val keys = HashMap<PublicKey, PrivateKey>()
|
val keys = HashMap<PublicKey, PrivateKey>()
|
||||||
}
|
}
|
||||||
|
|
||||||
private val mutex = ThreadBox(InnerState())
|
private val mutex = ThreadBox(InnerState())
|
||||||
|
|
||||||
|
init {
|
||||||
|
mutex.locked {
|
||||||
|
for (key in initialKeys) {
|
||||||
|
keys[key.public] = key.private
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Accessing this map clones it.
|
// Accessing this map clones it.
|
||||||
override val keys: Map<PublicKey, PrivateKey> get() = mutex.locked { HashMap(keys) }
|
override val keys: Map<PublicKey, PrivateKey> get() = mutex.locked { HashMap(keys) }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user