fromRandom

fun fromRandom(numBits: Int, random: Random = Crypto.secureRandom): ASN1Integer

Generates a positive ASN1Integer with numBits bits of random.

The generated integer is guaranteed to be positive (greater than zero) and conform to DER encoding rules (e.g. for use as X.509 certificate serial numbers per RFC 5280 section 4.1.2.2).

Return

a positive ASN1Integer

Parameters

numBits

number of bits of random, must be positive and divisible by 8.

random

the Random to use for randomness.