Class Properties
- java.lang.Object
-
- org.bouncycastle.util.Properties
-
public class Properties extends java.lang.ObjectUtility method for accessing properties values - properties can be set in java.security, thread local, and system properties. They are checked for in the same order with checking stopped as soon as a value is found.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringASN1_ALLOW_NON_DER_TIMEControls whether an ASN.1UTCTime/GeneralizedTimecarrying non-DER contents may be serialized through aDEROutputStream.static java.lang.StringASN1_ALLOW_ZONELESS_UTCTIMEDecode the zone-less ASN.1UTCTime"YYMMDDHHMMSS".static java.lang.StringASN1_MAX_CONS_DEPTHMaximum depth of nested constructed ASN.1 objects the parser will descend before failing with "maximum nested construction level reached", guarding against stack exhaustion from deeply nested crafted input.static java.lang.StringASN1_MAX_LIMITOverrides the maximum length accepted for a single definite-length ASN.1 object read from a stream whose length is not otherwise known.static java.lang.StringBCFKS_MAX_IT_COUNTUpper bound on the PBKDF2 iteration count honoured when deriving the integrity-MAC key of a BCFKS keystore during load.static java.lang.StringBCFKS_MAX_SCRYPT_MEMORYUpper bound, in bytes, on the working memory (~128 * N * r) of the scrypt KDF honoured when deriving the integrity-MAC key of a BCFKS keystore during load.static java.lang.StringBCFKS_STORE_IT_COUNTThe PBKDF2 iteration count the BCFKS keystore uses when writing a file through the plainKeyStore.store(OutputStream, char[])path - the write-side counterpart ofBCFKS_MAX_IT_COUNT, which only bounds what is accepted on load, and the BCFKS analogue ofPKCS12_STORE_IT_COUNT.static java.lang.StringBKS_ENABLE_V1Opt in to handling legacy version 0/1 BKS keystores.static java.lang.StringBKS_MAX_IT_COUNTUpper bound on the PKCS#12-PBE iteration count honoured when loading a BKS keystore.static java.lang.StringDH_MAX_SIZEUpper bound (in bits) on the prime modulus p accepted when validating an imported Diffie-Hellman public key.static java.lang.StringDRBG_EFFECTIVE_256BITS_ENTROPYEffective bits-of-entropy assumed per real bit when the BC DRBG provider seeds for a 256-bit security level — used to compute the byte-oriented samples requested from the underlying entropy source.static java.lang.StringDRBG_ENTROPY_SOURCEFully-qualified name of anEntropySourceProviderclass to use as the BC DRBG provider's seed source.static java.lang.StringDRBG_ENTROPY_THREADIf set to "true", the BC DRBG provider runs a background thread that samples the platform entropy source on a fixed schedule and feeds the DRBG, rather than blocking on a fresh sample at each reseed.static java.lang.StringDRBG_GATHER_PAUSE_SECSPause, in seconds, between background entropy-thread samples (seeDRBG_ENTROPY_THREAD).static java.lang.StringDSA_MAX_SIZEUpper bound (in bits) on the prime modulus p accepted when validating an imported DSA public key.static java.lang.StringEC_MAX_F2M_FIELD_SIZEUpper bound on the field size m accepted when building a characteristic-2 (F2m) elliptic curve.static java.lang.StringEMULATE_ORACLEIf set the provider will attempt, where possible, to behave the same way as the oracle one.static java.lang.StringGCM_ALLOW_SHORT_TAGSOpt in to short AEAD authentication tags for AES-GCM parameters.static java.lang.StringJSSE_HOSTNAME_CHECK_CN_FALLBACKOpt-in to the legacy "use the subject CN as a fallback identifier" behaviour in the BC JSSE provider's hostname verifier.static java.lang.StringMIME_MAX_DEPTHMaximum depth of nestedmultipart/*content the S/MIME canonicalisers will descend before failing, the MIME analogue ofASN1_MAX_CONS_DEPTH.static java.lang.StringOCSP_MAX_RESPONSE_SIZEThe largest OCSP response, in bytes, the CertPath validator - or the JSSE server's OCSP stapling fetch - will read from a responder.static java.lang.StringOPENPGP_MAX_ARMOR_HEADER_LENGTHThe longest OpenPGP ASCII armor header line, in bytes, ArmoredInputStream will accumulate.static java.lang.StringOPENPGP_MAX_ARMOR_HEADERSThe largest number of OpenPGP ASCII armor header lines ArmoredInputStream will accept before the blank line that ends the header block.static java.lang.StringOPENSSH_MAX_ROUNDSUpper bound on the bcrypt round count honoured when decrypting an encrypted OpenSSH v1 private key.static java.lang.StringPBE_MAX_ITERATION_COUNTUpper bound on the PBKDF2 iteration count honoured when BC takes that count from an untrusted encoding: decrypting a PBES2-protected PKCS#8 / PEM private key or PKCS#12 bag, verifying an RFC 9579 PBMAC1, unwrapping a CMS password recipient, and the raw JCA PBKDF2 provider (both theSecretKeyFactoryderivation and theAlgorithmParametersparse aCipherperforms for PBES2).static java.lang.StringPBE_MAX_SCRYPT_MEMORYUpper bound, in bytes, on the scrypt working memory (~128 * N * r) honoured when decrypting a PBES2-protected PKCS#8 / PEM private key.static java.lang.StringPKCS1_STRICT_DIGESTINFOIf set to "true", RSA PKCS#1 v1.5 signature verification rejects DigestInfo encodings whose AlgorithmIdentifier omits theNULLparameters octets required by RFC 8017 sec. 9.2 / Appendix A.2.4.static java.lang.StringPKCS12_ALLOW_SUN_SECRET_KEYSIf set to "true", the BC PKCS#12 KeyStore will additionally accept (on load only) SafeBags of type secretBag that use SunJCE's non-standard nested encoding — a SecretBag whose secretTypeId is pkcs8ShroudedKeyBag and whose secretValue is an EncryptedPrivateKeyInfo wrapping a PKCS#8 PrivateKeyInfo carrying the raw secret-key bytes.static java.lang.StringPKCS12_IGNORE_USELESS_PASSWDA PKCS12 file which does not require a password will normally throw an exception if a password is provided.static java.lang.StringPKCS12_MAX_IT_COUNTIf set, a PKCS12 file with a larger iteration count on PBE processing will rejected.static java.lang.StringPKCS12_STORE_IT_COUNTThe PBE iteration count the PKCS12 keystore uses when writing a file - the write-side counterpart ofPKCS12_MAX_IT_COUNT, which only bounds what is accepted on load.static java.lang.StringPKMAC_MAX_ITERATION_COUNTUpper bound on the RFC 4211 PKMAC / CMP password-based-MAC iteration count honoured when no explicit ceiling was supplied toorg.bouncycastle.cert.crmf.PKMACBuilder.static java.lang.StringX509_ALLOW_EMPTY_ISSUER_CERTIf set to "true", the certificate parser (TBSCertificate and everything built on it, such as the X.509 CertificateFactory) will accept a certificate whose issuer is an empty distinguished name.static java.lang.StringX509_ALLOW_LENIENT_RFC822_NAMEFall back to the legacy lenient parsing of rfc822Name values in X.509 name-constraint checks.static java.lang.StringX509_CRL_CACHE_TTLMaximum time, in seconds, that a downloaded CRL is cached by the internal CrlCache used by the CertPath validator and X509RevocationChecker.static java.lang.StringX509_CRLDP_PROTOCOLSOptional comma separated list of the protocols a CRL Distribution Point may name, applied by the internal CrlCache used by the CertPath validator and X509RevocationChecker before any connection is opened.static java.lang.StringX509_ENABLE_CRLDPIf set to "true", the BC CertPath validator and X509RevocationChecker will attempt to download CRLs over the network using URIs from each certificate's CRL Distribution Points extension when no PKIXCRLStore on the supplied PKIXParameters can satisfy the lookup.static java.lang.StringX509_MAX_CERT_PATH_BUILD_NODESUpper bound on the total number of nodes the PKIX certification-path builder visits while searching for a chain.static java.lang.StringX509_MAX_POLICY_NODESUpper bound on the total number of valid-policy-tree nodes retained (across all depth levels) during PKIX certification-path validation.static java.lang.StringX509_SGP22_NAME_CONSTRAINTSOpt 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.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.math.BigIntegerasBigInteger(java.lang.String propertyName)Return propertyName as a BigInteger.static intasInteger(java.lang.String propertyName, int defaultValue)Return propertyName as an integer, defaultValue used if not defined.static java.util.Set<java.lang.String>asKeySet(java.lang.String propertyName)static java.lang.StringgetPropertyValue(java.lang.String propertyName)Return the String value of the property propertyName.static java.lang.StringgetPropertyValue(java.lang.String propertyName, java.lang.String defValue)static booleanisOverrideSet(java.lang.String propertyName)Return whether a particular override has been set to true.static booleanisOverrideSet(java.lang.String propertyName, boolean defIsTrue)Return whether a particular override has been set to true.static booleanisOverrideSetTo(java.lang.String propertyName, boolean isTrue)Return whether a particular override has been set to false.static booleanremoveThreadOverride(java.lang.String propertyName)Remove any value for the specified override property for the current thread only.static booleansetThreadOverride(java.lang.String propertyName, boolean enable)Enable the specified override property for the current thread only.
-
-
-
Field Detail
-
EMULATE_ORACLE
public static final java.lang.String EMULATE_ORACLE
If set the provider will attempt, where possible, to behave the same way as the oracle one.- See Also:
- Constant Field Values
-
PKCS12_IGNORE_USELESS_PASSWD
public static final java.lang.String PKCS12_IGNORE_USELESS_PASSWD
A PKCS12 file which does not require a password will normally throw an exception if a password is provided. Setting PKCS12_IGNORE_USELESS_PASSWD to "true" will result in the provider ignoring a password if one is provided and not required.- See Also:
- Constant Field Values
-
PKCS12_MAX_IT_COUNT
public static final java.lang.String PKCS12_MAX_IT_COUNT
If set, a PKCS12 file with a larger iteration count on PBE processing will rejected.- See Also:
- Constant Field Values
-
PKCS12_STORE_IT_COUNT
public static final java.lang.String PKCS12_STORE_IT_COUNT
The PBE iteration count the PKCS12 keystore uses when writing a file - the write-side counterpart ofPKCS12_MAX_IT_COUNT, which only bounds what is accepted on load. Default 600,000 for the key and certificate encryption, twice that for the integrity MAC.Lowering this trades password-cracking resistance for store/load time, and is only worth doing where something other than the passphrase carries the confidentiality of the file - a machine-generated high-entropy password, or a keystore held somewhere already protected. It is deliberately an operator decision rather than a per-call one: a deployment that wants cheaper files sets it once at startup for the whole JVM.
A value outside 1 .. 2,500,000 is ignored and the default used, so a mistyped property fails towards the default rather than towards a file with no PBE work in it; the upper bound keeps the doubled MAC count inside the 5,000,000 that
PKCS12_MAX_IT_COUNTdefaults to, so a file written under this property can always be read back. Read viaasInteger(String, int).- See Also:
- Constant Field Values
-
X509_CRL_CACHE_TTL
public static final java.lang.String X509_CRL_CACHE_TTL
Maximum time, in seconds, that a downloaded CRL is cached by the internal CrlCache used by the CertPath validator and X509RevocationChecker. When set to a positive value, cached entries are evicted whichever expires sooner: the configured TTL or the CRL's ownnextUpdate. Default (or 0) preserves the legacy behaviour of evicting only whennextUpdatehas passed.- See Also:
- Constant Field Values
-
X509_ENABLE_CRLDP
public static final java.lang.String X509_ENABLE_CRLDP
If set to "true", the BC CertPath validator and X509RevocationChecker will attempt to download CRLs over the network using URIs from each certificate's CRL Distribution Points extension when no PKIXCRLStore on the supplied PKIXParameters can satisfy the lookup. Default (unset / "false") preserves the legacy behaviour of relying entirely on caller-supplied CertStore / PKIXCRLStore registrations — "No CRLs found for issuer ..." is the result when the caller hasn't registered a store and this property is off.- See Also:
- Constant Field Values
-
X509_CRLDP_PROTOCOLS
public static final java.lang.String X509_CRLDP_PROTOCOLS
Optional comma separated list of the protocols a CRL Distribution Point may name, applied by the internal CrlCache used by the CertPath validator and X509RevocationChecker before any connection is opened. Protocol names are matched without regard to case, so "http,https,ldap" refuses a distribution point naming ftp, file, jar or anything else the JVM happens to have a URL handler for. Default (unset or empty) leaves the protocol unrestricted: RFC 5280 sec. 4.2.1.13 requires a distribution point URI to name a protocol but does not limit which, and BC supports http, https, ftp and ldap here, so this is an operator policy for deployments that want a narrower set rather than a default.Note the CRL fetch this governs only happens at all when
X509_ENABLE_CRLDPis set.- See Also:
- Constant Field Values
-
OCSP_MAX_RESPONSE_SIZE
public static final java.lang.String OCSP_MAX_RESPONSE_SIZE
The largest OCSP response, in bytes, the CertPath validator - or the JSSE server's OCSP stapling fetch - will read from a responder. A responder's Content-Length can narrow this but never widen it, so a responder declaring (and sending) hundreds of megabytes is cut off rather than read into the heap. Default is 64K, which is far above any real response; a value of zero or less is ignored and the default used, so a mistyped value cannot turn the limit off. Exceeding the limit fails the OCSP check the same way an unreachable responder does, so a caller with CRLs configured falls back to those.- See Also:
- Constant Field Values
-
OPENPGP_MAX_ARMOR_HEADER_LENGTH
public static final java.lang.String OPENPGP_MAX_ARMOR_HEADER_LENGTH
The longest OpenPGP ASCII armor header line, in bytes, ArmoredInputStream will accumulate. The headers are parsed when the stream is constructed, so this bounds what merely wrapping an untrusted stream can allocate: a "header line" that never reaches a line terminator is refused rather than read until the heap is gone. Default is 4096, far above the short Version / Comment lines RFC 9580 sec. 6.2 describes; a value of zero or less is ignored and the default used.- See Also:
- Constant Field Values
-
OPENPGP_MAX_ARMOR_HEADERS
public static final java.lang.String OPENPGP_MAX_ARMOR_HEADERS
The largest number of OpenPGP ASCII armor header lines ArmoredInputStream will accept before the blank line that ends the header block. Bounds the companion case toOPENPGP_MAX_ARMOR_HEADER_LENGTH, where each line is short but they never stop arriving. Default is 64, counting the armor header line itself; a value of zero or less is ignored and the default used.- See Also:
- Constant Field Values
-
PKCS12_ALLOW_SUN_SECRET_KEYS
public static final java.lang.String PKCS12_ALLOW_SUN_SECRET_KEYS
If set to "true", the BC PKCS#12 KeyStore will additionally accept (on load only) SafeBags of type secretBag that use SunJCE's non-standard nested encoding — a SecretBag whose secretTypeId is pkcs8ShroudedKeyBag and whose secretValue is an EncryptedPrivateKeyInfo wrapping a PKCS#8 PrivateKeyInfo carrying the raw secret-key bytes. Off by default; the BC keystore always writes the standards compliant RFC 7292 sec. 4.2.5 form regardless.- See Also:
- Constant Field Values
-
PKCS1_STRICT_DIGESTINFO
public static final java.lang.String PKCS1_STRICT_DIGESTINFO
If set to "true", RSA PKCS#1 v1.5 signature verification rejects DigestInfo encodings whose AlgorithmIdentifier omits theNULLparameters octets required by RFC 8017 sec. 9.2 / Appendix A.2.4. By default (or "false") the verifier falls back to accepting that two-byte-shorter encoding for compatibility with implementations that have historically produced it; setting this property to "true" disables the fallback so only strictly RFC-compliant signatures verify (github #2273). Affects both the BC JCE provider'sDigestSignatureSpiand the lightweightRSADigestSigner.- See Also:
- Constant Field Values
-
JSSE_HOSTNAME_CHECK_CN_FALLBACK
public static final java.lang.String JSSE_HOSTNAME_CHECK_CN_FALLBACK
Opt-in to the legacy "use the subject CN as a fallback identifier" behaviour in the BC JSSE provider's hostname verifier. When the property is set to "true", a TLS server certificate that carries no SAN dNSName entries falls back to the most specificcommonNameattribute of the subject DN — this matches SunJSSE and historical OpenSSL behaviour.Default ("false" / unset) follows RFC 9525 sec. 6.3 (which deprecates CN-based identity for TLS) and CAB Forum Baseline Requirements 7.1.4.2 (which requires SAN dNSName entries for publicly-trusted TLS server certs). It also closes a Name-Constraint bypass surface (the 2026-03 cross-implementation X.509 audit): a constrained intermediate CA can omit dNSName SAN entries entirely so the path validator's Name-Constraint dNSName checks never fire, then embed an attacker-controlled hostname in CN — the JSSE verifier would have accepted the connection. Setting the property "false" (or leaving it unset) disables this fallback path and the JSSE verifier rejects any cert that doesn't carry a matching SAN identifier.
- See Also:
- Constant Field Values
-
DRBG_EFFECTIVE_256BITS_ENTROPY
public static final java.lang.String DRBG_EFFECTIVE_256BITS_ENTROPY
Effective bits-of-entropy assumed per real bit when the BC DRBG provider seeds for a 256-bit security level — used to compute the byte-oriented samples requested from the underlying entropy source. Defaults to 282 bits (about 0.9 effective bits per raw bit) and is rounded up to the next whole byte.- See Also:
- Constant Field Values
-
DRBG_ENTROPY_SOURCE
public static final java.lang.String DRBG_ENTROPY_SOURCE
Fully-qualified name of anEntropySourceProviderclass to use as the BC DRBG provider's seed source. When set, the named class is loaded reflectively and instantiated in place of the platform default. When unset, the BC DRBG falls back to the configuredsecurerandom.sourceor its own background entropy thread.- See Also:
- Constant Field Values
-
DRBG_ENTROPY_THREAD
public static final java.lang.String DRBG_ENTROPY_THREAD
If set to "true", the BC DRBG provider runs a background thread that samples the platform entropy source on a fixed schedule and feeds the DRBG, rather than blocking on a fresh sample at each reseed.- See Also:
- Constant Field Values
-
DRBG_GATHER_PAUSE_SECS
public static final java.lang.String DRBG_GATHER_PAUSE_SECS
Pause, in seconds, between background entropy-thread samples (seeDRBG_ENTROPY_THREAD). Parsed as an integer; absent or non-positive values use the implementation default.- See Also:
- Constant Field Values
-
ASN1_ALLOW_NON_DER_TIME
public static final java.lang.String ASN1_ALLOW_NON_DER_TIME
Controls whether an ASN.1UTCTime/GeneralizedTimecarrying non-DER contents may be serialized through aDEROutputStream. Reading is always lenient: a wire value that is valid ASN.1 but not valid DER - for example a UTCTime without the seconds element ("YYMMDDHHMMZ"), a time terminated with a "+hhmm"/"-hhmm" offset rather than "Z", or a GeneralizedTime fraction carrying trailing zeros - parses without complaint into a usableASN1UTCTime/ASN1GeneralizedTime.Default (unset or "true") preserves BC's historical pass-through: such a primitive may be re-emitted unchanged via either BER or DER. Setting this property to "false" enforces the DER restrictions of X.690 sec. 11.7 / 11.8 (and hence the RFC 5280 sec. 4.1.2.5 profile, which requires seconds and Zulu) on the DER write side: the primitive's
toDERObject()throws anIllegalStateExceptionif it would emit non-conformant content, so any attempt to write it to aDEROutputStreamfails (github #1973 / #1986). BER serialization is unaffected. Programmatically constructing a time from aDatealways produces DER content, so this setting only matters for primitives whose contents arrived non-conformant from the wire."Lenient" here means legal-but-non-DER formatting. Structurally malformed content is a separate matter, rejected on read since 1.85 - see
ASN1_ALLOW_ZONELESS_UTCTIME, which makes an exception of exactly one such value.- See Also:
- Constant Field Values
-
ASN1_ALLOW_ZONELESS_UTCTIME
public static final java.lang.String ASN1_ALLOW_ZONELESS_UTCTIME
Decode the zone-less ASN.1UTCTime"YYMMDDHHMMSS".X.680 sec. 47.3 makes the zone mandatory for a UTCTime, so a twelve-digit value carrying none is not a legal one and, since 1.85, the decoder rejects it along with the rest of the structurally malformed time content it screens out - non-digit or out-of-range fields, an illegal length, a missing or garbage zone terminator - with "invalid UTCTime format". That is raised while the enclosing structure is being read, so a single such field fails the whole parse: a CMS SignedData whose signing-time attribute lacks its trailing "Z" cannot be loaded at all, let alone have the rest of its content examined (github #2411).
That one value is nonetheless readable -
ASN1UTCTime.getTime()has always carried an explicit branch taking a zone-less value as GMT, so it denotes a real instant, and it re-encodes unchanged - and it is produced by tools in the field. Setting this property admits it, and admits nothing else: every other malformed value is still rejected with the property set, and the zone-less"YYMMDDHHMM"(no seconds) is not admitted either,getTime()having never been able to read one.GeneralizedTimeis unaffected, its zone being optional to begin with.The property has to be set for the value to decode: the default is to reject it. Generation is unaffected, as is DER conformance - the value is still not DER, so writing it through a
DEROutputStreamis refused whenASN1_ALLOW_NON_DER_TIMEis "false". This property is independent of that one, which governs writing rather than reading. Read viaisOverrideSet(String).- See Also:
- Constant Field Values
-
ASN1_MAX_CONS_DEPTH
public static final java.lang.String ASN1_MAX_CONS_DEPTH
Maximum depth of nested constructed ASN.1 objects the parser will descend before failing with "maximum nested construction level reached", guarding against stack exhaustion from deeply nested crafted input. Read as an integer; default 64.- See Also:
- Constant Field Values
-
ASN1_MAX_LIMIT
public static final java.lang.String ASN1_MAX_LIMIT
Overrides the maximum length accepted for a single definite-length ASN.1 object read from a stream whose length is not otherwise known. The value is a byte count and may carry a trailing 'k', 'm' or 'g' multiplier (e.g. "16m"); when unset the limit falls back to the available heap size. Can also be set per stream via the ASN1InputStream(InputStream, int) constructor.- See Also:
- Constant Field Values
-
DH_MAX_SIZE
public static final java.lang.String DH_MAX_SIZE
Upper bound (in bits) on the prime modulus p accepted when validating an imported Diffie-Hellman public key. Validation performs a modular exponentiation / Legendre computation whose cost is super-linear in the size of p, so an unbounded p taken from a crafted key encoding would turn key import into a CPU-exhaustion denial of service. The default (16384) is the analogue oforg.bouncycastle.rsa.max_sizeand is well above any standardised DH group. Read viaasInteger(String, int).- See Also:
- Constant Field Values
-
DSA_MAX_SIZE
public static final java.lang.String DSA_MAX_SIZE
Upper bound (in bits) on the prime modulus p accepted when validating an imported DSA public key. As withDH_MAX_SIZE, validation runs a modular exponentiation whose cost grows super-linearly in the size of p, so an unbounded p from a crafted encoding is an import-time CPU-exhaustion vector. Default 16384. Read viaasInteger(String, int).- See Also:
- Constant Field Values
-
BCFKS_MAX_IT_COUNT
public static final java.lang.String BCFKS_MAX_IT_COUNT
Upper bound on the PBKDF2 iteration count honoured when deriving the integrity-MAC key of a BCFKS keystore during load. The KDF runs on parameters taken from the (not-yet-verified) keystore, so an unbounded iteration count is a pre-integrity CPU-exhaustion vector. Default 5,000,000 (the BCFKS writer uses ~51,200). Read viaasInteger(String, int).- See Also:
- Constant Field Values
-
BCFKS_MAX_SCRYPT_MEMORY
public static final java.lang.String BCFKS_MAX_SCRYPT_MEMORY
Upper bound, in bytes, on the working memory (~128 * N * r) of the scrypt KDF honoured when deriving the integrity-MAC key of a BCFKS keystore during load. As withBCFKS_MAX_IT_COUNTthe scrypt cost parameters are taken from the not-yet-verified keystore, so an unbounded cost is a pre-integrity memory-exhaustion vector. Default 1073741824 (1 GiB); the BCFKS writer uses N=16384, r=8 (~16 MiB). Read viaasInteger(String, int).- See Also:
- Constant Field Values
-
BCFKS_STORE_IT_COUNT
public static final java.lang.String BCFKS_STORE_IT_COUNT
The PBKDF2 iteration count the BCFKS keystore uses when writing a file through the plainKeyStore.store(OutputStream, char[])path - the write-side counterpart ofBCFKS_MAX_IT_COUNT, which only bounds what is accepted on load, and the BCFKS analogue ofPKCS12_STORE_IT_COUNT. Default 51,200 (PBKDF2-HMAC-SHA512), applied to the integrity MAC key and to the key-encryption keys of the entries. A caller supplying aBCFKSLoadStoreParameterwith its ownPBKDFConfigis unaffected.Lowering this trades password-cracking resistance for store/load time, and is only worth doing where something other than the passphrase carries the confidentiality of the file. A value outside 1 .. 5,000,000 is ignored and the default used, so a mistyped property fails towards the default rather than towards a file with no PBE work in it; the upper bound is the
BCFKS_MAX_IT_COUNTdefault, so a file written under this property can always be read back. Read viaasInteger(String, int).- See Also:
- Constant Field Values
-
PBE_MAX_ITERATION_COUNT
public static final java.lang.String PBE_MAX_ITERATION_COUNT
Upper bound on the PBKDF2 iteration count honoured when BC takes that count from an untrusted encoding: decrypting a PBES2-protected PKCS#8 / PEM private key or PKCS#12 bag, verifying an RFC 9579 PBMAC1, unwrapping a CMS password recipient, and the raw JCA PBKDF2 provider (both theSecretKeyFactoryderivation and theAlgorithmParametersparse aCipherperforms for PBES2). In each case the key-derivation parameters travel inside an unauthenticated container, so an unbounded count makes processing attacker-supplied material a CPU-exhaustion vector. Default 10,000,000 - the count RFC 8018 sec. 4.2 names as possibly appropriate for especially critical keys, so generous enough for deliberately strong settings. Read viaasInteger(String, int).- See Also:
- Constant Field Values
-
PBE_MAX_SCRYPT_MEMORY
public static final java.lang.String PBE_MAX_SCRYPT_MEMORY
Upper bound, in bytes, on the scrypt working memory (~128 * N * r) honoured when decrypting a PBES2-protected PKCS#8 / PEM private key. As withPBE_MAX_ITERATION_COUNTthe scrypt cost travels in the unauthenticated container, so an unbounded cost is a memory-exhaustion vector. Default 1073741824 (1 GiB). Read viaasInteger(String, int).- See Also:
- Constant Field Values
-
PKMAC_MAX_ITERATION_COUNT
public static final java.lang.String PKMAC_MAX_ITERATION_COUNT
Upper bound on the RFC 4211 PKMAC / CMP password-based-MAC iteration count honoured when no explicit ceiling was supplied toorg.bouncycastle.cert.crmf.PKMACBuilder. The count travels in the (unauthenticated) PBMParameter of an incoming CMP message and drives an iterated hash, so an unbounded count makes verifying an attacker-supplied message a CPU-exhaustion vector. Default 10,000,000, generous enough for any legitimate setting. Read viaasInteger(String, int).- See Also:
- Constant Field Values
-
X509_MAX_POLICY_NODES
public static final java.lang.String X509_MAX_POLICY_NODES
Upper bound on the total number of valid-policy-tree nodes retained (across all depth levels) during PKIX certification-path 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 of the class of CVE-2023-0464. The tree size is checked once per certificate and validation is aborted with a CertPathValidatorException once it exceeds this bound. The default (8192) is far above any legitimate policy tree (a real chain produces a handful of nodes) and is configurable for unusual deployments. Read viaasInteger(String, int).- See Also:
- Constant Field Values
-
X509_MAX_CERT_PATH_BUILD_NODES
public static final java.lang.String X509_MAX_CERT_PATH_BUILD_NODES
Upper bound on the total number of nodes the PKIX certification-path 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 with a CertPathBuilderException once it exceeds the bound. This is a hardening measure and the builder-side companion toX509_MAX_POLICY_NODES. The default (262144) is far above any legitimate build (a real build returns on the first path that chains to an anchor) and is configurable for unusual cross-certified meshes. Read viaasInteger(String, int).- See Also:
- Constant Field Values
-
X509_SGP22_NAME_CONSTRAINTS
public static final java.lang.String X509_SGP22_NAME_CONSTRAINTS
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. See github #2327. Read viaisOverrideSet(String).- See Also:
- Constant Field Values
-
X509_ALLOW_LENIENT_RFC822_NAME
public static final java.lang.String X509_ALLOW_LENIENT_RFC822_NAME
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 this property is 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. Read viaisOverrideSet(String).- See Also:
- Constant Field Values
-
X509_ALLOW_EMPTY_ISSUER_CERT
public static final java.lang.String X509_ALLOW_EMPTY_ISSUER_CERT
If set to "true", the certificate parser (TBSCertificate and everything built on it, such as the X.509 CertificateFactory) 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, and X509CertificateReviewer reports the empty issuer whether or not the property is set. Read viaisOverrideSet(String).- See Also:
- Constant Field Values
-
GCM_ALLOW_SHORT_TAGS
public static final java.lang.String GCM_ALLOW_SHORT_TAGS
Opt in to short AEAD authentication tags for AES-GCM parameters. RFC 5084 constrains the AES-GCM ICV (tag) length carried inGCMParametersto 12..16 octets (96..128 bits), and BC enforces that by default. When this property is set,GCMParametersadditionally accepts tags down to the NIST SP 800-38D minimum of 4 octets (32 bits; SP 800-38D sec. 5.2.1.2 permits a 32-bit tag for limited applications). Short tags weaken integrity protection, so this defaults to off and must be enabled explicitly; anything below 4 octets or above 16 octets is still rejected. Read viaisOverrideSet(String).- See Also:
- Constant Field Values
-
BKS_ENABLE_V1
public static final java.lang.String BKS_ENABLE_V1
Opt in to handling legacy version 0/1 BKS keystores. Those stores derive the HMAC integrity key at only the digest size in bits (a 16-bit key for SHA-1; CVE-2018-5382), which is brute-forceable offline, so by default the defaultBKSkeystore type refuses to load them and only writes the current version 2 format. Set this property to read or create the weak legacy format (e.g. to migrate an old store); it also gates registration of the separateBKS-V1keystore type. Read viaisOverrideSet(String).- See Also:
- Constant Field Values
-
BKS_MAX_IT_COUNT
public static final java.lang.String BKS_MAX_IT_COUNT
Upper bound on the PKCS#12-PBE iteration count honoured when loading a BKS keystore. The count drives the integrity-MAC key derivation inBcKeyStoreSpi.engineLoad(and the per-entry sealed-key decryption), and is read from the (not-yet-verified) keystore ahead of the HMAC integrity check, so an unbounded value is a pre-integrity CPU-exhaustion vector - the analogue ofBCFKS_MAX_IT_COUNT/PKCS12_MAX_IT_COUNTfor the BKS format (the sibling UBER store already caps its own count). Default 1048576 (1 << 20); the BKS writer uses ~1024-2047. Read viaasInteger(String, int).- See Also:
- Constant Field Values
-
OPENSSH_MAX_ROUNDS
public static final java.lang.String OPENSSH_MAX_ROUNDS
Upper bound on the bcrypt round count honoured when decrypting an encrypted OpenSSH v1 private key. The count is read from the key's kdfoptions, which arrive unauthenticated, and drives the KDF before anything about the key has been verified, so an unbounded value is a pre-integrity CPU-exhaustion vector - the OpenSSH analogue ofBCFKS_MAX_IT_COUNT/PKCS12_MAX_IT_COUNT. A round costs several milliseconds, so the 2^31-1 the wire format allows is worth CPU-months from a key file of a few hundred bytes. Reached only when a passphrase is supplied, i.e. on the key-import path. Default 1048576 (1 << 20); ssh-keygen defaults to 16 and its -a option is rarely taken far beyond a few hundred. Read viaasInteger(String, int).- See Also:
- Constant Field Values
-
EC_MAX_F2M_FIELD_SIZE
public static final java.lang.String EC_MAX_F2M_FIELD_SIZE
Upper bound on the field size m accepted when building a characteristic-2 (F2m) elliptic curve. The field polynomial is evaluated when the curve is constructed, and the cost grows with m, so an unbounded value taken from a certificate's or key's explicit EC parameters is an import-time CPU-exhaustion vector (CVE-2024-29857). Default 1142 (twice the 571 of the largest standardised binary curve, B-571/K-571); a larger m is rejected with anIllegalArgumentException. Read viaasInteger(String, int).- See Also:
- Constant Field Values
-
MIME_MAX_DEPTH
public static final java.lang.String MIME_MAX_DEPTH
Maximum depth of nestedmultipart/*content the S/MIME canonicalisers will descend before failing, the MIME analogue ofASN1_MAX_CONS_DEPTH. Each level of nesting in the signed half of an inboundmultipart/signedcosts a stack frame inSMIMEUtil.outputBodyPartplus the frames JavaMail spends resolving the part, so an unbounded depth turns a few hundred KB of crafted mail into aStackOverflowError. RFC 8551 sec. 3.1 requires an agent to receive nested S/MIME but does not require unbounded depth. Default 64; real mail nests two or three deep. Read viaasInteger(String, int).- See Also:
- Constant Field Values
-
-
Method Detail
-
isOverrideSet
public static boolean isOverrideSet(java.lang.String propertyName)
Return whether a particular override has been set to true.- Parameters:
propertyName- the property name for the override.- Returns:
- true if the property is set to "true", false otherwise.
-
isOverrideSet
public static boolean isOverrideSet(java.lang.String propertyName, boolean defIsTrue)Return whether a particular override has been set to true.- Parameters:
propertyName- the property name for the override.- Returns:
- true if the property is set to "true", false otherwise.
-
isOverrideSetTo
public static boolean isOverrideSetTo(java.lang.String propertyName, boolean isTrue)Return whether a particular override has been set to false.- Parameters:
propertyName- the property name for the override.isTrue- true if the override should be true, false otherwise.- Returns:
- true if the property is set to the value of isTrue, false otherwise.
-
setThreadOverride
public static boolean setThreadOverride(java.lang.String propertyName, boolean enable)Enable the specified override property for the current thread only.- Parameters:
propertyName- the property name for the override.enable- true if the override should be enabled, false if it should be disabled.- Returns:
- true if the override was already set true, false otherwise.
-
removeThreadOverride
public static boolean removeThreadOverride(java.lang.String propertyName)
Remove any value for the specified override property for the current thread only.- Parameters:
propertyName- the property name for the override.- Returns:
- true if the override was already set true in thread local, false otherwise.
-
asInteger
public static int asInteger(java.lang.String propertyName, int defaultValue)Return propertyName as an integer, defaultValue used if not defined.- Parameters:
propertyName- name of property.defaultValue- integer to return if property not defined.- Returns:
- value of property, or default if not found, as an int.
-
asBigInteger
public static java.math.BigInteger asBigInteger(java.lang.String propertyName)
Return propertyName as a BigInteger.- Parameters:
propertyName- name of property.- Returns:
- value of property as a BigInteger, null if not defined.
-
asKeySet
public static java.util.Set<java.lang.String> asKeySet(java.lang.String propertyName)
-
getPropertyValue
public static java.lang.String getPropertyValue(java.lang.String propertyName)
Return the String value of the property propertyName. Property valuation starts with java.security, then thread local, then system properties.- Parameters:
propertyName- name of property.- Returns:
- value of property as a String, null if not defined.
-
getPropertyValue
public static java.lang.String getPropertyValue(java.lang.String propertyName, java.lang.String defValue)
-
-