encrypt

fun encrypt(userPassword: String, ownerPassword: String = userPassword, permissions: PdfPermissions = io.github.yuroyami.kitepdf.PdfPermissions.allowAll, encryptMetadata: Boolean = true, random: Random = kotlin.random.Random.Default): PdfBuilder

Encrypt the document with the V5/AES-256 (R6, PDF 2.0) Standard Security Handler. Every string and stream is encrypted; the file opens with either password. permissions maps to the advisory /P flags. random feeds the file key, salts and per-object IVs; seed it for reproducible bytes in tests. Only AES-256 is offered on the create path: there is no reason to mint new documents with weaker legacy schemes.