From 6bc44b96f1912f0da27ac654819ba2644717d051 Mon Sep 17 00:00:00 2001 From: Viktor Kolomeyko <31008341+vkolomeyko@users.noreply.github.com> Date: Fri, 1 Sep 2017 13:14:39 +0100 Subject: [PATCH] CORDA-540: Stop breaking PartyAndCertificate when persisting it in binary form (#1384) Breaking on multiple parts causes a problem in AMQP mode when X509 Certificate path cannot be serialized on its own --- .../net/corda/core/schemas/NodeInfoSchema.kt | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) 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 1c7e6ffa31..df8016115a 100644 --- a/core/src/main/kotlin/net/corda/core/schemas/NodeInfoSchema.kt +++ b/core/src/main/kotlin/net/corda/core/schemas/NodeInfoSchema.kt @@ -8,7 +8,6 @@ import net.corda.core.serialization.serialize import net.corda.core.utilities.NetworkHostAndPort import net.corda.core.utilities.toBase58String import java.io.Serializable -import java.security.cert.CertPath import javax.persistence.* object NodeInfoSchema @@ -107,13 +106,9 @@ object NodeInfoSchemaV1 : MappedSchema( @Column(name = "party_name", nullable = false) val name: String, - @Column(name = "certificate") + @Column(name = "party_cert_binary") @Lob - val certificate: ByteArray, - - @Column(name = "certificate_path") - @Lob - val certPath: ByteArray, + val partyCertBinary: ByteArray, val isMain: Boolean, @@ -121,9 +116,10 @@ object NodeInfoSchemaV1 : MappedSchema( private val persistentNodeInfos: Set = emptySet() ) { constructor(partyAndCert: PartyAndCertificate, isMain: Boolean = false) - : this(partyAndCert.party.owningKey.toBase58String(), partyAndCert.party.name.toString(), partyAndCert.certificate.serialize().bytes, partyAndCert.certPath.serialize().bytes, isMain) + : this(partyAndCert.party.owningKey.toBase58String(), partyAndCert.party.name.toString(), partyAndCert.serialize().bytes, isMain) + fun toLegalIdentityAndCert(): PartyAndCertificate { - return PartyAndCertificate(certPath.deserialize()) + return partyCertBinary.deserialize() } } }