Merge branch 'master' into master

This commit is contained in:
Josh Bloom 2025-04-22 23:33:28 -05:00 committed by GitHub
commit 0a94c4a7c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 4499 additions and 538 deletions

View file

@ -20,6 +20,7 @@ import TestRegister from "../lib/TestRegister.mjs";
import "./tests/AESKeyWrap.mjs";
import "./tests/AvroToJSON.mjs";
import "./tests/BaconCipher.mjs";
import "./tests/Base32.mjs";
import "./tests/Base45.mjs";
import "./tests/Base58.mjs";
import "./tests/Base62.mjs";
@ -44,7 +45,6 @@ import "./tests/ChaCha.mjs";
import "./tests/ChangeIPFormat.mjs";
import "./tests/CharEnc.mjs";
import "./tests/Charts.mjs";
import "./tests/Checksum.mjs";
import "./tests/Ciphers.mjs";
import "./tests/CipherSaber2.mjs";
import "./tests/CMAC.mjs";
@ -56,6 +56,7 @@ import "./tests/ConditionalJump.mjs";
import "./tests/ConvertCoordinateFormat.mjs";
import "./tests/ConvertLeetSpeak.mjs";
import "./tests/ConvertToNATOAlphabet.mjs";
import "./tests/CRCChecksum.mjs";
import "./tests/Crypt.mjs";
import "./tests/CSV.mjs";
import "./tests/DateTime.mjs";
@ -125,6 +126,7 @@ import "./tests/ParseUDP.mjs";
import "./tests/PEMtoHex.mjs";
import "./tests/PGP.mjs";
import "./tests/PHP.mjs";
import "./tests/PHPSerialize.mjs";
import "./tests/PowerSet.mjs";
import "./tests/Protobuf.mjs";
import "./tests/PubKeyFromCert.mjs";
@ -144,6 +146,7 @@ import "./tests/SetIntersection.mjs";
import "./tests/SetUnion.mjs";
import "./tests/Shuffle.mjs";
import "./tests/SIGABA.mjs";
import "./tests/SM2.mjs";
import "./tests/SM4.mjs";
// import "./tests/SplitColourChannels.mjs"; // Cannot test operations that use the File type yet
import "./tests/StrUtils.mjs";
@ -160,6 +163,16 @@ import "./tests/TranslateDateTimeFormat.mjs";
import "./tests/Typex.mjs";
import "./tests/UnescapeString.mjs";
import "./tests/Unicode.mjs";
import "./tests/RSA.mjs";
import "./tests/CBOREncode.mjs";
import "./tests/CBORDecode.mjs";
import "./tests/JA3Fingerprint.mjs";
import "./tests/JA3SFingerprint.mjs";
import "./tests/HASSH.mjs";
import "./tests/JSONtoYAML.mjs";
// Cannot test operations that use the File type yet
// import "./tests/SplitColourChannels.mjs";
import "./tests/YARA.mjs";
import "./tests/ParseCSR.mjs";
import "./tests/XXTEA.mjs";

View file

