toDer

suspend fun toDer(passphrase: String? = null, iterations: Int = DEFAULT_ITERATIONS, random: Random = Crypto.secureRandom): ByteString

Encodes this PKCS#12 container into DER format.

Return

the DER-encoded PKCS#12 file as ByteString.

Parameters

passphrase

the passphrase used to encrypt the private key and certs, and compute the MAC, or null for passwordless protection.

iterations

iteration count for PBKDF2 and MAC derivation (default DEFAULT_ITERATIONS).

random

the Random instance to use for salts and IVs (defaults to Crypto.secureRandom).

Throws

if the key algorithm or curve is not supported.