diff --git a/src/core/operations/ECDSASign.mjs b/src/core/operations/ECDSASign.mjs index 7b8f57f18c..f681e728e9 100644 --- a/src/core/operations/ECDSASign.mjs +++ b/src/core/operations/ECDSASign.mjs @@ -6,7 +6,7 @@ import Operation from "../Operation.mjs"; import OperationError from "../errors/OperationError.mjs"; -import { fromHex } from "../lib/Hex.mjs"; +import { fromHex, toHexFast } from "../lib/Hex.mjs"; import { toBase64 } from "../lib/Base64.mjs"; import r from "jsrsasign"; @@ -25,7 +25,7 @@ class ECDSASign extends Operation { this.module = "Ciphers"; this.description = "Sign a plaintext message with a PEM encoded EC key."; this.infoURL = "https://wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm"; - this.inputType = "string"; + this.inputType = "ArrayBuffer"; this.outputType = "string"; this.args = [ { @@ -58,7 +58,7 @@ class ECDSASign extends Operation { } /** - * @param {string} input + * @param {ArrayBuffer} input * @param {Object[]} args * @returns {string} */ @@ -79,7 +79,7 @@ class ECDSASign extends Operation { throw new OperationError("Provided key is not a private key."); } sig.init(key); - const signatureASN1Hex = sig.signString(input); + const signatureASN1Hex = sig.signHex(toHexFast(new Uint8Array(input))); let result; switch (outputFormat) { diff --git a/src/core/operations/ECDSAVerify.mjs b/src/core/operations/ECDSAVerify.mjs index 1f8a53ea64..f3219272b9 100644 --- a/src/core/operations/ECDSAVerify.mjs +++ b/src/core/operations/ECDSAVerify.mjs @@ -151,8 +151,8 @@ class ECDSAVerify extends Operation { throw new OperationError("Provided key is not a public key."); } sig.init(key); - const messageStr = Utils.convertToByteString(msg, msgFormat); - sig.updateString(messageStr); + const messageByteArray = Utils.convertToByteArray(msg, msgFormat); + sig.updateHex(toHexFast(messageByteArray)); const result = sig.verify(signatureASN1Hex); return result ? "Verified OK" : "Verification Failure"; }