@ -0,0 +1,176 @@
/**
* Base32 Tests
*
* @author Peter C-S [petercs@purelymail.com]
* @license Apache-2.0
*/
import TestRegister from "../../lib/TestRegister.mjs";
import {ALPHABET_OPTIONS} from "../../../src/core/lib/Base32.mjs";
// Example Standard Base32 Tests
const STANDARD_INP = "HELLO BASE32";
const STANDARD_OUT = "JBCUYTCPEBBECU2FGMZA====";
// Example Hex Extended Base32 Tests
const EXTENDED_INP = "HELLO BASE32 EXTENDED";
const EXTENDED_OUT = "912KOJ2F41142KQ56CP20HAOAH2KSH258G======";
// All Bytes
const ALL_BYTES = [
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
"\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f",
"\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f",
"\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f",
"\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f",
"\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f",
"\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f",
"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f",
"\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f",
"\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf",
"\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf",
"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf",
"\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf",
"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef",
"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
].join("");
const ALL_BYTES_EXTENDED_OUT = "000G40O40K30E209185GO38E1S8124GJ2GAHC5OO34D1M70T3OFI08924CI2A9H750KIKAPC5KN2UC1H68PJ8D9M6SS3IEHR7GUJSFQ085146H258P3KGIAA9D64QJIFA18L4KQKALB5EM2PB9DLONAUBTG62OJ3CHIMCPR8D5L6MR3DDPNN0SBIEDQ7ATJNF1SNKURSFLV7V041GA1O91C6GU48J2KBHI6OT3SGI699754LIQBPH6CQJEE9R7KVK2GQ58T4KMJAFA59LALQPBDELUOB3CLJMIQRDDTON6TBNF5TNQVS1GE2OF2CBHM7P34SLIUCPN7CVK6HQB9T9LEMQVCDJMMRRJETTNV0S7HE7P75SRJUHQFATFMERRNFU3OV5SVKUNRFFU7PVBTVPVFUVS======";
const ALL_BYTES_STANDARD_OUT = "AAAQEAYEAUDAOCAJBIFQYDIOB4IBCEQTCQKRMFYYDENBWHA5DYPSAIJCEMSCKJRHFAUSUKZMFUXC6MBRGIZTINJWG44DSOR3HQ6T4P2AIFBEGRCFIZDUQSKKJNGE2TSPKBIVEU2UKVLFOWCZLJNVYXK6L5QGCYTDMRSWMZ3INFVGW3DNNZXXA4LSON2HK5TXPB4XU634PV7H7AEBQKBYJBMGQ6EITCULRSGY5D4QSGJJHFEVS2LZRGM2TOOJ3HU7UCQ2FI5EUWTKPKFJVKV2ZLNOV6YLDMVTWS23NN5YXG5LXPF5X274BQOCYPCMLRWHZDE4VS6MZXHM7UGR2LJ5JVOW27MNTWW33TO55X7A4HROHZHF43T6R2PK5PWO33XP6DY7F47U6X3PP6HZ7L57Z7P674======";
TestRegister.addTests([
{
name: "To Base32 Standard: nothing",
input: "",
expectedOutput: "",
recipeConfig: [
{
op: "To Base32",
args: [ALPHABET_OPTIONS[0].value],
},
],
},
{
name: "To Base32 Hex Extended: nothing",
input: "",
expectedOutput: "",
recipeConfig: [
{
op: "To Base32",
args: [ALPHABET_OPTIONS[1].value],
},
],
},
{
name: "From Base32 Standard: nothing",
input: "",
expectedOutput: "",
recipeConfig: [
{
op: "From Base32",
args: [ALPHABET_OPTIONS[0].value, false],
},
],
},
{
name: "From Base32 Hex Extended: nothing",
input: "",
expectedOutput: "",
recipeConfig: [
{
op: "From Base32",
args: [ALPHABET_OPTIONS[1].value, false],
},
],
},
{
name: "To Base32 Standard: " + STANDARD_INP,
input: STANDARD_INP,
expectedOutput: STANDARD_OUT,
recipeConfig: [
{
op: "To Base32",
args: [ALPHABET_OPTIONS[0].value],
},
],
},
{
name: "To Base32 Hex Extended: " + EXTENDED_INP,
input: EXTENDED_INP,
expectedOutput: EXTENDED_OUT,
recipeConfig: [
{
op: "To Base32",
args: [ALPHABET_OPTIONS[1].value],
},
],
},
{
name: "From Base32 Standard: " + STANDARD_OUT,
input: STANDARD_OUT,
expectedOutput: STANDARD_INP,
recipeConfig: [
{
op: "From Base32",
args: [ALPHABET_OPTIONS[0].value, false],
},
],
},
{
name: "From Base32 Hex Extended: " + EXTENDED_OUT,
input: EXTENDED_OUT,
expectedOutput: EXTENDED_INP,
recipeConfig: [
{
op: "From Base32",
args: [ALPHABET_OPTIONS[1].value, false],
},
],
},
{
name: "To Base32 Hex Standard: All Bytes",
input: ALL_BYTES,
expectedOutput: ALL_BYTES_STANDARD_OUT,
recipeConfig: [
{
op: "To Base32",
args: [ALPHABET_OPTIONS[0].value],
},
],
},
{
name: "To Base32 Hex Extended: All Bytes",
input: ALL_BYTES,
expectedOutput: ALL_BYTES_EXTENDED_OUT,
recipeConfig: [
{
op: "To Base32",
args: [ALPHABET_OPTIONS[1].value],
},
],
},
{
name: "From Base32 Hex Standard: All Bytes",
input: ALL_BYTES_STANDARD_OUT,
expectedOutput: ALL_BYTES,
recipeConfig: [
{
op: "From Base32",
args: [ALPHABET_OPTIONS[0].value, false],
},
],
},
{
name: "From Base32 Hex Extended: All Bytes",
input: ALL_BYTES_EXTENDED_OUT,
expectedOutput: ALL_BYTES,
recipeConfig: [
{
op: "From Base32",
args: [ALPHABET_OPTIONS[1].value, false],
},
],
},
]);

