From d77caf28ae5af5cd4b759d436c4c94870d8d26a3 Mon Sep 17 00:00:00 2001 From: Pascal Fellerich Date: Mon, 3 Apr 2017 14:46:36 +1000 Subject: New: method crl:verify(publickey) added, documentation updated. --- doc/luaossl.tex | 4 ++++ src/openssl.c | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/doc/luaossl.tex b/doc/luaossl.tex index 4f06ecf..0675e62 100644 --- a/doc/luaossl.tex +++ b/doc/luaossl.tex @@ -693,6 +693,10 @@ Returns the integer count of the number of extensions. Signs the instance CRL using the \module{openssl.pkey} $key$. +\subsubsection[\fn{crl:verify}]{\fn{crl:verify($publickey$)}} + +Verifies the instance CRL using a public key. + \subsubsection[\fn{crl:text}]{\fn{crl:text()}} Returns a human-readable textual representation of the instance CRL. diff --git a/src/openssl.c b/src/openssl.c index 5a8e03f..0910bb3 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -6838,6 +6838,19 @@ static int xx_sign(lua_State *L) { } /* xx_sign() */ +static int xx_verify(lua_State *L) { + X509_CRL *crl = checksimple(L, 1, X509_CRL_CLASS); + EVP_PKEY *key = checksimple(L, 2, PKEY_CLASS); + + if (!X509_CRL_verify(crl, key)) + return auxL_error(L, auxL_EOPENSSL, "x509.crl:verify"); + + lua_pushboolean(L, 1); + + return 1; +} /* xx_verify() */ + + static int xx_text(lua_State *L) { X509_CRL *crl = checksimple(L, 1, X509_CRL_CLASS); @@ -6907,6 +6920,7 @@ static const auxL_Reg xx_methods[] = { { "getExtension", &xx_getExtension }, { "getExtensionCount", &xx_getExtensionCount }, { "sign", &xx_sign }, + { "verify", &xx_verify }, { "text", &xx_text }, { "tostring", &xx__tostring }, { NULL, NULL }, -- cgit v1.2.3-59-g8ed1b