aboutsummaryrefslogtreecommitdiffstats
path: root/regress/177-reset-bio.lua
blob: 565a511544bfb1cff04fdf2371b61ad7c4e5f72a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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"