mirror of
https://github.com/corda/corda.git
synced 2025-04-28 23:10:37 +00:00
Minor: fix PublicKey.toShortString after the switch to ed25519
This commit is contained in:
parent
9e849378cf
commit
2e3f689fd3
@ -5,9 +5,9 @@ import com.r3corda.core.serialization.OpaqueBytes
|
|||||||
import com.r3corda.core.serialization.SerializedBytes
|
import com.r3corda.core.serialization.SerializedBytes
|
||||||
import com.r3corda.core.serialization.deserialize
|
import com.r3corda.core.serialization.deserialize
|
||||||
import net.i2p.crypto.eddsa.EdDSAEngine
|
import net.i2p.crypto.eddsa.EdDSAEngine
|
||||||
|
import net.i2p.crypto.eddsa.EdDSAPublicKey
|
||||||
import java.math.BigInteger
|
import java.math.BigInteger
|
||||||
import java.security.*
|
import java.security.*
|
||||||
import java.security.interfaces.ECPublicKey
|
|
||||||
import net.i2p.crypto.eddsa.KeyPairGenerator as EddsaKeyPairGenerator
|
import net.i2p.crypto.eddsa.KeyPairGenerator as EddsaKeyPairGenerator
|
||||||
|
|
||||||
fun newSecureRandom(): SecureRandom {
|
fun newSecureRandom(): SecureRandom {
|
||||||
@ -158,8 +158,8 @@ fun PublicKey.verifyWithECDSA(content: ByteArray, signature: DigitalSignature) {
|
|||||||
|
|
||||||
/** Render a public key to a string, using a short form if it's an elliptic curve public key */
|
/** Render a public key to a string, using a short form if it's an elliptic curve public key */
|
||||||
fun PublicKey.toStringShort(): String {
|
fun PublicKey.toStringShort(): String {
|
||||||
return (this as? ECPublicKey)?.let { key ->
|
return (this as? EdDSAPublicKey)?.let { key ->
|
||||||
"DL" + Base58.encode(key.w.affineX.toByteArray()) // DL -> Distributed Ledger
|
"DL" + Base58.encode(key.abyte) // DL -> Distributed Ledger
|
||||||
} ?: toString()
|
} ?: toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user