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 6
6
7
7
import Operation from "../Operation.mjs" ;
8
8
import OperationError from "../errors/OperationError.mjs" ;
9
- import { fromHex } from "../lib/Hex.mjs" ;
9
+ import { fromHex , toHexFast } from "../lib/Hex.mjs" ;
10
10
import { toBase64 } from "../lib/Base64.mjs" ;
11
11
import r from "jsrsasign" ;
12
12
@@ -25,7 +25,7 @@ class ECDSASign extends Operation {
25
25
this . module = "Ciphers" ;
26
26
this . description = "Sign a plaintext message with a PEM encoded EC key." ;
27
27
this . infoURL = "https://wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm" ;
28
- this . inputType = "string " ;
28
+ this . inputType = "ArrayBuffer " ;
29
29
this . outputType = "string" ;
30
30
this . args = [
31
31
{
@@ -58,7 +58,7 @@ class ECDSASign extends Operation {
58
58
}
59
59
60
60
/**
61
- * @param {string } input
61
+ * @param {ArrayBuffer } input
62
62
* @param {Object[] } args
63
63
* @returns {string }
64
64
*/
@@ -79,7 +79,7 @@ class ECDSASign extends Operation {
79
79
throw new OperationError ( "Provided key is not a private key." ) ;
80
80
}
81
81
sig . init ( key ) ;
82
- const signatureASN1Hex = sig . signString ( input ) ;
82
+ const signatureASN1Hex = sig . signHex ( toHexFast ( new Uint8Array ( input ) ) ) ;
83
83
84
84
let result ;
85
85
switch ( outputFormat ) {
Original file line number Diff line number Diff line change @@ -151,8 +151,8 @@ class ECDSAVerify extends Operation {
151
151
throw new OperationError ( "Provided key is not a public key." ) ;
152
152
}
153
153
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 ) ) ;
156
156
const result = sig . verify ( signatureASN1Hex ) ;
157
157
return result ? "Verified OK" : "Verification Failure" ;
158
158
}
You can’t perform that action at this time.
0 commit comments