1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 12:41:29 +00:00

Ensure consistent ordering of XML output in ssl-cert.nse

This commit is contained in:
dmiller
2020-01-08 17:39:51 +00:00
parent a87b0ca133
commit cdf5c21951

View File

@@ -215,22 +215,19 @@ local function output_tab(cert)
local o = stdnse.output_table() local o = stdnse.output_table()
o.subject = name_to_table(cert.subject) o.subject = name_to_table(cert.subject)
o.issuer = name_to_table(cert.issuer) o.issuer = name_to_table(cert.issuer)
o.pubkey = {}
for k, v in pairs(cert.pubkey) do o.pubkey = stdnse.output_table()
local out = v o.pubkey.type = cert.pubkey.type
if have_openssl and type(v) == "userdata" then o.pubkey.bits = cert.pubkey.bits
if k == "exponent" then o.pubkey.modulus = openssl.bignum_bn2hex(cert.pubkey.modulus)
out = openssl.bignum_bn2dec(v) o.pubkey.exponent = openssl.bignum_bn2dec(cert.pubkey.exponent)
else
out = openssl.bignum_bn2hex(v)
end
end
o.pubkey[k] = out
end
o.extensions = cert.extensions o.extensions = cert.extensions
o.sig_algo = cert.sig_algorithm o.sig_algo = cert.sig_algorithm
o.validity = {}
for k, v in pairs(cert.validity) do o.validity = stdnse.output_table()
for i, k in ipairs({"notBefore", "notAfter"}) do
local v = cert.validity[k]
if type(v)=="string" then if type(v)=="string" then
o.validity[k] = v o.validity[k] = v
else else