diff --git a/core/src/main/kotlin/net/corda/core/schemas/NodeInfoSchema.kt b/core/src/main/kotlin/net/corda/core/schemas/NodeInfoSchema.kt index c0e2d57c11..1f4d375dc9 100644 --- a/core/src/main/kotlin/net/corda/core/schemas/NodeInfoSchema.kt +++ b/core/src/main/kotlin/net/corda/core/schemas/NodeInfoSchema.kt @@ -1,6 +1,6 @@ package net.corda.core.schemas -import net.corda.core.crypto.SecureHash +import net.corda.core.crypto.sha256 import net.corda.core.identity.PartyAndCertificate import net.corda.core.node.NodeInfo import net.corda.core.serialization.deserialize @@ -102,7 +102,7 @@ object NodeInfoSchemaV1 : MappedSchema( private val persistentNodeInfos: Set = emptySet() ) { constructor(partyAndCert: PartyAndCertificate, isMain: Boolean = false) - : this(SecureHash.sha256(partyAndCert.owningKey.encoded).toString(), partyAndCert.party.name.toString(), partyAndCert.serialize().bytes, isMain) + : this(partyAndCert.owningKey.encoded.sha256().toString(), partyAndCert.party.name.toString(), partyAndCert.serialize().bytes, isMain) fun toLegalIdentityAndCert(): PartyAndCertificate { return partyCertBinary.deserialize() diff --git a/node/src/main/kotlin/net/corda/node/services/keys/PersistentKeyManagementService.kt b/node/src/main/kotlin/net/corda/node/services/keys/PersistentKeyManagementService.kt index 9e41ddff52..8eaf8fc0c9 100644 --- a/node/src/main/kotlin/net/corda/node/services/keys/PersistentKeyManagementService.kt +++ b/node/src/main/kotlin/net/corda/node/services/keys/PersistentKeyManagementService.kt @@ -44,7 +44,7 @@ class PersistentKeyManagementService(val identityService: IdentityService, var privateKey: ByteArray = ByteArray(0) ) { constructor(publicKey: PublicKey, privateKey: ByteArray) - : this(SecureHash.sha256(publicKey.encoded).toString(), privateKey) + : this(publicKey.encoded.sha256().toString(), privateKey) } private companion object { diff --git a/node/src/main/kotlin/net/corda/node/services/network/PersistentNetworkMapService.kt b/node/src/main/kotlin/net/corda/node/services/network/PersistentNetworkMapService.kt index 073b1ea0ac..f89f66c84e 100644 --- a/node/src/main/kotlin/net/corda/node/services/network/PersistentNetworkMapService.kt +++ b/node/src/main/kotlin/net/corda/node/services/network/PersistentNetworkMapService.kt @@ -1,6 +1,7 @@ package net.corda.node.services.network import net.corda.core.crypto.SecureHash +import net.corda.core.crypto.sha256 import net.corda.core.identity.PartyAndCertificate import net.corda.core.internal.ThreadBox import net.corda.core.messaging.SingleMessageRecipient @@ -9,12 +10,13 @@ import net.corda.core.serialization.deserialize import net.corda.core.serialization.serialize import net.corda.node.services.api.NetworkMapCacheInternal import net.corda.node.services.messaging.MessagingService -import net.corda.node.utilities.* +import net.corda.node.utilities.NODE_DATABASE_PREFIX +import net.corda.node.utilities.PersistentMap import net.corda.nodeapi.ArtemisMessagingComponent import java.io.ByteArrayInputStream import java.security.cert.CertificateFactory -import javax.persistence.* import java.util.* +import javax.persistence.* /** * A network map service backed by a database to survive restarts of the node hosting it. @@ -66,7 +68,7 @@ class PersistentNetworkMapService(network: MessagingService, networkMapCache: Ne }, toPersistentEntity = { key: PartyAndCertificate, value: NodeRegistrationInfo -> NetworkNode( - publicKeyHash = SecureHash.sha256(key.owningKey.encoded).toString(), + publicKeyHash = key.owningKey.encoded.sha256().toString(), nodeParty = NodeParty( key.name.toString(), key.certificate.encoded,