Open dcrawford1 opened 1 year ago
Just generate a random number and call :setSerial()
?
I think I figured it out:
local bytes = openssl_rand.bytes(20)
crt:setSerial(openssl_bignum.fromBinary(bytes))
Sure that works if you want a byte-sized max for your range.
We should probably add bindings for e.g. openssl_rand.uniform
where if you pass a bignum we use BN_rand
or similar to generate a random number in the whole range?
Is there any way to set a random x509 serial number when creating a x509 self signed certificate? The openssl command line tool calls
BN_rand(btmp, SERIAL_RAND_BITS, BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY))
. Is there any way to do the equivalent with luaossl?