File diff suppressed because it is too large Load diff

View file

@ -1,241 +0,0 @@
/**
* Checksum tests.
*
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../lib/TestRegister.mjs";
const BASIC_STRING = "The ships hung in the sky in much the same way that bricks don't.";
const UTF8_STR = "ნუ პანიკას";
const ALL_BYTES = [
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
"\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f",
"\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f",
"\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f",
"\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f",
"\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f",
"\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f",
"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f",
"\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f",
"\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf",
"\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf",
"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf",
"\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf",
"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef",
"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
].join("");
TestRegister.addTests([
{
name: "CRC-8: nothing",
input: "",
expectedOutput: "00",
recipeConfig: [
{
"op": "CRC-8 Checksum",
"args": ["CRC-8"]
}
]
},
{
name: "CRC-8: default check",
input: "123456789",
expectedOutput: "f4",
recipeConfig: [
{
"op": "CRC-8 Checksum",
"args": ["CRC-8"]
}
]
},
{
name: "CRC-8: CDMA2000",
input: "123456789",
expectedOutput: "da",
recipeConfig: [
{
"op": "CRC-8 Checksum",
"args": ["CRC-8/CDMA2000"]
}
]
},
{
name: "CRC-8: DARC",
input: "123456789",
expectedOutput: "15",
recipeConfig: [
{
"op": "CRC-8 Checksum",
"args": ["CRC-8/DARC"]
}
]
},
{
name: "CRC-8: DVB-S2",
input: "123456789",
expectedOutput: "bc",
recipeConfig: [
{
"op": "CRC-8 Checksum",
"args": ["CRC-8/DVB-S2"]
}
]
},
{
name: "CRC-8: EBU",
input: "123456789",
expectedOutput: "97",
recipeConfig: [
{
"op": "CRC-8 Checksum",
"args": ["CRC-8/EBU"]
}
]
},
{
name: "CRC-8: I-CODE",
input: "123456789",
expectedOutput: "7e",
recipeConfig: [
{
"op": "CRC-8 Checksum",
"args": ["CRC-8/I-CODE"]
}
]
},
{
name: "CRC-8: ITU",
input: "123456789",
expectedOutput: "a1",
recipeConfig: [
{
"op": "CRC-8 Checksum",
"args": ["CRC-8/ITU"]
}
]
},
{
name: "CRC-8: MAXIM",
input: "123456789",
expectedOutput: "a1",
recipeConfig: [
{
"op": "CRC-8 Checksum",
"args": ["CRC-8/MAXIM"]
}
]
},
{
name: "CRC-8: ROHC",
input: "123456789",
expectedOutput: "d0",
recipeConfig: [
{
"op": "CRC-8 Checksum",
"args": ["CRC-8/ROHC"]
}
]
},
{
name: "CRC-8: WCDMA",
input: "123456789",
expectedOutput: "25",
recipeConfig: [
{
"op": "CRC-8 Checksum",
"args": ["CRC-8/WCDMA"]
}
]
},
{
name: "CRC-16: nothing",
input: "",
expectedOutput: "0000",
recipeConfig: [
{
"op": "CRC-16 Checksum",
"args": []
}
]
},
{
name: "CRC-16: basic string",
input: BASIC_STRING,
expectedOutput: "0c70",
recipeConfig: [
{
"op": "CRC-16 Checksum",
"args": []
}
]
},
{
name: "CRC-16: UTF-8",
input: UTF8_STR,
expectedOutput: "dcf6",
recipeConfig: [
{
"op": "CRC-16 Checksum",
"args": []
}
]
},
{
name: "CRC-16: all bytes",
input: ALL_BYTES,
expectedOutput: "bad3",
recipeConfig: [
{
"op": "CRC-16 Checksum",
"args": []
}
]
},
{
name: "CRC-32: nothing",
input: "",
expectedOutput: "00000000",
recipeConfig: [
{
"op": "CRC-32 Checksum",
"args": []
}
]
},
{
name: "CRC-32: basic string",
input: BASIC_STRING,
expectedOutput: "bf4b739c",
recipeConfig: [
{
"op": "CRC-32 Checksum",
"args": []
}
]
},
{
name: "CRC-32: UTF-8",
input: UTF8_STR,
expectedOutput: "87553290",
recipeConfig: [
{
"op": "CRC-32 Checksum",
"args": []
}
]
},
{
name: "CRC-32: all bytes",
input: ALL_BYTES,
expectedOutput: "29058c73",
recipeConfig: [
{
"op": "CRC-32 Checksum",
"args": []
}
]
}
]);

View file

@ -0,0 +1,41 @@
/**
* YAML tests.
*
* @author ccarpo [ccarpo@gmx.net]
*
* @copyright Crown Copyright 2021
* @license Apache-2.0
*/
import TestRegister from "../../lib/TestRegister.mjs";
const EXAMPLE_YAML = `number: 3\nplain: string\nblock: |\n two\n lines`;
const EXAMPLE_JSON = `{ "number": 3, "plain": "string" }`;
TestRegister.addTests([
{
name: "YAML to JSON",
input: EXAMPLE_YAML,
expectedOutput: JSON.stringify({
"number": 3,
"plain": "string",
"block": "two\nlines\n"
}, null, 4),
recipeConfig: [
{
op: "YAML to JSON",
args: [],
}
],
},
{
name: "JSON to YAML",
input: EXAMPLE_JSON,
expectedOutput: `number: 3\nplain: string\n`,
recipeConfig: [
{
op: "JSON to YAML",
args: [],
}
],
},
]);

