mirror of
https://github.com/gchq/CyberChef.git
synced 2024-11-01 21:51:02 +01:00
Fixed RSA Sign and Verify character encodings
This commit is contained in:
parent
d635cca210
commit
895a929925
@ -60,7 +60,7 @@ class RSASign extends Operation {
|
|||||||
const privateKey = forge.pki.decryptRsaPrivateKey(key, password);
|
const privateKey = forge.pki.decryptRsaPrivateKey(key, password);
|
||||||
// Generate message hash
|
// Generate message hash
|
||||||
const md = MD_ALGORITHMS[mdAlgo].create();
|
const md = MD_ALGORITHMS[mdAlgo].create();
|
||||||
md.update(input, "utf8");
|
md.update(input, "raw");
|
||||||
// Sign message hash
|
// Sign message hash
|
||||||
const sig = privateKey.sign(md);
|
const sig = privateKey.sign(md);
|
||||||
return sig;
|
return sig;
|
||||||
|
@ -60,7 +60,7 @@ class RSAVerify extends Operation {
|
|||||||
const pubKey = forge.pki.publicKeyFromPem(pemKey);
|
const pubKey = forge.pki.publicKeyFromPem(pemKey);
|
||||||
// Generate message digest
|
// Generate message digest
|
||||||
const md = MD_ALGORITHMS[mdAlgo].create();
|
const md = MD_ALGORITHMS[mdAlgo].create();
|
||||||
md.update(message, "utf8");
|
md.update(message, "raw");
|
||||||
// Compare signed message digest and generated message digest
|
// Compare signed message digest and generated message digest
|
||||||
const result = pubKey.verify(md.digest().bytes(), input);
|
const result = pubKey.verify(md.digest().bytes(), input);
|
||||||
return result ? "Verified OK" : "Verification Failure";
|
return result ? "Verified OK" : "Verification Failure";
|
||||||
|
Loading…
Reference in New Issue
Block a user