DerConfiguration

data class DerConfiguration(val encodeDefaults: Boolean = true, val explicitNulls: Boolean = false, val maxInputLength: Long = Int.MAX_VALUE.toLong(), val maxNestingDepth: Int = 128, val serializersModule: SerializersModule = EmptySerializersModule())(source)

DER format options.

Constructors

Link copied to clipboard
constructor(encodeDefaults: Boolean = true, explicitNulls: Boolean = false, maxInputLength: Long = Int.MAX_VALUE.toLong(), maxNestingDepth: Int = 128, serializersModule: SerializersModule = EmptySerializersModule())

Properties

Link copied to clipboard

if true, default-valued properties are encoded. If false, default-valued properties are omitted.

Link copied to clipboard

if true, nullable properties are encoded as ASN.1 NULL by default. If false, nullable null values are omitted by default. exactly as originally decoded.

Link copied to clipboard

maximum allowed total number of encoded DER bytes to consume before refusing to parse and throwing. This limit is enforced before reading or peeking from the underlying source. Defaults to Int.MAX_VALUE so that all element lengths produced under the default fit in Int and parsing / re-encoding stay fully Int-based; raise it only if you deliberately handle multi-gigabyte input (which also requires a Source, since a ByteArray cannot exceed Int.MAX_VALUE bytes anyway).

Link copied to clipboard

maximum structural nesting depth the typed encoder/decoder will descend before throwing a kotlinx.serialization.SerializationException. The raw parser/encoder are iterative and stack-safe, but kotlinx.serialization's encode/decode contract is recursive descent (deserialize ->decodeSerializableElement ->deserialize -> ...; and the mirror on encode), so a self-referential @Serializable type that is deeply nested (decoded from deeply nested input, or serialized from a deeply nested in-memory value) would otherwise overflow the call stack with an unrecoverable StackOverflowError. This guard converts that into a clean, catchable exception. The default (128) is far above any realistic ASN.1/PKI structure (typically < ~40 levels) and below the depth at which the JVM call stack overflows. Lower it on very small thread stacks; raise it only if you knowingly process deeply nested recursive models.

Link copied to clipboard
val serializersModule: SerializersModule

serializers used for contextual/open-polymorphic resolution.