diff options
author | daurnimator <quae@daurnimator.com> | 2018-05-28 18:07:33 +1000 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2018-05-28 18:07:33 +1000 |
commit | f5d4e4716d80412408e17ae3e5cdbff996aa00e2 (patch) | |
tree | e6c5082f1cf8e305fa2aaf43cbef452638bb6c6a | |
parent | 2bbe04763c9afeb06cc76157b0117d672059e5e6 (diff) | |
download | luaossl-f5d4e4716d80412408e17ae3e5cdbff996aa00e2.tar.gz luaossl-f5d4e4716d80412408e17ae3e5cdbff996aa00e2.tar.bz2 luaossl-f5d4e4716d80412408e17ae3e5cdbff996aa00e2.zip |
src/openssl.c: Add csr:setRequestedExtension
-rw-r--r-- | src/openssl.c | 18 |
1 files changed, 18 insertions, 0 deletions
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 }, |