mirror of
https://github.com/brunoos/luasec.git
synced 2024-11-08 06:28:26 +01:00
feature: getsignaturename
This commit is contained in:
parent
22eadbd20e
commit
de393417b7
16
src/x509.c
16
src/x509.c
@ -652,6 +652,21 @@ static int meth_set_encode(lua_State* L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get signature name.
|
||||
*/
|
||||
static int meth_get_sinagure_name(lua_State* L)
|
||||
{
|
||||
p_x509 px = lsec_checkp_x509(L, 1);
|
||||
int nid = X509_get_signature_nid(px->cert);
|
||||
const char *name = OBJ_nid2sn(nid);
|
||||
if (!name)
|
||||
lua_pushnil(L);
|
||||
else
|
||||
lua_pushstring(L, name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static int load_cert(lua_State* L)
|
||||
@ -680,6 +695,7 @@ static luaL_Reg methods[] = {
|
||||
{"digest", meth_digest},
|
||||
{"setencode", meth_set_encode},
|
||||
{"extensions", meth_extensions},
|
||||
{"getsignaturename", meth_get_sinagure_name},
|
||||
{"issuer", meth_issuer},
|
||||
{"notbefore", meth_notbefore},
|
||||
{"notafter", meth_notafter},
|
||||
|
Loading…
Reference in New Issue
Block a user