Remove highlighting and correct one module mismatch

This commit is contained in:
Dan Flack 2024-09-22 18:58:36 +02:00
parent f61bdf06c6
commit ae9054dc37
2 changed files with 11 additions and 22 deletions

View file

@ -4,6 +4,7 @@
* @license Apache-2.0
*/
import OperationError from "../errors/OperationError.mjs";
import Operation from "../Operation.mjs";
import { SM2 } from "../lib/SM2.mjs";
@ -54,6 +55,10 @@ class SM2Decrypt extends Operation {
run(input, args) {
const [privateKey, inputFormat, curveName] = args;
if (privateKey.length !== 64) {
throw new OperationError("Input private key must be in hex; and should be 32 bytes");
}
const sm2 = new SM2(curveName, inputFormat);
sm2.setPrivateKey(privateKey);