From e48a9babbfcf3a481d5a9358c8282c497ab08cf7 Mon Sep 17 00:00:00 2001 From: Wangchong Zhou Date: Mon, 3 Feb 2020 15:35:13 +0800 Subject: src/openssl.c: reset bio pointer before reuse in X509_ANY format --- regress/177-reset-bio.lua | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 regress/177-reset-bio.lua (limited to 'regress/177-reset-bio.lua') diff --git a/regress/177-reset-bio.lua b/regress/177-reset-bio.lua new file mode 100755 index 0000000..565a511 --- /dev/null +++ b/regress/177-reset-bio.lua @@ -0,0 +1,35 @@ +#!/usr/bin/env lua + +local regress = require "regress" + +local ok, err + +local key = regress.pkey.new() + +-- generate a minimal certificate and export to DER +local x509 = regress.x509.new() +x509:setPublicKey(key) +x509:sign(key) +local x509_der = x509:tostring("DER") + +ok, err = pcall(regress.x509.new, x509_der) +regress.check(ok, "failed to load DER certificate: %s", err) + +-- generate a minimal crl and export to DER +local crl = regress.crl.new() +crl:sign(key) +local crl_der = crl:tostring("DER") + +ok, err = pcall(regress.crl.new, crl_der) +regress.check(ok, "failed to load DER CRL: %s", err) + +-- generate a minimal csr and export to DER +local csr = regress.csr.new() +csr:setPublicKey(key) +csr:sign(key) +local csr_der = csr:tostring("DER") + +ok, err = pcall(regress.csr.new, csr_der) +regress.check(ok, "failed to load DER CSR: %s", err) + +regress.say "OK" -- cgit v1.2.3-59-g8ed1b