View file

@ -0,0 +1,112 @@
/**
* PHP Serialization tests.
*
* @author brun0ne [brunonblok@gmail.com]
*
* @copyright Crown Copyright 2023
* @license Apache-2.0
*/
import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
name: "PHP Serialize empty array",
input: "[]",
expectedOutput: "a:0:{}",
recipeConfig: [
{
op: "PHP Serialize",
args: []
}
]
},
{
name: "PHP Serialize empty object",
input: "{}",
expectedOutput: "a:0:{}",
recipeConfig: [
{
op: "PHP Serialize",
args: []
}
]
},
{
name: "PHP Serialize null",
input: "null",
expectedOutput: "N;",
recipeConfig: [
{
op: "PHP Serialize",
args: []
}
]
},
{
name: "PHP Serialize integer",
input: "10",
expectedOutput: "i:10;",
recipeConfig: [
{
op: "PHP Serialize",
args: []
}
]
},
{
name: "PHP Serialize float",
input: "14.523",
expectedOutput: "d:14.523;",
recipeConfig: [
{
op: "PHP Serialize",
args: []
}
]
},
{
name: "PHP Serialize boolean",
input: "[true, false]",
expectedOutput: "a:2:{i:0;b:1;i:1;b:0;}",
recipeConfig: [
{
op: "PHP Serialize",
args: []
}
]
},
{
name: "PHP Serialize string",
input: "\"Test string to serialize\"",
expectedOutput: "s:24:\"Test string to serialize\";",
recipeConfig: [
{
op: "PHP Serialize",
args: []
}
]
},
{
name: "PHP Serialize object",
input: "{\"a\": 10,\"0\": {\"ab\": true}}",
expectedOutput: "a:2:{s:1:\"0\";a:1:{s:2:\"ab\";b:1;}s:1:\"a\";i:10;}",
recipeConfig: [
{
op: "PHP Serialize",
args: []
}
]
},
{
name: "PHP Serialize array",
input: "[1,\"abc\",true,{\"x\":1,\"y\":2}]",
expectedOutput: "a:4:{i:0;i:1;i:1;s:3:\"abc\";i:2;b:1;i:3;a:2:{s:1:\"x\";i:1;s:1:\"y\";i:2;}}",
recipeConfig: [
{
op: "PHP Serialize",
args: []
}
]
}
]);

