diff options
-rwxr-xr-x | openssl-model.lua | 19 | ||||
-rw-r--r-- | openssl-status-html.lsp | 9 |
2 files changed, 19 insertions, 9 deletions
diff --git a/openssl-model.lua b/openssl-model.lua index c391e5c..c5c5ba8 100755 --- a/openssl-model.lua +++ b/openssl-model.lua @@ -677,37 +677,42 @@ listrevoked = function() end getcrl = function(crltype) - local crlfile = cfe({ type="raw", label="Revoke list", option="application/pkix-crl" }) + local crlfile = cfe({ type="raw", option="application/pkix-crl" }) local cmd = path .. "openssl ca -config "..configfile.." -gencrl -out "..openssldir.."ca-crl.crl" local f = io.popen(cmd) f:close() local cmd = path .. "openssl crl -in "..openssldir.."ca-crl.crl -out "..openssldir.."ca-der-crl.crl -outform DER" local f = io.popen(cmd) f:close() - if string.lower(crltype) == "der" then + if string.lower(crltype or "") == "der" then crlfile.label = "ca-der-crl.crl" crlfile.value = fs.read_file(crlfile.label) or "" - elseif string.lower(crltype) == "pem" then + elseif string.lower(crltype or "") == "pem" then crlfile.label = "ca-crl.crl" crlfile.value = fs.read_file(crlfile.label) or "" else - crlfile.value = fs.read_file("ca-crl.crl") or "" + crlfile.value = fs.read_file("ca-der-crl.crl") or "" end return crlfile end getca = function(certype) + local result = cfe({ type="raw", option="application/x-x509-ca-cert" }) local fname = "cacert." - if string.lower(certype) == "der" then + if string.lower(certype or "") == "der" then local cmd = path .. "openssl x509 -in "..openssldir.."cacert.pem -outform der -out "..openssldir.."cacert.der" local f = io.popen(cmd) f:close() fname = fname.."der" + result.label = fname + elseif string.lower(certype or "") == "pem" then + fname = fname.."pem" + result.label = fname else fname = fname.."pem" end - local fread = fs.read_file(fname) or "" - return cfe({ type="raw", value=fread, label=fname, option="application/x-x509-ca-cert" }) + result.value = fs.read_file(fname) or "" + return result end getnewputca = function() diff --git a/openssl-status-html.lsp b/openssl-status-html.lsp index 739009c..21dffea 100644 --- a/openssl-status-html.lsp +++ b/openssl-status-html.lsp @@ -38,6 +38,11 @@ if view.value.version and view.value.version.errtxt and viewlibrary.check_permis end end end %> -<% if viewlibrary.check_permission("downloadcacert") then %> <H1>Download -CA Cert</H1> <DL> <%= html.link{value="downloadcacert?certype=pem", label="Download PEM"} %><BR><%= html.link{value="downloadcacert?certype=der", label="Download DER"} %><BR> </DL> +<% if viewlibrary.check_permission("downloadcacert") then %> +<H1>Download CA Cert</H1> +<DL> +<%= html.link{value="downloadcacert?certype=pem", label="Download PEM"} %><BR> +<%= html.link{value="downloadcacert?certype=der", label="Download DER"} %><BR> +<%= html.link{value="downloadcacert", label="Import to Firefox"} %><BR> +</DL> <% end %> |