mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-22 07:46:16 -04:00
First Cryptochef branch commit.
This commit is contained in:
parent
415c59d74c
commit
f79ca6cf02
36 changed files with 7134 additions and 4 deletions
|
@ -115,6 +115,19 @@ import "./tests/CBORDecode.mjs";
|
|||
import "./tests/JA3Fingerprint.mjs";
|
||||
import "./tests/JA3SFingerprint.mjs";
|
||||
import "./tests/HASSH.mjs";
|
||||
import "./tests/ExtractDoubleSHA.mjs";
|
||||
import "./tests/ExtractSegwitArtifacts.mjs";
|
||||
import "./tests/TypeCryptoArtifacts.mjs";
|
||||
import "./tests/ExtractSeedphrases.mjs";
|
||||
import "./tests/PublicKeyToP2PKHAddress.mjs";
|
||||
import "./tests/PrivateECKeyToPublic.mjs";
|
||||
import "./tests/PrivateKeyToWIF.mjs";
|
||||
import "./tests/ChangeExtendedKeyVersion.mjs";
|
||||
import "./tests/SeedToMPK.mjs";
|
||||
import "./tests/DecryptKeyStoreFile.mjs";
|
||||
import "./tests/WIFToPrivateKey.mjs";
|
||||
import "./tests/SeedphraseToSeed.mjs";
|
||||
import "./tests/DeserializeExtendedKey.mjs";
|
||||
import "./tests/GetAllCasings.mjs";
|
||||
import "./tests/SIGABA.mjs";
|
||||
import "./tests/ELFInfo.mjs";
|
||||
|
|
57
tests/operations/tests/ChangeExtendedKeyVersion.mjs
Normal file
57
tests/operations/tests/ChangeExtendedKeyVersion.mjs
Normal file
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* Extended Key tests.
|
||||
*
|
||||
* @author dgoldenberg [virtualcurrency@mitre.org]
|
||||
* @copyright MITRE 2023
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Change Extended Key Version (Test Idempotence XPRV)",
|
||||
input: "xprv9s21ZrQH143K3LSmZ6frRpWYucY5KoUzD4xSU6Dj64nXtcBoPUE5cq3oBNyQVwBKDCimMN3k4gUUZ6eRMRFmt7HrrLdi2eZXBpAFXy4gx2c",
|
||||
expectedOutput: "xprv9s21ZrQH143K3LSmZ6frRpWYucY5KoUzD4xSU6Dj64nXtcBoPUE5cq3oBNyQVwBKDCimMN3k4gUUZ6eRMRFmt7HrrLdi2eZXBpAFXy4gx2c",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Change Extended Key Version",
|
||||
"args": ["xprv"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Change Extended Key Version (xprv to yprv))",
|
||||
input: "xprv9s21ZrQH143K3eogwtKjKajiVmJdwhtiaiT3iyysdeReAtijXNTSuCmnBCtEZM8C5b364oGZEdkVQ3tDCBLAvbvx2HzVs1pDbJ6rkR9xJMb",
|
||||
expectedOutput: "yprvABrGsX5C9jantwzonF7MXfqDfjT5tKtDVpyGWNsm1eoXDzXxn2d1XGRvCQqpZFn7VE9tpGs7hJ73HLVmuskBiqcYtdgvSvdhs2AW8yT3J9a",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Change Extended Key Version",
|
||||
"args": ["yprv"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Change Extended Key Version (xprv to zprv))",
|
||||
input: "xprv9s21ZrQH143K3eogwtKjKajiVmJdwhtiaiT3iyysdeReAtijXNTSuCmnBCtEZM8C5b364oGZEdkVQ3tDCBLAvbvx2HzVs1pDbJ6rkR9xJMb",
|
||||
expectedOutput: "zprvAWgYBBk7JR8GkFBvcbtyjkviqhbXpwsiQwVVHmmePfBQH6MC2gna9L64DcoQZAS2tsGhZkTg9xTbAd7LdaACX5J9kyPM2qTC8kE9XXGNzuP",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Change Extended Key Version",
|
||||
"args": ["zprv"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Change Extended Key Version (zprv to xprv))",
|
||||
input: "zprvAWgYBBk7JR8GkFBvcbtyjkviqhbXpwsiQwVVHmmePfBQH6MC2gna9L64DcoQZAS2tsGhZkTg9xTbAd7LdaACX5J9kyPM2qTC8kE9XXGNzuP",
|
||||
expectedOutput: "xprv9s21ZrQH143K3eogwtKjKajiVmJdwhtiaiT3iyysdeReAtijXNTSuCmnBCtEZM8C5b364oGZEdkVQ3tDCBLAvbvx2HzVs1pDbJ6rkR9xJMb",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Change Extended Key Version",
|
||||
"args": ["xprv"],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
]);
|
44
tests/operations/tests/DecryptKeyStoreFile.mjs
Normal file
44
tests/operations/tests/DecryptKeyStoreFile.mjs
Normal file
|
@ -0,0 +1,44 @@
|
|||
/**
|
||||
* Keystore tests
|
||||
*
|
||||
* @author dgoldenberg [virtualcurrency@mitre.org]
|
||||
* @copyright MITRE 2023
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Decrypt Keystore File: With Address",
|
||||
input: '{"address": "e6ff69353a16c9a5b139c79f6499d8ad74bfeceb", "crypto": {"cipher": "aes-128-ctr", "cipherparams": {"iv": "8cab4ff1613bb10cec166c69226e3ce5"}, "ciphertext": "78490968f75a8698660da5993395d2f561f41cd008498b349fd1bb4124eb3b72", "kdf": "scrypt", "kdfparams": {"dklen": 32, "n": 262144, "r": 1, "p": 8, "salt": "198fed004cf1d8cfd3d0ef8b2f99e058"}, "mac": "511ca8716f86a1853370d868478f57bdd19058a9464558750ff304e12a2cfd56"}, "id": "e130c4be-f3cf-4a22-bb80-4d3e948eb827", "version": 3}',
|
||||
expectedOutput: "128538fd0b0e53d52ac4c4dcd66badaec5c83eacd4d31709979dca31f5e761c7",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Decrypt Keystore File",
|
||||
"args": ["password1234"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Decrypt Keystore File: Cast to Address",
|
||||
input: '{"address": "e6ff69353a16c9a5b139c79f6499d8ad74bfeceb", "crypto": {"cipher": "aes-128-ctr", "cipherparams": {"iv": "8cab4ff1613bb10cec166c69226e3ce5"}, "ciphertext": "78490968f75a8698660da5993395d2f561f41cd008498b349fd1bb4124eb3b72", "kdf": "scrypt", "kdfparams": {"dklen": 32, "n": 262144, "r": 1, "p": 8, "salt": "198fed004cf1d8cfd3d0ef8b2f99e058"}, "mac": "511ca8716f86a1853370d868478f57bdd19058a9464558750ff304e12a2cfd56"}, "id": "e130c4be-f3cf-4a22-bb80-4d3e948eb827", "version": 3}',
|
||||
expectedOutput: "0xe6ff69353a16c9a5b139c79f6499d8ad74bfeceb",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Decrypt Keystore File",
|
||||
"args": ["password1234"]
|
||||
},
|
||||
{
|
||||
"op": "Private EC Key to Public Key",
|
||||
"args": [false]
|
||||
},
|
||||
{
|
||||
"op": "Public Key To Cryptocurrency Address",
|
||||
"args": ["Ethereum", "P2PKH (V1 BTC Addresses)"]
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
]);
|
35
tests/operations/tests/DeserializeExtendedKey.mjs
Normal file
35
tests/operations/tests/DeserializeExtendedKey.mjs
Normal file
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* Deserialize Key tests.
|
||||
*
|
||||
* @author dgoldenberg [virtualcurrency@mitre.org]
|
||||
* @copyright MITRE 2023
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Deserialize Extended Key",
|
||||
input: "xprv9s21ZrQH143K2cGpWQPQuyZYEMwror2UbE2oWX7BfanEBvVay5SZAbF5795VUXesFgkHXAw1eDzijWA1QMG76cxqehM7zZurQuCrJsZnPFi",
|
||||
expectedOutput: "Key Analyzed: xprv9s21ZrQH143K2cGpWQPQuyZYEMwror2UbE2oWX7BfanEBvVay5SZAbF5795VUXesFgkHXAw1eDzijWA1QMG76cxqehM7zZurQuCrJsZnPFi\n\tChecksum: 663cfc75\n\tVersion: 0488ade4\n\tLevel: 0\n\tFingerprint: 00000000\n\tChaincode: 374570a7ea4028600ce87e2769b4be7e4d90aa0b417cde33bc6c896f046b2c9f\n\tMasterKey: 00692cd2a168f6ef0d1b857b5f0ce89f14cc9fae5888a3a822c22e31b85b442059\n\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Deserialize Extended Key",
|
||||
"args": [false]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Deserialize Extended Key - Key Only",
|
||||
input: "xprv9s21ZrQH143K2cGpWQPQuyZYEMwror2UbE2oWX7BfanEBvVay5SZAbF5795VUXesFgkHXAw1eDzijWA1QMG76cxqehM7zZurQuCrJsZnPFi",
|
||||
expectedOutput: "00692cd2a168f6ef0d1b857b5f0ce89f14cc9fae5888a3a822c22e31b85b442059",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Deserialize Extended Key",
|
||||
"args": [true]
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
]);
|
61
tests/operations/tests/ExtractDoubleSHA.mjs
Normal file
61
tests/operations/tests/ExtractDoubleSHA.mjs
Normal file
|
@ -0,0 +1,61 @@
|
|||
/**
|
||||
* Double SHA extraction tests.
|
||||
*
|
||||
* @author dgoldenberg [virtualcurrency@mitre.org]
|
||||
* @copyright MITRE 2023
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Extract Double SHA Artifacts - Basic - Addresses.",
|
||||
input: "1CK6KHY6MHgYvmRQ4PAafKYDrg1ejbH1cE\n"+ "138EKMWwCNeScgkBs7ujW4JAUkx5PJqE5c\n" + "138EKMWwCNeScgkBs7ujW4JAUkx5PJqE5d\n" +
|
||||
"37TKx6FKj3P7fAeVoVwKsy39DzFhyHnvnr\n" + "37TKx6FKj3P7fAeVoVwKsy39DzFhyHnvnq\n",
|
||||
expectedOutput: "1CK6KHY6MHgYvmRQ4PAafKYDrg1ejbH1cE\n" + "138EKMWwCNeScgkBs7ujW4JAUkx5PJqE5c\n" + "37TKx6FKj3P7fAeVoVwKsy39DzFhyHnvnr\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Extract Double SHA Artifacts",
|
||||
"args": []
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Extract Double SHA Artifacts - Basic - Extended Public Keys.",
|
||||
input: "xprv9s21ZrQH143K31GyMWKbByidYkgWYp6w8jv66FXRAF2LQPyDvFKNUz57Rdq9zw4avf11d1GQ71rtH1fvWxo8iHq5J3LwqxUjYGVhk7Tf9Z2\n" +
|
||||
"xprv9s21ZrQH143K31GyMWKbByidYkgWYp6w8jv66FXRAF2LQPyDvFKNUz57Rdq9zw4avf11d1GQ71rtH1fvWxo8iHq5J3LwqxUjYGVhk7Tf9Z3\n" +
|
||||
"xpub6CVS2FsjnyE9kTXw1jxaXdDwgGduEfCtF4JLHGbiL5GqamiaRnzAjKYCCcg2BTMgpqcudPsZX6WtaiJXNbwdWfSU657nduXSiFFgbGD1q7t\n" +
|
||||
"xpub6CVS2FsjnyE9kTXw1jxaXdDwgGduEfCtF4JLHGbiL5GqamiaRnzAjKYCCcg2BTMgpqcudPsZX6WtaiJXNbwdWfSU657nduXSiFFgbGD1q7x\n" +
|
||||
"Ltpv71G8qDifUiNesyvYoQNDLPwNk29NdonGYiwe3jur9tcRRCk6nt5vqpmmPQNAsehmqmaHhWuvG6ZYGWnzv5n7MQCRFcJ89uXmLf7boarssUN\n" +
|
||||
"Ltpv71G8qDifUiNesyvYoQNDLPwNk29NdonGYiwe3jur9tcRRCk6nt5vqpmmPQNAsehmqmaHhWuvG6ZYGWnzv5n7MQCRFcJ89uXmLf7boarssUQ\n" +
|
||||
"Ltub2b1CMTSWhX5jGKUYqyXJMpko827CQ6ixymV2KnvQ7xg3Egd1aSPYF2dm4Abdx2jsH3MgmfWFzPkC131ed8LH4814j9HT9SnwfU5fqZcg3UD\n" +
|
||||
"Ltub2b1CMTSWhX5jGKUYqyXJMpko827CQ6ixymV2KnvQ7xg3Egd1aSPYF2dm4Abdx2jsH3MgmfWFzPkC131ed8LH4814j9HT9SnwfU5fqZcg3Us\n",
|
||||
expectedOutput: "xprv9s21ZrQH143K31GyMWKbByidYkgWYp6w8jv66FXRAF2LQPyDvFKNUz57Rdq9zw4avf11d1GQ71rtH1fvWxo8iHq5J3LwqxUjYGVhk7Tf9Z2\n" +
|
||||
"xpub6CVS2FsjnyE9kTXw1jxaXdDwgGduEfCtF4JLHGbiL5GqamiaRnzAjKYCCcg2BTMgpqcudPsZX6WtaiJXNbwdWfSU657nduXSiFFgbGD1q7t\n" +
|
||||
"Ltpv71G8qDifUiNesyvYoQNDLPwNk29NdonGYiwe3jur9tcRRCk6nt5vqpmmPQNAsehmqmaHhWuvG6ZYGWnzv5n7MQCRFcJ89uXmLf7boarssUN\n" +
|
||||
"Ltub2b1CMTSWhX5jGKUYqyXJMpko827CQ6ixymV2KnvQ7xg3Egd1aSPYF2dm4Abdx2jsH3MgmfWFzPkC131ed8LH4814j9HT9SnwfU5fqZcg3UD\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Extract Double SHA Artifacts",
|
||||
"args": []
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Extract Double SHA Artifacts - Basic - Private Keys.",
|
||||
input: "KycSyYzEQvDEh2mBxVwj8igqsK5P1maqpRhmyZZZjC5vA443NfZP\n" +
|
||||
"KycSyYzEQvDEh2mBxVwj8igqsK5P1maqpRhmyZZZjC5vA443NfZQ\n" +
|
||||
"L4ecqwNqxgCUGdtL8Czup7eU71uxVNjqNsXfa3cCXSBvFoDRb2nf\n" +
|
||||
"L4ecqwNqxgCUGdtL8Czup7eU71uxVNjqNsXfa3cCXSBvFoDRb2nx\n" +
|
||||
"TBDvJMKM359XnzFUePjbJGmpDvDDZNTdTLzVJgbYBBK5hQSKikcZ\n" +
|
||||
"TBDvJMKM359XnzFUePjbJGmpDvDDZNTdTLzVJgbYBBK5hQSKikcs\n",
|
||||
expectedOutput: "KycSyYzEQvDEh2mBxVwj8igqsK5P1maqpRhmyZZZjC5vA443NfZP\n" + "L4ecqwNqxgCUGdtL8Czup7eU71uxVNjqNsXfa3cCXSBvFoDRb2nf\n" + "TBDvJMKM359XnzFUePjbJGmpDvDDZNTdTLzVJgbYBBK5hQSKikcZ\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Extract Double SHA Artifacts",
|
||||
"args": []
|
||||
},
|
||||
],
|
||||
}
|
||||
]);
|
57
tests/operations/tests/ExtractSeedphrases.mjs
Normal file
57
tests/operations/tests/ExtractSeedphrases.mjs
Normal file
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* Seedphrase Extract tests.
|
||||
*
|
||||
* @author dgoldenberg [virtualcurrency@mitre.org]
|
||||
* @copyright MITRE 2023
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Extract Seedphrases - BIP39 - Basic With Extra Newlines",
|
||||
input: "Test BIP39 Seedphrase:\n\nfitness shed \ntape chef fiber behave dad again glass number please panic\n\nThis has been a test.",
|
||||
expectedOutput: "fitness shed tape chef fiber behave dad again glass number please panic\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Extract Seedphrases",
|
||||
"args": ["bip39"]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Extract Seedphrases - BIP39 - Basic With Extra Newlines and Tabs",
|
||||
input: "Test BIP39 Seedphrase:\n\nfitness \tshed \ntape chef fiber behave dad again \t\nglass number \n\tplease panic\n\nThis has been a test.",
|
||||
expectedOutput: "fitness shed tape chef fiber behave dad again glass number please panic\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Extract Seedphrases",
|
||||
"args": ["bip39"]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Extract Seedphrases - BIP39 - Basic With Extra Newlines and not actual words.",
|
||||
input: "Test BIP39 Seedphrase:\n\nfitness shed \ntape chef 1: fiber behave 2: dad again glass 4:number please panic\n\nThis has been a test.",
|
||||
expectedOutput: "fitness shed tape chef fiber behave dad again glass number please panic\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Extract Seedphrases",
|
||||
"args": ["bip39"]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Extract Seedphrases - Electrum2 - Basic with Extra Newlines",
|
||||
input: "Test Electrum2 Seedphrase:\n\nventure enter \nribbon belt anger razor problem believe swap silk bike blur\n\nThis has been a test.",
|
||||
expectedOutput: "venture enter ribbon belt anger razor problem believe swap silk bike blur\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Extract Seedphrases",
|
||||
"args": ["electrum2"]
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
]);
|
27
tests/operations/tests/ExtractSegwitArtifacts.mjs
Normal file
27
tests/operations/tests/ExtractSegwitArtifacts.mjs
Normal file
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* Segwit extract tests.
|
||||
*
|
||||
* @author dgoldenberg [virtualcurrency@mitre.org]
|
||||
* @copyright MITRE 2023
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Extract Segwit Artifacts - Basic",
|
||||
input: "bc1qglsjlj8m2yzxvlwvhclz0kdpy96q2vtn5cmre6\n" + "bc1qglsjlj8m2yzxvlwvhclz0kdpy96q2vtn5cmre7\n" +
|
||||
"ltc1qnral26ktht5e5yr7fkzcpzwm7vta4ykjm4ksp0\n" + "ltc1qnral26ktht5e5yr7fkzcpzwm7vta4ykjm4ksp1\n" +
|
||||
"tb1qp09q604zgltxrqsu5s24qnyv6ycm3g6lzw45ta\n" + "tb1qp09q604zgltxrqsu5s24qnyv6ycm3g6lzw45ts\n" +
|
||||
"bc1pr28rdctaptapvyumjqxushmht57qccj2y7r0hszm5ldc0ua9tlxsch4nge\nbc1pr28rdctaptapvyumjqxushmht57qccj2y7r0hszm5ldc0ua9tlxsch4ngf\n",
|
||||
expectedOutput: "bc1qglsjlj8m2yzxvlwvhclz0kdpy96q2vtn5cmre6\n" + "ltc1qnral26ktht5e5yr7fkzcpzwm7vta4ykjm4ksp0\n" +
|
||||
"tb1qp09q604zgltxrqsu5s24qnyv6ycm3g6lzw45ta\nbc1pr28rdctaptapvyumjqxushmht57qccj2y7r0hszm5ldc0ua9tlxsch4nge\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Extract Segwit Addresses",
|
||||
"args": []
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
76
tests/operations/tests/PrivateECKeyToPublic.mjs
Normal file
76
tests/operations/tests/PrivateECKeyToPublic.mjs
Normal file
|
@ -0,0 +1,76 @@
|
|||
/**
|
||||
* Private key to secp256k1 public key tests.
|
||||
*
|
||||
* @author dgoldenberg [virtualcurrency@mitre.org]
|
||||
* @copyright MITRE 2023
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Private EC Key to Public (Compressed)",
|
||||
input: "5E2A8FDE9F861056607208F512287CFBD634E124044EE23EBF7289E8E7B3822E",
|
||||
expectedOutput: "036cf115be1fc5f54585965817c735d74bdae03d9665a43704a9bdbf8a1c6b1e40",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Private EC Key to Public Key",
|
||||
"args": [true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Private EC Key to Public (Uncompressed)",
|
||||
input: "5E2A8FDE9F861056607208F512287CFBD634E124044EE23EBF7289E8E7B3822E",
|
||||
expectedOutput: "046cf115be1fc5f54585965817c735d74bdae03d9665a43704a9bdbf8a1c6b1e401f8a5888434ba6abc1967c036cc28903283d0f43b53fee63a3fb0b416019892b",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Private EC Key to Public Key",
|
||||
"args": [false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Private EC Key to Public (From Bytes Uncompressed)",
|
||||
input: "5E2A8FDE9F861056607208F512287CFBD634E124044EE23EBF7289E8E7B3822E",
|
||||
expectedOutput: "036cf115be1fc5f54585965817c735d74bdae03d9665a43704a9bdbf8a1c6b1e40",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["Auto"]
|
||||
},
|
||||
{
|
||||
"op": "Private EC Key to Public Key",
|
||||
"args": [true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Private EC Key to Public (Wrong Length)",
|
||||
input: "5E2A8FDE9F861056607208F512287CFBD634E124044EE23EBF7289E8E7B3822E08",
|
||||
expectedOutput: "Must pass a hex string of length 64, or a byte string of length 32. Got length 66",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Private EC Key to Public Key",
|
||||
"args": [false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Private EC Key to Public (From Bytes Uncompressed Wrong Length)",
|
||||
input: "5E2A8FDE9F861056607208F512287CFBD634E124044EE23EBF7289E8E7B3822E08",
|
||||
expectedOutput: "Must pass a hex string of length 64, or a byte string of length 32. Got length 33",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["Auto"]
|
||||
},
|
||||
{
|
||||
"op": "Private EC Key to Public Key",
|
||||
"args": [true],
|
||||
},
|
||||
],
|
||||
}
|
||||
]);
|
88
tests/operations/tests/PrivateKeyToWIF.mjs
Normal file
88
tests/operations/tests/PrivateKeyToWIF.mjs
Normal file
|
@ -0,0 +1,88 @@
|
|||
/**
|
||||
* Private Key to Wallet-Import-Format tests.
|
||||
*
|
||||
* @author dgoldenberg [virtualcurrency@mitre.org]
|
||||
* @copyright MITRE 2023
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Private Key To WIF (BTC, Compressed)",
|
||||
input: "5E2A8FDE9F861056607208F512287CFBD634E124044EE23EBF7289E8E7B3822E",
|
||||
expectedOutput: "KzNkuRstcjZGuwYu5wWbLcwXzNngvH2oWPDymKxL7tdU48SSb5uX",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To WIF Format",
|
||||
"args": ["BTC", true]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Private Key To WIF (BTC, Compressed, From Bytes)",
|
||||
input: "5E2A8FDE9F861056607208F512287CFBD634E124044EE23EBF7289E8E7B3822E",
|
||||
expectedOutput: "KzNkuRstcjZGuwYu5wWbLcwXzNngvH2oWPDymKxL7tdU48SSb5uX",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["Auto"]
|
||||
},
|
||||
{
|
||||
"op": "To WIF Format",
|
||||
"args": ["BTC", true]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Private Key To WIF (BTC, Uncompressed)",
|
||||
input: "5E2A8FDE9F861056607208F512287CFBD634E124044EE23EBF7289E8E7B3822E",
|
||||
expectedOutput: "5JXkw276MLA8EMWtDuE3o8gzmie5y2NFcf7ZoHywdTCSAPQWJtG",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To WIF Format",
|
||||
"args": ["BTC", false]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Private Key To WIF (Testnet, Compressed)",
|
||||
input: "6ADA95C3D8BC2E06E818EC4816A0EB4455448A3FD70DA26EF218F7FC5ED1A2C0",
|
||||
expectedOutput: "cRAQpjSDxVVHdMHQbhyUjE8XytUm8nB47NHJqg9dpJqkhuetPesF",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To WIF Format",
|
||||
"args": ["Testnet", true]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Private Key To WIF (BTC, Compressed, Wrong Number of Bytes)",
|
||||
input: "5E2A8FDE9F861056607208F512287CFBD634E124044EE23EBF7289E8E7B3822E08",
|
||||
expectedOutput: "Must pass a hex string of length 64, or a byte string of length 32. Got length: 66",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To WIF Format",
|
||||
"args": ["BTC", true]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Private Key To WIF (BTC, Compressed, Wrong Number of Bytes)",
|
||||
input: "5E2A8FDE9F861056607208F512287CFBD634E124044EE23EBF7289E8E7B3822E08",
|
||||
expectedOutput: "Must pass a hex string of length 64, or a byte string of length 32. Got length: 33",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["Auto"]
|
||||
},
|
||||
{
|
||||
"op": "To WIF Format",
|
||||
"args": ["BTC", true]
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
]);
|
174
tests/operations/tests/PublicKeyToP2PKHAddress.mjs
Normal file
174
tests/operations/tests/PublicKeyToP2PKHAddress.mjs
Normal file
|
@ -0,0 +1,174 @@
|
|||
/**
|
||||
* Public Key to cryptocurrency address tests.
|
||||
*
|
||||
* @author dgoldenberg [virtualcurrency@mitre.org]
|
||||
* @copyright MITRE 2023
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Public Key To Address: P2PKH (1)",
|
||||
input: "03ebf60a619da2fbc6239089ca0a93878ea53baa3d22188cacad4033b103237ae9",
|
||||
expectedOutput: "1MwwHqDj1FAyABeqPeiTTvJQCoCorcuFyP",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Public Key To Cryptocurrency Address",
|
||||
"args": ["BTC", "P2PKH (V1 BTC Addresses)"]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Public Key To Address: P2PKH (2)",
|
||||
input: "021dc4eb14b93dfbbbe4578293d07b6ee443ca025d89fd43a657ee3fd8c81d03f6",
|
||||
expectedOutput: "18wUwr4Jvor6LG1mvQcfEp1Lx51dYAXZX1",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Public Key To Cryptocurrency Address",
|
||||
"args": ["BTC", "P2PKH (V1 BTC Addresses)"]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Public Key To Address: P2PKH (Long)",
|
||||
input: "04219A19E157B5FEDDF7EBDD3C7A58D7AB4F6565E84226691B6A5F80BBCE8E0100B49D6AB503CA4B701626E941EB8D2460F154992D7AD4EC671CF1CFB8C1DE8164",
|
||||
expectedOutput: "1BgRqTW8RMmcTRXHymTCVJsn5NVk9U8L9q",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Public Key To Cryptocurrency Address",
|
||||
"args": ["BTC", "P2PKH (V1 BTC Addresses)"]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Public Key To Address: P2SH-P2WPKH (1)",
|
||||
input: "03a24ca9f13f6bcbc15615f71504be75566120b9bc7072e171756233162c726432",
|
||||
expectedOutput: "31vhdy8RGhSYZRRGZfqvZHGzVtpcua4cQW",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Public Key To Cryptocurrency Address",
|
||||
"args": ["BTC", "P2SH-P2PWPKH (Segwit Compatible)"]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Public Key To Address: P2SH-P2WPKH (2)",
|
||||
input: "021a4310db1211939e20c88e9b90be354a145ec323a045de47ff0ea3145f99c8c9",
|
||||
expectedOutput: "3C9wCFwcd36MHVpontDF7zQfKPfRTNg4Fe",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Public Key To Cryptocurrency Address",
|
||||
"args": ["BTC", "P2SH-P2PWPKH (Segwit Compatible)"]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Public Key To Address: P2WPKH (1)",
|
||||
input: "02530f0512d544344a04777be5477a2ffef813a110ac0705fafa012f5b61b56380",
|
||||
expectedOutput: "bc1qu37uvwyzj23a2dd3x5nd8s77nfskzu3lzkuqfm",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Public Key To Cryptocurrency Address",
|
||||
"args": ["BTC", "Segwit (P2WPKH)"]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Public Key To Address: P2WPKH (2)",
|
||||
input: "03bc32bdc5dc96c9fb56e2481fefd321ebe9e17a807bbb337dea1df5e68b1f0756",
|
||||
expectedOutput: "bc1qrjluhfu5qr2780zlvcx3kquckpvuamwqp2sjle",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Public Key To Cryptocurrency Address",
|
||||
"args": ["BTC", "Segwit (P2WPKH)"]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Public Key To Address: (ETH)",
|
||||
input: "04d26bcecd763bdf6bdb89ba929d2485429fbda73bae723d525ef55554ef45350582085bd24055079f6deebad5b6af612c14587c6862391d330484afe750fbf144",
|
||||
expectedOutput: "0x63e8b85679d29235791a0f558d6485c7ed51c9e6",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Public Key To Cryptocurrency Address",
|
||||
"args": ["Ethereum", "Segwit (P2WPKH)"]
|
||||
},
|
||||
],
|
||||
|
||||
},
|
||||
{
|
||||
name: "Public Key To Address: (Testnet)",
|
||||
input: "02aa6438e78b18a503f4466672fd04e31aaeec3ed1c3e0e1f19654776f0f0dc1b2",
|
||||
expectedOutput: "mmuoeJDuuzeuaii1V6tPK3L5YjaJwjPqUM",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Public Key To Cryptocurrency Address",
|
||||
"args": ["Testnet", "P2PKH (V1 BTC Addresses)"]
|
||||
},
|
||||
],
|
||||
|
||||
},
|
||||
{
|
||||
name: "Public Key To Address: P2WPKH (Wrong Length)",
|
||||
input: "03bc32bdc5dc96c9fb56e2481fefd321ebe9e17a807bbb337dea1df5e68b1f075642",
|
||||
expectedOutput: "Input is wrong length. Should be either 33 or 65 bytes, but is: 34",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Public Key To Cryptocurrency Address",
|
||||
"args": ["BTC", "Segwit (P2WPKH)"]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Public Key To Address: P2WPKH (Wrong Start)",
|
||||
input: "05bc32bdc5dc96c9fb56e2481fefd321ebe9e17a807bbb337dea1df5e68b1f0756",
|
||||
expectedOutput: "Input is 33 bytes, but begins with invalid byte: 05",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Public Key To Cryptocurrency Address",
|
||||
"args": ["BTC", "Segwit (P2WPKH)"]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Public Key To Address: P2PKH (Long With Error)",
|
||||
input: "06219A19E157B5FEDDF7EBDD3C7A58D7AB4F6565E84226691B6A5F80BBCE8E0100B49D6AB503CA4B701626E941EB8D2460F154992D7AD4EC671CF1CFB8C1DE8164",
|
||||
expectedOutput: "Input is 65 bytes, but begins with invalid byte: 06",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Public Key To Cryptocurrency Address",
|
||||
"args": ["BTC", "P2PKH (V1 BTC Addresses)"]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Public Key To Address: P2PKH (From Bytes)",
|
||||
input: "03ebf60a619da2fbc6239089ca0a93878ea53baa3d22188cacad4033b103237ae9",
|
||||
expectedOutput: "1MwwHqDj1FAyABeqPeiTTvJQCoCorcuFyP",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From Hex",
|
||||
"args": ["Auto"]
|
||||
},
|
||||
{
|
||||
"op": "Public Key To Cryptocurrency Address",
|
||||
"args": ["BTC", "P2PKH (V1 BTC Addresses)"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Public Key To Address: (ETH Compressed Key)",
|
||||
input: "03ebf60a619da2fbc6239089ca0a93878ea53baa3d22188cacad4033b103237ae9",
|
||||
expectedOutput: "Ethereum addresses require uncompressed public keys.",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Public Key To Cryptocurrency Address",
|
||||
"args": ["Ethereum", "Segwit (P2WPKH)"]
|
||||
},
|
||||
],
|
||||
|
||||
}
|
||||
]);
|
47
tests/operations/tests/SeedToMPK.mjs
Normal file
47
tests/operations/tests/SeedToMPK.mjs
Normal file
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
* Seed to master private key tests.
|
||||
*
|
||||
* @author dgoldenberg [virtualcurrency@mitre.org]
|
||||
* @copyright MITRE 2023
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Seed To Master Private Key (xprv)",
|
||||
input: "c766f48d3729a16249b5d0171c678d458d31454b2bb7791b61169b5541a130719714ebd41f22a2515246d013e9a4e978aee48dd5140b73a540108d58008c4aa9",
|
||||
expectedOutput: "xprv9s21ZrQH143K2nwujwREGif1wyBwt5Jh9BdFVSgSeYdrUp1qPxKsHrmnpJ8xKpKPDvXJMmBRpsZ3X64MeafyURs8Xoj53kGu7hb48Yg7unj",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Seed To Master Key",
|
||||
"args": ["xprv"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Seed To Master Private Key (tprv)",
|
||||
input: "c766f48d3729a16249b5d0171c678d458d31454b2bb7791b61169b5541a130719714ebd41f22a2515246d013e9a4e978aee48dd5140b73a540108d58008c4aa9",
|
||||
expectedOutput: "tprv8ZgxMBicQKsPdcBSQWGjSNH1G6cA7bLhUjYNMs6u8X8LGQkvPKfcoc9EjUJcLBhhbN45MroBzE8qywc6mo1vHV8j4SwNi6zx2oLUaEMVJqo",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Seed To Master Key",
|
||||
"args": ["tprv"]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Seed To Master Private Key (Ltpv)",
|
||||
input: "c766f48d3729a16249b5d0171c678d458d31454b2bb7791b61169b5541a130719714ebd41f22a2515246d013e9a4e978aee48dd5140b73a540108d58008c4aa9",
|
||||
expectedOutput: "Ltpv71G8qDifUiNesmbVBqTrR8sm9Eeoy4z2ZAeoSw4seCDwVcniGb6RehUSn4fyCXxa936aSGpwyxFhWbBS3hex7YEUVNgFMhKvv6CxBzBoSoz",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Seed To Master Key",
|
||||
"args": ["Ltpv"]
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
]);
|
56
tests/operations/tests/SeedphraseToSeed.mjs
Normal file
56
tests/operations/tests/SeedphraseToSeed.mjs
Normal file
|
@ -0,0 +1,56 @@
|
|||
/**
|
||||
* Seedphrase to seed tests.
|
||||
*
|
||||
* @author dgoldenberg [virtualcurrency@mitre.org]
|
||||
* @copyright MITRE 2023
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Seedphrase to Seed - BIP39 - 12",
|
||||
input: "regret snack luxury tornado orient end bind video caution syrup minimum tree",
|
||||
expectedOutput: "f2c6a948086e43745837e3aafb5fad31086da2bc83d76da4d029a38037f4e032eb75e30560921e75fafb791c53888d0eed7006ce29a9552d9888c9e7be58b461",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Seedphrase To Seed",
|
||||
"args": ["bip39", { "option": "UTF8", "string": "" }]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Seedphrase to Seed - BIP39 - 12 - Passphrase",
|
||||
input: "regret snack luxury tornado orient end bind video caution syrup minimum tree",
|
||||
expectedOutput: "60fa03fa8de256a794c04828051578b76ac7c3e130a034b27f47017eae8d52a37fe2a0f8e71e364ec81af9109ea100b4a16fef730628c9be4c4cc8d7360599a4",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Seedphrase To Seed",
|
||||
"args": ["bip39", { "option": "UTF8", "string": "password1234" }]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Seedphrase to Seed - Electrum - 12",
|
||||
input: "hover engine either unknown hospital pole idea settle advice parent bundle solid",
|
||||
expectedOutput: "0e66066dcd50ce43cd64dd42adae6f6fe2d121622677255cadcbf9695c73eb5a1dc44e763793f858c3421089c0e623c55309262527665f1bbb0d26bac080108b",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Seedphrase To Seed",
|
||||
"args": ["electrum2", { "option": "UTF8", "string": "" }]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Seedphrase to Seed - Electrum - 12 - Passphrase",
|
||||
input: "hover engine either unknown hospital pole idea settle advice parent bundle solid",
|
||||
expectedOutput: "90a4fff5335f9023dc75c7872c1207e90cadc7b4d8dc3b7c217d4d3be9428a7987154ab21c5c9a4abe6d038fbf68bb0400eaa461f41b9838f346bb79b8852f98",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Seedphrase To Seed",
|
||||
"args": ["electrum2", { "option": "UTF8", "string": "password1234" }]
|
||||
}
|
||||
],
|
||||
}
|
||||
]);
|
144
tests/operations/tests/TypeCryptoArtifacts.mjs
Normal file
144
tests/operations/tests/TypeCryptoArtifacts.mjs
Normal file
|
@ -0,0 +1,144 @@
|
|||
/**
|
||||
* Typing cryptocurrency artifact tests.
|
||||
*
|
||||
* @author dgoldenberg [virtualcurrency@mitre.org]
|
||||
* @copyright MITRE 2023
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Type Cryptocurrency Artifacts - P2SH",
|
||||
input: "37TKx6FKj3P7fAeVoVwKsy39DzFhyHnvnr",
|
||||
expectedOutput: "Input 37TKx6FKj3P7fAeVoVwKsy39DzFhyHnvnr is possibly a P2SH, or P2SH-P2WPKH address.\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Type Cryptocurrency Artifact",
|
||||
"args": []
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Type Cryptocurrency Artifacts - Compressed WIF",
|
||||
input: "KwaCxiHcCGgD2b2MopWhoX218C1e5KZ8uu5G5ijGSCZDReuuxZcB",
|
||||
expectedOutput: "Input KwaCxiHcCGgD2b2MopWhoX218C1e5KZ8uu5G5ijGSCZDReuuxZcB is possibly a compressed WIF (Wallet-Input-Format) Key.\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Type Cryptocurrency Artifact",
|
||||
"args": []
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Type Cryptocurrency Artifacts - Compressed WIF",
|
||||
input: "L3vjDdHwHzw2QnPkMRnsnwtfd3zpWHcmxq5LVBkBnGy7mU5iVJJg",
|
||||
expectedOutput: "Input L3vjDdHwHzw2QnPkMRnsnwtfd3zpWHcmxq5LVBkBnGy7mU5iVJJg is possibly a compressed WIF (Wallet-Input-Format) Key.\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Type Cryptocurrency Artifact",
|
||||
"args": []
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Type Cryptocurrency Artifacts - P2PKH",
|
||||
input: "15bhKCjC8C3jKgTCexe15vX62ahhsujoLx",
|
||||
expectedOutput: "Input 15bhKCjC8C3jKgTCexe15vX62ahhsujoLx is possibly a Bitcoin P2PKH address.\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Type Cryptocurrency Artifact",
|
||||
"args": []
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Type Cryptocurrency Artifacts - Compressed Public",
|
||||
input: "02fc2dcc9f0b88922e32eb3ced89eecaea7eb8d9c0adf05b8b6c8cc0e4504aa91d",
|
||||
expectedOutput: "Input 02fc2dcc9f0b88922e32eb3ced89eecaea7eb8d9c0adf05b8b6c8cc0e4504aa91d is possibly a compressed public key in raw bytes.\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Type Cryptocurrency Artifact",
|
||||
"args": []
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Type Cryptocurrency Artifacts - Compressed Public",
|
||||
input: "03ebbd632f1f1b885ffddde739e0a285dd337f3d80759a119fd6699d740a8cefc9",
|
||||
expectedOutput: "Input 03ebbd632f1f1b885ffddde739e0a285dd337f3d80759a119fd6699d740a8cefc9 is possibly a compressed public key in raw bytes.\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Type Cryptocurrency Artifact",
|
||||
"args": []
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Type Cryptocurrency Artifacts - Uncompressed Public",
|
||||
input: "04BED04F74E8CB11C0A0FFC214429F7803174100660385F739A246F5D42231D7F44357E672B06EC1891DFA8BBC2129DC54384EA20B360C63EFA4E6CC6E4260D306",
|
||||
expectedOutput: "Input 04BED04F74E8CB11C0A0FFC214429F7803174100660385F739A246F5D42231D7F44357E672B06EC1891DFA8BBC2129DC54384EA20B360C63EFA4E6CC6E4260D306 is possibly an uncompressed public key in raw bytes.\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Type Cryptocurrency Artifact",
|
||||
"args": []
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Type Cryptocurrency Artifacts - Uncompressed WIF",
|
||||
input: "5KbFn3aqNgxotDZA4S28xaDcm7GhLt9K3LydqUtKfJbkAjarLnt",
|
||||
expectedOutput: "Input 5KbFn3aqNgxotDZA4S28xaDcm7GhLt9K3LydqUtKfJbkAjarLnt is possibly an uncompressed WIF (Wallet-Input-Format) Key.\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Type Cryptocurrency Artifact",
|
||||
"args": []
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Type Cryptocurrency Artifacts - Segwit",
|
||||
input: "bc1qxqy2d8mfl6gvk3fp5k9y3umv7h3fcgxpfs7w02",
|
||||
expectedOutput: "Input bc1qxqy2d8mfl6gvk3fp5k9y3umv7h3fcgxpfs7w02 is possibly a Segwit address (P2WPKH/P2WSH).\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Type Cryptocurrency Artifact",
|
||||
"args": []
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Type Cryptocurrency Artifacts - Taproot",
|
||||
input: "bc1pw508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7kt5nd6y",
|
||||
expectedOutput: "Input bc1pw508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7kt5nd6y is possibly a taproot.\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Type Cryptocurrency Artifact",
|
||||
"args": []
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Type Cryptocurrency Artifacts - Private",
|
||||
input: "E9CDB0734EC8CD727F58B5FD16E4277AB87FA5E74ED288779E908F4EF433BD2E",
|
||||
expectedOutput: "Input E9CDB0734EC8CD727F58B5FD16E4277AB87FA5E74ED288779E908F4EF433BD2E is possibly a private key in raw bytes.\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Type Cryptocurrency Artifact",
|
||||
"args": []
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Type Cryptocurrency Artifacts - BIP38",
|
||||
input: "6PYLLdPvL6tu2te7d4EaPpjZuzmuv2KWq2EkxBukPyknrf36gQW6a6qhXx",
|
||||
expectedOutput: "Input 6PYLLdPvL6tu2te7d4EaPpjZuzmuv2KWq2EkxBukPyknrf36gQW6a6qhXx is possibly a BIP38 encrypted key.\n",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Type Cryptocurrency Artifact",
|
||||
"args": []
|
||||
},
|
||||
],
|
||||
}
|
||||
]);
|
45
tests/operations/tests/WIFToPrivateKey.mjs
Normal file
45
tests/operations/tests/WIFToPrivateKey.mjs
Normal file
|
@ -0,0 +1,45 @@
|
|||
/**
|
||||
* Wallet Import Format to Private key tests.
|
||||
*
|
||||
* @author dgoldenberg [virtualcurrency@mitre.org]
|
||||
* @copyright MITRE 2023
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "WIF to Private Key - Compressed",
|
||||
input: "L3uC2epVmApXLbnCFSiS3hK4UkVLMnyrCGpPRzbxvRB3tKWRJPUF",
|
||||
expectedOutput: "c7559d1ffd85dc07e8e86413f99fdb42201257f97765c2dee8a632451b680a78",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From WIF Format",
|
||||
"args": []
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "WIF to Private Key - Uncompressed 2",
|
||||
input: "5Jqv2HL2tEHEeg5hGdSTKkVaAdFtXfi1jKXkJLVAr6rU3DdASSy",
|
||||
expectedOutput: "8764b291f07ca7dd0cf939c65a4127f95d16b9412e90829d2b2a5085ad5ffb5b",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From WIF Format",
|
||||
"args": []
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "WIF to Private Key - Unompressed",
|
||||
input: "5KL5K3gJqybnPZoVNrKuM6WU52F8755GgFusrARgriGsVrkJ9Hm",
|
||||
expectedOutput: "c7559d1ffd85dc07e8e86413f99fdb42201257f97765c2dee8a632451b680a78",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "From WIF Format",
|
||||
"args": []
|
||||
},
|
||||
],
|
||||
}
|
||||
]);
|
Loading…
Add table
Add a link
Reference in a new issue