From f5d4e4716d80412408e17ae3e5cdbff996aa00e2 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Mon, 28 May 2018 18:07:33 +1000 Subject: src/openssl.c: Add csr:setRequestedExtension --- src/openssl.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src') diff --git a/src/openssl.c b/src/openssl.c index a7ed9c8..780b75a 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -6793,6 +6793,23 @@ error: } /* xr_getSubjectAlt() */ +static int xr_setRequestedExtension(lua_State *L) { + X509_REQ *csr = checksimple(L, 1, X509_CSR_CLASS); + X509_EXTENSION *ext = checksimple(L, 2, X509_EXT_CLASS); + int nid, crit; + void *value; + + nid = OBJ_obj2nid(X509_EXTENSION_get_object(ext)); + crit = X509_EXTENSION_get_critical(ext); + value = X509_EXTENSION_get_data(ext); + + if (xr_modifyRequestedExtension(csr, nid, crit, value, X509V3_ADD_REPLACE)) + return auxL_error(L, auxL_EOPENSSL, "x509.csr:setRequestedExtension"); + + lua_pushboolean(L, 1); + return 1; +} /* xr_setRequestedExtension() */ + static int xr_sign(lua_State *L) { X509_REQ *csr = checksimple(L, 1, X509_CSR_CLASS); @@ -6853,6 +6870,7 @@ static const auxL_Reg xr_methods[] = { { "setPublicKey", &xr_setPublicKey }, { "getSubjectAlt", &xr_getSubjectAlt }, { "setSubjectAlt", &xr_setSubjectAlt }, + { "setRequestedExtension", &xr_setRequestedExtension }, { "sign", &xr_sign }, { "tostring", &xr__tostring }, { NULL, NULL }, -- cgit v1.2.3-59-g8ed1b