Skip to content

Commit 3deb121

Browse files
authoredDec 1, 2024··
Merge branch 'master' into feature/parse-crl
2 parents 1fde2fb + 3822c6c commit 3deb121

File tree

4 files changed

+23
-16
lines changed

4 files changed

+23
-16
lines changed
 

‎package-lock.json

+11-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cyberchef",
3-
"version": "10.19.2",
3+
"version": "10.19.4",
44
"description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.",
55
"author": "n1474335 <n1474335@gmail.com>",
66
"homepage": "https://gchq.github.io/CyberChef",
@@ -55,7 +55,7 @@
5555
"babel-plugin-dynamic-import-node": "^2.3.3",
5656
"babel-plugin-transform-builtin-extend": "1.1.2",
5757
"base64-loader": "^1.0.0",
58-
"chromedriver": "^127.0.2",
58+
"chromedriver": "^130.0.0",
5959
"cli-progress": "^3.12.0",
6060
"colors": "^1.4.0",
6161
"copy-webpack-plugin": "^12.0.2",

‎src/core/operations/RSASign.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class RSASign extends Operation {
6060
const privateKey = forge.pki.decryptRsaPrivateKey(key, password);
6161
// Generate message hash
6262
const md = MD_ALGORITHMS[mdAlgo].create();
63-
md.update(input, "utf8");
63+
md.update(input, "raw");
6464
// Sign message hash
6565
const sig = privateKey.sign(md);
6666
return sig;

‎src/core/operations/RSAVerify.mjs

+9-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import Operation from "../Operation.mjs";
88
import OperationError from "../errors/OperationError.mjs";
99
import forge from "node-forge";
1010
import { MD_ALGORITHMS } from "../lib/RSA.mjs";
11+
import Utils from "../Utils.mjs";
1112

1213
/**
1314
* RSA Verify operation
@@ -37,6 +38,11 @@ class RSAVerify extends Operation {
3738
type: "text",
3839
value: ""
3940
},
41+
{
42+
name: "Message format",
43+
type: "option",
44+
value: ["Raw", "Hex", "Base64"]
45+
},
4046
{
4147
name: "Message Digest Algorithm",
4248
type: "option",
@@ -51,7 +57,7 @@ class RSAVerify extends Operation {
5157
* @returns {string}
5258
*/
5359
run(input, args) {
54-
const [pemKey, message, mdAlgo] = args;
60+
const [pemKey, message, format, mdAlgo] = args;
5561
if (pemKey.replace("-----BEGIN RSA PUBLIC KEY-----", "").length === 0) {
5662
throw new OperationError("Please enter a public key.");
5763
}
@@ -60,7 +66,8 @@ class RSAVerify extends Operation {
6066
const pubKey = forge.pki.publicKeyFromPem(pemKey);
6167
// Generate message digest
6268
const md = MD_ALGORITHMS[mdAlgo].create();
63-
md.update(message, "utf8");
69+
const messageStr = Utils.convertToByteString(message, format);
70+
md.update(messageStr, "raw");
6471
// Compare signed message digest and generated message digest
6572
const result = pubKey.verify(md.digest().bytes(), input);
6673
return result ? "Verified OK" : "Verification Failure";

0 commit comments

Comments
 (0)
Please sign in to comment.