mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Ensure consistent ordering of XML output in ssl-cert.nse
This commit is contained in:
@@ -215,22 +215,19 @@ local function output_tab(cert)
|
||||
local o = stdnse.output_table()
|
||||
o.subject = name_to_table(cert.subject)
|
||||
o.issuer = name_to_table(cert.issuer)
|
||||
o.pubkey = {}
|
||||
for k, v in pairs(cert.pubkey) do
|
||||
local out = v
|
||||
if have_openssl and type(v) == "userdata" then
|
||||
if k == "exponent" then
|
||||
out = openssl.bignum_bn2dec(v)
|
||||
else
|
||||
out = openssl.bignum_bn2hex(v)
|
||||
end
|
||||
end
|
||||
o.pubkey[k] = out
|
||||
end
|
||||
|
||||
o.pubkey = stdnse.output_table()
|
||||
o.pubkey.type = cert.pubkey.type
|
||||
o.pubkey.bits = cert.pubkey.bits
|
||||
o.pubkey.modulus = openssl.bignum_bn2hex(cert.pubkey.modulus)
|
||||
o.pubkey.exponent = openssl.bignum_bn2dec(cert.pubkey.exponent)
|
||||
|
||||
o.extensions = cert.extensions
|
||||
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
|
||||
o.validity[k] = v
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user