mirror of
https://github.com/corda/corda.git
synced 2025-02-27 03:27:34 +00:00
Use SecureHash extension method.
This commit is contained in:
parent
744f2c658a
commit
72ad9a51fe
@ -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<PersistentNodeInfo> = 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()
|
||||
|
@ -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 {
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user