summaryrefslogtreecommitdiffstats
path: root/openssl-model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'openssl-model.lua')
-rwxr-xr-xopenssl-model.lua19
1 files changed, 13 insertions, 6 deletions
diff --git a/openssl-model.lua b/openssl-model.lua
index 9b3a63a..702967f 100755
--- a/openssl-model.lua
+++ b/openssl-model.lua
@@ -696,12 +696,19 @@ getcrl = function(crltype)
return crlfile
end
-getpem = function(pem)
- local f = fs.read_file(pem) or ""
- local fname = string.gsub(pem, ".*/", "")
- if validator.is_valid_filename(pem, openssldir) then
- return cfe({ type="raw", value=f, label=fname, option="application/x-pkcs12" })
- end
+getca = function(certype)
+
+ if certype == "der" then
+ local cmd = path .. "openssl x509 -in "..openssldir.."cacert.pem -outform der -out "..openssldir.."cacert.der"
+ local f = io.popen(cmd)
+ f:close()
+ end
+ local fname = "cacert."..certype
+ local dlcert = openssldir..fname
+ local fread = fs.read_file(dlcert) or ""
+ if validator.is_valid_filename(dlcert, openssldir) then
+ return cfe({ type="raw", value=fread, label=fname, option="application/x-x509-ca-cert" })
+ end
end
getnewputca = function()