Merge branch 'user-friendly-parse-x509-certificate' of https://github.com/mikecat/CyberChef

This commit is contained in:
n1474335 2022-11-25 12:15:29 +00:00
commit 74e9edbccf

View file

@ -57,6 +57,8 @@ class ParseX509Certificate extends Operation {
const cert = new r.X509(),
inputFormat = args[0];
let undefinedInputFormat = false;
try {
switch (inputFormat) {
case "DER Hex":
input = input.replace(/\s/g, "").toLowerCase();
@ -72,8 +74,12 @@ class ParseX509Certificate extends Operation {
cert.readCertHex(toHex(Utils.strToByteArray(input), ""));
break;
default:
throw "Undefined input format";
undefinedInputFormat = true;
}
} catch (e) {
throw "Certificate load error (non-certificate input?)";
}
if (undefinedInputFormat) throw "Undefined input format";
const sn = cert.getSerialNumberHex(),
issuer = cert.getIssuer(),