Org.BouncyCastle.Utilities.Properties
Utility methods for managing properties.
Allow Argon2 parameters with a memory size below the minimum of 8 * parallelism KiB that RFC 9106 sec. 3.1
requires.
The maximum permitted memory exponent (i.e. memory <= (1 << MaxMemoryExp).
The maximum Argon2 parallelism (lanes) accepted when a key is derived from untrusted cost parameters.
The maximum number of Argon2 passes (iterations) accepted when a key is derived from untrusted cost
parameters.
Allow CMS key-agreement recipients to retry the key-encryption-key derivation in known non-standard
forms, if the standard derivation fails to unwrap the content-encryption key.
Allow legacy RSA PKCS#1 v1.5 key-transport unwrap in CMS when the content-encryption key has no fixed size.
Allow GOST key AlgorithmIdentifier parameters that do not match the structure required for the key
algorithm, where earlier bc-csharp versions could write them.
The largest SEED, in bytes, accepted in an LMS or HSS private key encoding. Default 1024.
The largest OCSP response, in bytes, to accept from a responder. Default 64KiB.
Upper bound on the PBKDF2 iteration count honoured when decrypting a PBES2-protected PKCS#8/PEM private key.
Upper bound, in bytes, on the scrypt working memory (~128 * N * r) honoured when decrypting a
PBES2-protected PKCS#8 / PEM private key.
When set to true, suppresses the error raised when loading a PKCS12 store with a password, for data
that does not require a password.
If set, a PKCS12 file with a larger iteration count on PBE processing will be rejected. Default 5,000,000.
The PBE iteration count the PKCS12 keystore uses when writing a file - the write-side counterpart of
Pkcs12MaxIterationCount, which only bounds what is accepted on load. Default 300,000 for the
key and certificate encryption, twice that for the integrity MAC.
Upper bound on the RFC 4211 PKMAC / CMP password-based-MAC iteration count honoured when no explicit ceiling
is supplied.
If set to "true", certificate parsers will accept a certificate whose issuer is an empty distinguished
name. RFC 5280 sec. 4.1.2.4 requires the issuer field to contain a non-empty DN and the parser rejects an
empty one by default, but some non-PKIX certificate profiles - notably the libp2p TLS profile, which uses a
self-signed certificate purely as a peer-identity carrier - place no requirements on the issuer and such
certificates are in circulation. This is a read-side concession only: certificate generation still requires
a non-empty issuer unconditionally.
Salvage a non-contiguous iPAddress name-constraint subnet mask instead of rejecting it. An iPAddress
name constraint carries a subnet mask expected to be CIDR (a run of leading 1-bits); a non-contiguous
mask is malformed per RFC 4632 and also lets the subtree set-algebra mint new ranges (a super-linear
blow-up on hostile input). By default such a constraint is rejected (fail-closed). When set, the mask
is instead rounded to the most-restrictive contiguous mask for its context - a permitted subtree is
narrowed (fill up to the last 1-bit; under-permit), an excluded subtree is broadened (keep only the
leading 1-bits; over-exclude) - so validation can only get stricter, never laxer. Strict rejection is
the default; this is a safety valve, not a recommended mode.
Fall back to the legacy lenient parsing of rfc822Name values in X.509 name-constraint checks. By default the
validator is strict about rfc822Name conformance; today that means a tested rfc822Name with more than one
'@' is rejected as ambiguous when email constraints apply (RFC 5321 sec. 4.1.2 allows '@' inside a quoted
local part, so the domain is not simply the text after the first '@', and a wrong split could evade a
constraint). When set, that strictness (and any future rfc822Name conformance strictness) is disabled and
the historical permissive parsing is used instead. Strict is the default; set this only to restore the old
behaviour. This is a safety valve, not a recommended mode.
Upper bound on the total number of nodes the PKIX CertPath builder visits while searching for a chain. The
builder does a depth-first walk up the PKI graph, bounded per path by cycle detection and the caller's
maxPathLength. Because candidate issuers are matched by subject name only, a certificate store containing
many certificates that share a subject name without chaining to a trust anchor can make the search explore a
large number of partial paths before it concludes no chain exists. This bound keeps that work predictable:
the visited-node count is checked on entry to each build step and the build is aborted once it exceeds the
bound.
Upper bound on the total number of valid-policy-tree nodes retained (across all depth levels) during PKIX
CertPath validation. Certificate policy mapping combined with the anyPolicy expansion of RFC 5280
6.1.3/6.1.4 can grow the tree multiplicatively per certificate, so a crafted chain that still chains to a
trust anchor could drive the validator into exponential memory/CPU consumption - a denial of service.
The tree size is checked once per certificate and validation is aborted once it exceeds this bound.
Opt in to the relaxed directoryName name-constraint matching required by GSMA SGP.22 v2.5 (Remote SIM
Provisioning), sections 4.5.2.1.0.2 / 4.5.2.1.0.3. When set, a permitted-subtree RDN is satisfied by any
matching subject RDN regardless of position, additional subject attributes beyond those named in the subtree
are tolerated, and a serialNumber RDN is matched with a StartsWith comparison wherever it appears.
This is deliberately looser than the contiguous-prefix DN matching mandated by RFC 5280 7.1, so it defaults
to off and must be enabled explicitly; BC's default validation remains RFC 5280 strict.
Return the string value of the property name.
Return the string value of the property name, or
defaultValue if that property is not defined.
public static TResult WithThreadProperty<TArg, TResult>(string name, string value, TArg arg, Func<TArg, TResult> func)