readFullyToAsn1Elements

Reads all available data from the source up to the specified limit and parses it into a list of ASN.1 elements along with the total number of bytes read.

Return

A pair containing a list of parsed ASN.1 elements and the total number of bytes read.

Parameters

limit

The maximum allowed total number of encoded DER bytes to consume. This limit is enforced before reading or peeking from the underlying source.

Throws

if the input does not parse or if it exceeds the specified limit. This includes length encoding indicating a length greater than limit, even if this is malformed and exceeds the number of bytes left in the source.