mirror of
https://github.com/corda/corda.git
synced 2024-12-22 14:22:28 +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)
|
||||
|
||||
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 KeyPair.signWithECDSA(bitsToSign: ByteArray) = private.signWithECDSA(bitsToSign, public)
|
||||
|
@ -144,7 +144,7 @@ object JsonSupport {
|
||||
object PublicKeyDeserializer : JsonDeserializer<EdDSAPublicKey>() {
|
||||
override fun deserialize(parser: JsonParser, context: DeserializationContext): EdDSAPublicKey {
|
||||
return try {
|
||||
parser.text.toPublicKey()
|
||||
parsePublicKeyBase58(parser.text)
|
||||
} catch (e: Exception) {
|
||||
throw JsonParseException(parser, "Invalid public key ${parser.text}: ${e.message}")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user