File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 66
77import Operation from "../Operation.mjs" ;
88import OperationError from "../errors/OperationError.mjs" ;
9- import { fromHex } from "../lib/Hex.mjs" ;
9+ import { fromHex , toHexFast } from "../lib/Hex.mjs" ;
1010import { toBase64 } from "../lib/Base64.mjs" ;
1111import r from "jsrsasign" ;
1212
@@ -25,7 +25,7 @@ class ECDSASign extends Operation {
2525 this . module = "Ciphers" ;
2626 this . description = "Sign a plaintext message with a PEM encoded EC key." ;
2727 this . infoURL = "https://wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm" ;
28- this . inputType = "string " ;
28+ this . inputType = "ArrayBuffer " ;
2929 this . outputType = "string" ;
3030 this . args = [
3131 {
@@ -58,7 +58,7 @@ class ECDSASign extends Operation {
5858 }
5959
6060 /**
61- * @param {string } input
61+ * @param {ArrayBuffer } input
6262 * @param {Object[] } args
6363 * @returns {string }
6464 */
@@ -79,7 +79,7 @@ class ECDSASign extends Operation {
7979 throw new OperationError ( "Provided key is not a private key." ) ;
8080 }
8181 sig . init ( key ) ;
82- const signatureASN1Hex = sig . signString ( input ) ;
82+ const signatureASN1Hex = sig . signHex ( toHexFast ( new Uint8Array ( input ) ) ) ;
8383
8484 let result ;
8585 switch ( outputFormat ) {
Original file line number Diff line number Diff line change @@ -151,8 +151,8 @@ class ECDSAVerify extends Operation {
151151 throw new OperationError ( "Provided key is not a public key." ) ;
152152 }
153153 sig . init ( key ) ;
154- const messageStr = Utils . convertToByteString ( msg , msgFormat ) ;
155- sig . updateString ( messageStr ) ;
154+ const messageByteArray = Utils . convertToByteArray ( msg , msgFormat ) ;
155+ sig . updateHex ( toHexFast ( messageByteArray ) ) ;
156156 const result = sig . verify ( signatureASN1Hex ) ;
157157 return result ? "Verified OK" : "Verification Failure" ;
158158 }
You can’t perform that action at this time.
0 commit comments