mirror of
https://github.com/corda/corda.git
synced 2025-01-31 08:25:50 +00:00
core: use optimizedPositive for size serialization
This commit is contained in:
parent
cd91c6a0e7
commit
2b4ebd4f09
@ -263,12 +263,12 @@ object Ed25519PrivateKeySerializer : Serializer<EdDSAPrivateKey>() {
|
||||
|
||||
override fun write(kryo: Kryo, output: Output, obj: EdDSAPrivateKey) {
|
||||
check(obj.params.equals(ed25519Curve))
|
||||
output.writeInt(obj.seed.size)
|
||||
output.writeInt(obj.seed.size, true)
|
||||
output.writeBytes(obj.seed)
|
||||
}
|
||||
|
||||
override fun read(kryo: Kryo, input: Input, type: Class<EdDSAPrivateKey>): EdDSAPrivateKey {
|
||||
val seedSize = input.readInt()
|
||||
val seedSize = input.readInt(true)
|
||||
val seed = input.readBytes(seedSize)
|
||||
return EdDSAPrivateKey(EdDSAPrivateKeySpec(seed, ed25519Curve))
|
||||
}
|
||||
@ -281,12 +281,12 @@ object Ed25519PublicKeySerializer : Serializer<EdDSAPublicKey>() {
|
||||
|
||||
override fun write(kryo: Kryo, output: Output, obj: EdDSAPublicKey) {
|
||||
check(obj.params.equals(ed25519Curve))
|
||||
output.writeInt(obj.abyte.size)
|
||||
output.writeInt(obj.abyte.size, true)
|
||||
output.writeBytes(obj.abyte)
|
||||
}
|
||||
|
||||
override fun read(kryo: Kryo, input: Input, type: Class<EdDSAPublicKey>): EdDSAPublicKey {
|
||||
val ASize = input.readInt()
|
||||
val ASize = input.readInt(true)
|
||||
val A = input.readBytes(ASize)
|
||||
return EdDSAPublicKey(EdDSAPublicKeySpec(A, ed25519Curve))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user