mirror of
https://github.com/corda/corda.git
synced 2025-02-06 11:09:18 +00:00
Minor: reintroduce using Java serialisation for KeyPair as the JDK customises it and the Kryo serialisation is both bloated and (more problematically) non-deterministic!
This commit is contained in:
parent
0a9fffe8b7
commit
2190fbf2ee
@ -13,13 +13,16 @@ import com.esotericsoftware.kryo.KryoException
|
|||||||
import com.esotericsoftware.kryo.Serializer
|
import com.esotericsoftware.kryo.Serializer
|
||||||
import com.esotericsoftware.kryo.io.Input
|
import com.esotericsoftware.kryo.io.Input
|
||||||
import com.esotericsoftware.kryo.io.Output
|
import com.esotericsoftware.kryo.io.Output
|
||||||
|
import com.esotericsoftware.kryo.serializers.JavaSerializer
|
||||||
import core.SecureHash
|
import core.SecureHash
|
||||||
import core.SignedWireTransaction
|
import core.SignedWireTransaction
|
||||||
|
import core.TimestampCommand
|
||||||
import core.sha256
|
import core.sha256
|
||||||
import de.javakaffee.kryoserializers.ArraysAsListSerializer
|
import de.javakaffee.kryoserializers.ArraysAsListSerializer
|
||||||
import org.objenesis.strategy.StdInstantiatorStrategy
|
import org.objenesis.strategy.StdInstantiatorStrategy
|
||||||
import java.io.ByteArrayOutputStream
|
import java.io.ByteArrayOutputStream
|
||||||
import java.lang.reflect.InvocationTargetException
|
import java.lang.reflect.InvocationTargetException
|
||||||
|
import java.security.KeyPairGenerator
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
import kotlin.reflect.KMutableProperty
|
import kotlin.reflect.KMutableProperty
|
||||||
@ -160,11 +163,17 @@ fun createKryo(): Kryo {
|
|||||||
|
|
||||||
register(Arrays.asList( "" ).javaClass, ArraysAsListSerializer());
|
register(Arrays.asList( "" ).javaClass, ArraysAsListSerializer());
|
||||||
|
|
||||||
|
val keyPair = KeyPairGenerator.getInstance("EC").genKeyPair()
|
||||||
|
val ser = JavaSerializer()
|
||||||
|
register(keyPair.public.javaClass, ser)
|
||||||
|
register(keyPair.private.javaClass, ser)
|
||||||
|
|
||||||
// Some classes have to be handled with the ImmutableClassSerializer because they need to have their
|
// Some classes have to be handled with the ImmutableClassSerializer because they need to have their
|
||||||
// constructors be invoked (typically for lazy members).
|
// constructors be invoked (typically for lazy members).
|
||||||
val immutables = listOf(
|
val immutables = listOf(
|
||||||
SignedWireTransaction::class,
|
SignedWireTransaction::class,
|
||||||
SerializedBytes::class
|
SerializedBytes::class,
|
||||||
|
TimestampCommand::class
|
||||||
)
|
)
|
||||||
|
|
||||||
immutables.forEach {
|
immutables.forEach {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user