mirror of
https://github.com/corda/corda.git
synced 2025-01-08 22:12:58 +00:00
core, node: Rename Stirng.toPublicKey to parsePublicKeyBase58
This commit is contained in:
parent
35c4fcadcf
commit
4fb8a38122
@ -148,7 +148,7 @@ fun PrivateKey.signWithECDSA(bitsToSign: ByteArray, publicKey: PublicKey): Digit
|
|||||||
|
|
||||||
val ed25519Curve = EdDSANamedCurveTable.getByName(EdDSANamedCurveTable.CURVE_ED25519_SHA512)
|
val ed25519Curve = EdDSANamedCurveTable.getByName(EdDSANamedCurveTable.CURVE_ED25519_SHA512)
|
||||||
|
|
||||||
fun String.toPublicKey() = EdDSAPublicKey(EdDSAPublicKeySpec(Base58.decode(this), ed25519Curve))
|
fun parsePublicKeyBase58(base58String: String) = EdDSAPublicKey(EdDSAPublicKeySpec(Base58.decode(base58String), ed25519Curve))
|
||||||
fun PublicKey.toBase58String() = Base58.encode((this as EdDSAPublicKey).abyte)
|
fun PublicKey.toBase58String() = Base58.encode((this as EdDSAPublicKey).abyte)
|
||||||
|
|
||||||
fun KeyPair.signWithECDSA(bitsToSign: ByteArray) = private.signWithECDSA(bitsToSign, public)
|
fun KeyPair.signWithECDSA(bitsToSign: ByteArray) = private.signWithECDSA(bitsToSign, public)
|
||||||
|
@ -144,7 +144,7 @@ object JsonSupport {
|
|||||||
object PublicKeyDeserializer : JsonDeserializer<EdDSAPublicKey>() {
|
object PublicKeyDeserializer : JsonDeserializer<EdDSAPublicKey>() {
|
||||||
override fun deserialize(parser: JsonParser, context: DeserializationContext): EdDSAPublicKey {
|
override fun deserialize(parser: JsonParser, context: DeserializationContext): EdDSAPublicKey {
|
||||||
return try {
|
return try {
|
||||||
parser.text.toPublicKey()
|
parsePublicKeyBase58(parser.text)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
throw JsonParseException(parser, "Invalid public key ${parser.text}: ${e.message}")
|
throw JsonParseException(parser, "Invalid public key ${parser.text}: ${e.message}")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user