mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 14:56:19 -04:00
Updates for linter
This commit is contained in:
parent
84ce8e6f30
commit
0f16fa0ce1
1 changed files with 27 additions and 18 deletions
|
@ -12,7 +12,16 @@ import Sm3 from "crypto-api/src/hasher/sm3.mjs";
|
||||||
import {toHex} from "crypto-api/src/encoder/hex.mjs";
|
import {toHex} from "crypto-api/src/encoder/hex.mjs";
|
||||||
import r from "jsrsasign";
|
import r from "jsrsasign";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SM2 Class for encryption and decryption operations
|
||||||
|
*/
|
||||||
export class SM2 {
|
export class SM2 {
|
||||||
|
/**
|
||||||
|
* Constructor for SM2 class; sets up with the curve and the output format as specified in user args
|
||||||
|
*
|
||||||
|
* @param {*} curve
|
||||||
|
* @param {*} format
|
||||||
|
*/
|
||||||
constructor(curve, format) {
|
constructor(curve, format) {
|
||||||
this.ecParams = null;
|
this.ecParams = null;
|
||||||
this.rng = new r.SecureRandom();
|
this.rng = new r.SecureRandom();
|
||||||
|
@ -20,15 +29,15 @@ export class SM2 {
|
||||||
For any additional curve definitions utilized by SM2, add another block like the below for that curve, then add the curve name to the Curve selection dropdown
|
For any additional curve definitions utilized by SM2, add another block like the below for that curve, then add the curve name to the Curve selection dropdown
|
||||||
*/
|
*/
|
||||||
r.crypto.ECParameterDB.regist(
|
r.crypto.ECParameterDB.regist(
|
||||||
'sm2p256v1', // name / p = 2**256 - 2**224 - 2**96 + 2**64 - 1
|
"sm2p256v1", // name / p = 2**256 - 2**224 - 2**96 + 2**64 - 1
|
||||||
256,
|
256,
|
||||||
'FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF', // p
|
"FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF", // p
|
||||||
'FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC', // a
|
"FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC", // a
|
||||||
'28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93', // b
|
"28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93", // b
|
||||||
'FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123', // n
|
"FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123", // n
|
||||||
'1', // h
|
"1", // h
|
||||||
'32C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7', // gx
|
"32C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7", // gx
|
||||||
'BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0', // gy
|
"BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0", // gy
|
||||||
[]
|
[]
|
||||||
) // alias
|
) // alias
|
||||||
this.ecParams = r.crypto.ECParameterDB.getByName(curve);
|
this.ecParams = r.crypto.ECParameterDB.getByName(curve);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue