mirror of
https://github.com/corda/corda.git
synced 2024-12-24 07:06:44 +00:00
Merged in mike-kms-has-identity-key (pull request #155)
Place the long term identity key into the KMS for now. This will all change later.
This commit is contained in:
commit
77b3f3968e
@ -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)
|
||||
|
||||
|
@ -22,13 +22,21 @@ import javax.annotation.concurrent.ThreadSafe
|
||||
* etc
|
||||
*/
|
||||
@ThreadSafe
|
||||
class E2ETestKeyManagementService() : SingletonSerializeAsToken(), KeyManagementService {
|
||||
class E2ETestKeyManagementService(initialKeys: Set<KeyPair>) : SingletonSerializeAsToken(), KeyManagementService {
|
||||
private class InnerState {
|
||||
val keys = HashMap<PublicKey, PrivateKey>()
|
||||
}
|
||||
|
||||
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<PublicKey, PrivateKey> get() = mutex.locked { HashMap(keys) }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user