From 892a3716eda14f951c03e476455ccb8dc4b52b94 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Tue, 9 Feb 2021 15:00:35 +0000 Subject: [PATCH] Added Crypt lib for common resources --- src/core/lib/Crypt.mjs | 9 +++++++++ src/core/operations/GeneratePGPKeyPair.mjs | 4 +++- src/core/operations/GenerateRSAKeyPair.mjs | 3 ++- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 src/core/lib/Crypt.mjs diff --git a/src/core/lib/Crypt.mjs b/src/core/lib/Crypt.mjs new file mode 100644 index 00000000..c36a0267 --- /dev/null +++ b/src/core/lib/Crypt.mjs @@ -0,0 +1,9 @@ +/** + * Crypt resources. + * + * @author n1474335 [n1474335@gmail.com] + * @copyright Crown Copyright 2021 + * @license Apache-2.0 + */ + +export const cryptNotice = "WARNING: Cryptographic operations in CyberChef should not be relied upon to provide security in any situation. No guarantee is offered for their correctness. We advise you not to use keys generated from CyberChef in operational contexts."; diff --git a/src/core/operations/GeneratePGPKeyPair.mjs b/src/core/operations/GeneratePGPKeyPair.mjs index 5943ce31..a26b5cc8 100644 --- a/src/core/operations/GeneratePGPKeyPair.mjs +++ b/src/core/operations/GeneratePGPKeyPair.mjs @@ -9,9 +9,11 @@ import Operation from "../Operation.mjs"; import kbpgp from "kbpgp"; import { getSubkeySize, ASP } from "../lib/PGP.mjs"; +import { cryptNotice } from "../lib/Crypt.mjs"; import * as es6promisify from "es6-promisify"; const promisify = es6promisify.default ? es6promisify.default.promisify : es6promisify.promisify; + /** * Generate PGP Key Pair operation */ @@ -25,7 +27,7 @@ class GeneratePGPKeyPair extends Operation { this.name = "Generate PGP Key Pair"; this.module = "PGP"; - this.description = "Generates a new public/private PGP key pair. Supports RSA and Eliptic Curve (EC) keys.

WARNING: Cryptographic operations in CyberChef should not be relied upon to provide security in any situation. No guarantee is offered for their correctness. We advise you not to use keys generated from CyberChef in operational contexts."; + this.description = `Generates a new public/private PGP key pair. Supports RSA and Eliptic Curve (EC) keys.

${cryptNotice}`; this.infoURL = "https://wikipedia.org/wiki/Pretty_Good_Privacy"; this.inputType = "string"; this.outputType = "string"; diff --git a/src/core/operations/GenerateRSAKeyPair.mjs b/src/core/operations/GenerateRSAKeyPair.mjs index f263eb23..3dd2837d 100644 --- a/src/core/operations/GenerateRSAKeyPair.mjs +++ b/src/core/operations/GenerateRSAKeyPair.mjs @@ -7,6 +7,7 @@ import Operation from "../Operation.mjs"; import forge from "node-forge"; +import { cryptNotice } from "../lib/Crypt.mjs"; /** * Generate RSA Key Pair operation @@ -21,7 +22,7 @@ class GenerateRSAKeyPair extends Operation { this.name = "Generate RSA Key Pair"; this.module = "Ciphers"; - this.description = "Generate an RSA key pair with a given number of bits.

WARNING: Cryptographic operations in CyberChef should not be relied upon to provide security in any situation. No guarantee is offered for their correctness. We advise you not to use keys generated from CyberChef in operational contexts."; + this.description = `Generate an RSA key pair with a given number of bits.

${cryptNotice}`; this.infoURL = "https://wikipedia.org/wiki/RSA_(cryptosystem)"; this.inputType = "string"; this.outputType = "string";