Compare commits

...
9 Commits
Author SHA1 Message Date
n1474335 5d52c49c31 5.3.3 2017-05-05 16:04:22 +00:00
n1474335 d53da4cfb5 Merge branch 'bug-x509-sig' 2017-05-05 16:03:40 +00:00
n1474335 76204f5f47 Fixed lint errors 2017-05-05 16:03:25 +00:00
n1474335 b68adbd9a8 Merge branch 'master' into bug-x509-sig 2017-05-05 16:02:12 +00:00
n1474335 951b168f3a 5.3.2 2017-05-05 16:00:40 +00:00
n1474335 53d89af459 Merge branch 'feature-key-derivation-hashers' 2017-05-05 15:58:00 +00:00
n1474335 4f844ea837 Merge branch 'master' into feature-key-derivation-hashers 2017-05-05 15:57:42 +00:00
n1474335 b010fd88e8 Fix X.509 signature breakout bug 2017-05-05 15:42:24 +00:00
n1474335 66a93b81c6 Added hasher argument to PBKDF2 and EVPKDF operations. 2017-05-05 15:38:38 +00:00
4 changed files with 43 additions and 11 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "cyberchef",
"version": "5.3.1",
"version": "5.3.3",
"description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.",
"author": "n1474335 <n1474335@gmail.com>",
"homepage": "https://gchq.github.io/CyberChef",
+10
View File
@@ -1401,6 +1401,11 @@ const OperationConfig = {
type: "number",
value: Cipher.KDF_ITERATIONS
},
{
name: "Hashing function",
type: "option",
value: Cipher.HASHERS
},
{
name: "Salt (hex)",
type: "string",
@@ -1434,6 +1439,11 @@ const OperationConfig = {
type: "number",
value: Cipher.KDF_ITERATIONS
},
{
name: "Hashing function",
type: "option",
value: Cipher.HASHERS
},
{
name: "Salt (hex)",
type: "string",
+23 -8
View File
@@ -309,6 +309,11 @@ const Cipher = {
* @default
*/
KDF_ITERATIONS: 1,
/**
* @constant
* @default
*/
HASHERS: ["MD5", "SHA1", "SHA224", "SHA256", "SHA384", "SHA512", "SHA3", "RIPEMD160"],
/**
* Derive PBKDF2 key operation.
@@ -320,11 +325,16 @@ const Cipher = {
runPbkdf2: function (input, args) {
let keySize = args[0] / 32,
iterations = args[1],
salt = CryptoJS.enc.Hex.parse(args[2] || ""),
inputFormat = args[3],
outputFormat = args[4],
hasher = args[2],
salt = CryptoJS.enc.Hex.parse(args[3] || ""),
inputFormat = args[4],
outputFormat = args[5],
passphrase = Utils.format[inputFormat].parse(input),
key = CryptoJS.PBKDF2(passphrase, salt, { keySize: keySize, iterations: iterations });
key = CryptoJS.PBKDF2(passphrase, salt, {
keySize: keySize,
hasher: CryptoJS.algo[hasher],
iterations: iterations,
});
return key.toString(Utils.format[outputFormat]);
},
@@ -340,11 +350,16 @@ const Cipher = {
runEvpkdf: function (input, args) {
let keySize = args[0] / 32,
iterations = args[1],
salt = CryptoJS.enc.Hex.parse(args[2] || ""),
inputFormat = args[3],
outputFormat = args[4],
hasher = args[2],
salt = CryptoJS.enc.Hex.parse(args[3] || ""),
inputFormat = args[4],
outputFormat = args[5],
passphrase = Utils.format[inputFormat].parse(input),
key = CryptoJS.EvpKDF(passphrase, salt, { keySize: keySize, iterations: iterations });
key = CryptoJS.EvpKDF(passphrase, salt, {
keySize: keySize,
hasher: CryptoJS.algo[hasher],
iterations: iterations,
});
return key.toString(Utils.format[outputFormat]);
},
+9 -2
View File
@@ -124,10 +124,17 @@ const PublicKey = {
}
// Signature fields
if (r.ASN1HEX.dump(certSig).indexOf("SEQUENCE") === 0) { // DSA or ECDSA
let breakoutSig = false;
try {
breakoutSig = r.ASN1HEX.dump(certSig).indexOf("SEQUENCE") === 0;
} catch (err) {
// Error processing signature, output without further breakout
}
if (breakoutSig) { // DSA or ECDSA
sigStr = " r: " + PublicKey._formatByteStr(r.ASN1HEX.getDecendantHexVByNthList(certSig, 0, [0]), 16, 18) + "\n" +
" s: " + PublicKey._formatByteStr(r.ASN1HEX.getDecendantHexVByNthList(certSig, 0, [1]), 16, 18) + "\n";
} else { // RSA
} else { // RSA or unknown
sigStr = " Signature: " + PublicKey._formatByteStr(certSig, 16, 18) + "\n";
}