mirror of
https://github.com/corda/corda.git
synced 2025-03-23 04:25:19 +00:00
Fix for CORDA-3178. FilterMyKeys now uses the key store as opposed to the cert store. (#5418)
This commit is contained in:
parent
4b5a38796f
commit
6202165957
node/src
main/kotlin/net/corda/node/services/keys
test/kotlin/net/corda/node/services/keys
@ -95,7 +95,7 @@ class BasicHSMKeyManagementService(cacheFactory: NamedCacheFactory,
|
||||
}
|
||||
|
||||
override fun filterMyKeys(candidateKeys: Iterable<PublicKey>): Iterable<PublicKey> = database.transaction {
|
||||
identityService.stripNotOurKeys(candidateKeys)
|
||||
candidateKeys.filter(::containsPublicKey)
|
||||
}
|
||||
|
||||
override fun freshKeyInternal(externalId: UUID?): PublicKey {
|
||||
|
@ -0,0 +1,27 @@
|
||||
package net.corda.node.services.keys
|
||||
|
||||
import net.corda.core.crypto.Crypto
|
||||
import net.corda.core.identity.CordaX500Name
|
||||
import net.corda.testing.common.internal.testNetworkParameters
|
||||
import net.corda.testing.core.TestIdentity
|
||||
import net.corda.testing.node.MockServices
|
||||
import org.junit.Test
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
class FilterMyKeysTests {
|
||||
@Test
|
||||
fun test() {
|
||||
val name = CordaX500Name("Roger", "Office", "GB")
|
||||
val (_, services) = MockServices.makeTestDatabaseAndPersistentServices(
|
||||
cordappPackages = emptyList(),
|
||||
initialIdentity = TestIdentity(name),
|
||||
networkParameters = testNetworkParameters(),
|
||||
moreKeys = emptySet(),
|
||||
moreIdentities = emptySet()
|
||||
)
|
||||
val ourKey = services.keyManagementService.freshKey()
|
||||
val notOurKey = Crypto.generateKeyPair().public
|
||||
val result = services.keyManagementService.filterMyKeys(listOf(ourKey, notOurKey))
|
||||
assertEquals(listOf(ourKey), result)
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user