View file

@ -0,0 +1,135 @@
/**
* SM2 Tests
*
* @author flakjacket95 [dflack95@gmail.com]
* @copyright Crown Copyright 2024
* @license Apache-2.0
*/
import TestRegister from "../../lib/TestRegister.mjs";
/* Plaintexts */
const SMALL_PLAIN = "I am a small plaintext";
const LARGE_PLAIN = "I am a larger plaintext, that will require the encryption KDF to generate a much larger key to properly encrypt me";
/* Test Key Parameters */
const PUBLIC_X = "f7d903cab7925066c31150a92b31e548e63f954f92d01eaa0271fb2a336baef8";
const PUBLIC_Y = "fb0c45e410ef7a6cdae724e6a78dbff52562e97ede009e762b667d9b14adea6c";
const PRIVATE_K = "e74a72505084c3269aa9b696d603e3e08c74c6740212c11a31e26cdfe08bdf6a";
const CURVE = "sm2p256v1";
/* Decryption Test Ciphertext*/
const CIPHERTEXT_1 = "9a31bc0adb4677cdc4141479e3949572a55c3e6fb52094721f741c2bd2e179aaa87be6263bc1be602e473be3d5de5dce97f8248948b3a7e15f9f67f64aef21575e0c05e6171870a10ff9ab778dbef24267ad90e1a9d47d68f757d57c4816612e9829f804025dea05a511cda39371c22a2828f976f72e";
const CIPHERTEXT_2 = "d3647d68568a2e7a4f8e843286be7bf2b4d80256697d19a73df306ae1a7e6d0364d942e23d2340606e7a2502a838b132f9242587b2ea7e4c207e87242eea8cae68f5ff4da2a95a7f6d350608ae5b6777e1d925bf9c560087af84aba7befba713130106ddb4082d803811bca3864594722f3198d58257fe4ba37f4aa540adf4cb0568bddd2d8140ad3030deea0a87e3198655cc4d22bfc3d73b1c4afec2ff15d68c8d1298d97132cace922ee8a4e41ca288a7e748b77ca94aa81dc283439923ae7939e00898e16fe5111fbe1d928d152b216a";
const CIPHERTEXT_3 = "5f340eeb4398fa8950ee3408d0e3fe34bf7728c9fdb060c94b916891b5c693610274160b52a7132a2bf16ad5cdb57d1e00da2f3ddbd55350729aa9c268b53e40c05ccce9912daa14406e8c132e389484e69757350be25351755dcc6c25c94b3c1a448b2cf8c2017582125eb6cf782055b199a875e966";
const CIPHERTEXT_4 = "0649bac46c3f9fd7fb3b2be4bff27414d634651efd02ca67d8c802bbc5468e77d035c39b581d6b56227f5d87c0b4efbea5032c0761139295ae194b9f1fce698f2f4b51d89fa5554171a1aad2e61fe9de89831aec472ecc5ab178ebf4d2230c1fb94fca03e536b87b9eba6db71ba9939260a08ffd230ca86cb45cf754854222364231bdb8b873791d63ad57a4b3fa5b6375388dc879373f5f1be9051bc5072a8afbec5b7b034e4907aa5bb4b6b1f50e725d09cb6a02e07ce20263005f6c9157ce05d3ea739d231d4f09396fb72aa680884d78";
TestRegister.addTests([
{
name: "SM2 Decrypt: Small Input; Format One",
input: CIPHERTEXT_1,
expectedOutput: SMALL_PLAIN,
recipeConfig: [
{
"op": "SM2 Decrypt",
"args": [PRIVATE_K, "C1C3C2", CURVE]
}
]
},
{
name: "SM2 Decrypt: Large Input; Format One",
input: CIPHERTEXT_2,
expectedOutput: LARGE_PLAIN,
recipeConfig: [
{
"op": "SM2 Decrypt",
"args": [PRIVATE_K, "C1C3C2", CURVE]
}
]
},
{
name: "SM2 Decrypt: Small Input; Format Two",
input: CIPHERTEXT_3,
expectedOutput: SMALL_PLAIN,
recipeConfig: [
{
"op": "SM2 Decrypt",
"args": [PRIVATE_K, "C1C2C3", CURVE]
}
]
},
{
name: "SM2 Decrypt: Large Input; Format Two",
input: CIPHERTEXT_4,
expectedOutput: LARGE_PLAIN,
recipeConfig: [
{
"op": "SM2 Decrypt",
"args": [PRIVATE_K, "C1C2C3", CURVE]
}
]
},
{
name: "SM2 Encrypt And Decrypt: Small Input; Format One",
input: SMALL_PLAIN,
expectedOutput: SMALL_PLAIN,
recipeConfig: [
{
"op": "SM2 Encrypt",
"args": [PUBLIC_X, PUBLIC_Y, "C1C3C2", CURVE],
},
{
"op": "SM2 Decrypt",
"args": [PRIVATE_K, "C1C3C2", CURVE]
}
]
},
{
name: "SM2 Encrypt And Decrypt: Large Input; Format One",
input: LARGE_PLAIN,
expectedOutput: LARGE_PLAIN,
recipeConfig: [
{
"op": "SM2 Encrypt",
"args": [PUBLIC_X, PUBLIC_Y, "C1C3C2", CURVE],
},
{
"op": "SM2 Decrypt",
"args": [PRIVATE_K, "C1C3C2", CURVE]
}
]
},
{
name: "SM2 Encrypt And Decrypt: Small Input; Format Two",
input: SMALL_PLAIN,
expectedOutput: SMALL_PLAIN,
recipeConfig: [
{
"op": "SM2 Encrypt",
"args": [PUBLIC_X, PUBLIC_Y, "C1C2C3", CURVE],
},
{
"op": "SM2 Decrypt",
"args": [PRIVATE_K, "C1C2C2", CURVE]
}
]
},
{
name: "SM2 Encrypt And Decrypt: Large Input; Format Two",
input: LARGE_PLAIN,
expectedOutput: LARGE_PLAIN,
recipeConfig: [
{
"op": "SM2 Encrypt",
"args": [PUBLIC_X, PUBLIC_Y, "C1C2C3", CURVE],
},
{
"op": "SM2 Decrypt",
"args": [PRIVATE_K, "C1C2C3", CURVE]
}
]
},
]);