dependabot[bot] opened a new pull request, #2681:
URL: https://github.com/apache/phoenix/pull/2681

   Bumps [org.bouncycastle:bcprov-jdk18on](https://github.com/bcgit/bc-java) 
from 1.79 to 1.85.
   <details>
   <summary>Changelog</summary>
   <p><em>Sourced from <a 
href="https://github.com/bcgit/bc-java/blob/main/docs/releasenotes.md";>org.bouncycastle:bcprov-jdk18on's
 changelog</a>.</em></p>
   <blockquote>
   <h3>Version 1.85, 1.85.1</h3>
   <p>Release: 1.85, 1.85.1<br />
   Date: 2026, July 12th</p>
   <h4>Defects Fixed</h4>
   <ul>
   <li>Release 1.85.1 generated for Java 5 to Java 8 and Java 4 to deal with a 
packaging issue that occured with the bcprov and bcutil jars - the Maven SBOMs 
for both have been uploaded as well.</li>
   <li>The streaming S/MIME writers SMIMEEnvelopedWriter.Builder and 
SMIMESignedWriter.Builder (org.bouncycastle.mime.smime) emitted a 
caller-supplied withHeader(name, value) verbatim, each terminated by CRLF, so a 
name or value carrying an embedded CRLF - the natural case when an application 
populates a header such as Subject from user input - was folded into the 
message as extra header lines and, with a trailing CRLFCRLF, a forged body: 
MIME header injection (CWE-93). withHeader now rejects a name or value 
containing CR or LF with an IllegalArgumentException; the internally generated 
headers and well-formed caller headers are unaffected (github <a 
href="https://redirect.github.com/bcgit/bc-java/issues/2348";>#2348</a>).</li>
   <li>A version 6 OnePassSignature packet 
(org.bouncycastle.bcpg.OnePassSignaturePacket) generated for emission defaulted 
to the Legacy OpenPGP packet format, so under the default ROUNDTRIP encoding a 
v6 OPS packet built via PGPSignatureGenerator was written with a Legacy header, 
breaking interoperability with strict RFC 9580 consumers - sec. 4.2 states the 
Legacy format &quot;SHOULD NOT be used to generate new data&quot;. The v6 
constructor now defaults to the new packet format, mirroring the v6 
SignaturePacket constructor; the high-level OpenPGP message API already forced 
the new format, version 3 packets retain the Legacy default, and a Legacy 
header can still be forced through PacketFormat.LEGACY (github <a 
href="https://redirect.github.com/bcgit/bc-java/issues/2347";>#2347</a>).</li>
   <li>OpenPGPCertificate (org.bouncycastle.openpgp.api) derived a key's 
expiration from the most recent applicable self-signature or binding without 
verifying it, so anyone able to tamper with a transferable public key - a 
keyserver upload, a mail attachment, a MITM of a key fetch - could append a 
later-dated subkey binding advertising KeyExpirationTime = 0 and have 
getExpirationTime() report the key as non-expiring, overriding the owner's 
genuine expiry. Expiry is now taken only from the most recent self-signature or 
binding that is cryptographically valid. The legacy 
PGPPublicKey.getValidSeconds()/getValidDays() accessors remain unverified by 
design, that class having no handle on the issuing key; their javadoc now 
points callers making trust decisions at OpenPGPCertificate.</li>
   <li>The OpenPGP NotationData signature subpacket parser 
(org.bouncycastle.bcpg.sig.NotationData) miscounted its own header when 
bounds-checking the body: the header is 8 octets - four flag octets, a 2-octet 
name length and a 2-octet value length - but verifyData reserved only 4, so a 
subpacket declaring more name or value data than it carried slipped past the 
length guard and then overran with an ArrayIndexOutOfBoundsException when read 
during signature verification rather than being cleanly rejected at parse time. 
The guard now accounts for the full 8-octet header, matching the truncation 
checks on the neighbouring subpackets (issue <a 
href="https://redirect.github.com/bcgit/bc-java/issues/2346";>#2346</a>).</li>
   <li>The soft-fail hard limit in 
org.bouncycastle.pkix.jcajce.X509RevocationChecker 
(Builder.setSoftFailHardLimit) compared elapsed downtime against the limit with 
a strict &quot;&lt;&quot;, so a failure occurring exactly at maxTime was still 
treated as soft, contrary to the javadoc. With maxTime = 0 the second failure 
only hard-failed once a full millisecond had elapsed since the first, so on a 
fast machine two revocation checks within the same millisecond both 
soft-passed. The comparison is now inclusive, so the limit fires at maxTime as 
documented.</li>
   <li>KMIPInputStream (org.bouncycastle.kmip.wire) built its XMLEventReader 
from a bare XMLInputFactory, so a KMIP XML message carrying a DOCTYPE was 
processed and external SYSTEM entities resolved during parsing - an XML 
External Entity exposure permitting local file disclosure via file:// URIs, 
outbound requests via http:// URIs, and information disclosure through parse 
error messages. The factory is now configured with SUPPORT_DTD = false and 
IS_SUPPORTING_EXTERNAL_ENTITIES = false before the reader is created; messages 
without a DOCTYPE parse exactly as before (github <a 
href="https://redirect.github.com/bcgit/bc-java/issues/2315";>#2315</a>).</li>
   <li>Reading a GnuPG keybox (org.bouncycastle.gpg.keybox.KeyBox / BcKeyBox / 
JcaKeyBox) stopped at the first EMPTY_BLOB, treating that free or deleted slot 
as end-of-file, so any key blobs following it were silently dropped - a keybox 
laid out as three OpenPGP blobs, an empty blob and a fourth OpenPGP blob 
returned only three where gnupg reads four. An empty blob is now skipped by 
advancing past its declared length and parsing continues, including for a 
header-only empty blob; only a malformed length that would move the read 
position backwards or beyond the buffer still terminates the read (issue <a 
href="https://redirect.github.com/bcgit/bc-java/issues/2343";>#2343</a>).</li>
   <li>The CMS SignerInfo decoder org.bouncycastle.asn1.cms.SignerInfo cast the 
version element directly to ASN1Integer and the trailing unsignedAttrs element 
directly to ASN1TaggedObject, so a malformed-but-parseable SignerInfo whose 
first element is not an INTEGER, or whose trailing element is not a [1] tagged 
object, leaked an unchecked ClassCastException instead of the documented 
IllegalArgumentException - escaping the throws-CMSException contract of code 
reaching the decode through getSignerInfos() / getCounterSignatures(). Both 
elements now decode via getInstance, matching 
org.bouncycastle.asn1.pkcs.SignerInfo (issue <a 
href="https://redirect.github.com/bcgit/bc-java/issues/2342";>#2342</a>).</li>
   <li>The CMS attribute decoder org.bouncycastle.asn1.cms.Attribute cast the 
first two elements of its SEQUENCE directly to ASN1ObjectIdentifier / ASN1Set, 
so an attribute whose type is not an OBJECT IDENTIFIER, or whose value is not a 
SET, leaked an unchecked ClassCastException instead of the documented 
IllegalArgumentException - escaping the throws-CMSException contract of 
SignerInformation.verify() / getSignedAttributes() when verifying a 
malformed-but-parseable signed message. Both elements now decode via 
getInstance; well-formed attributes are unaffected.</li>
   <li>Materializing a definite-length ASN.1 object through 
DefiniteLengthInputStream.toByteArray() allocated the full declared length up 
front, before reading any content. Where ASN1InputStream wraps a raw 
InputStream the per-object limit falls back to Runtime.maxMemory(), so a 
six-byte OCTET STRING header declaring a near-heap length with no body could 
drive an OutOfMemoryError before a single content byte was read (CWE-789). The 
buffer is now grown incrementally as bytes arrive, so the allocation a short 
input can force is bounded; a truncated stream still fails with the same 
&quot;DEF length ... object truncated by ...&quot; EOFException. Callers 
wrapping a raw stream should still set an explicit limit through the 
ASN1InputStream(InputStream, int) constructor or the 
org.bouncycastle.asn1.max_limit property - this removes the amplification, not 
the need for a bound.</li>
   <li>The SP 800-208 XMSS / XMSS^MT parameter sets could not be carried 
through a PKCS#8 PrivateKeyInfo: PrivateKeyInfoFactory always used the legacy 
PQCObjectIdentifiers.xmss form, whose XMSSKeyParams carries only the tree 
height and tree-digest OID and cannot express them. A SHAKE256 private key 
threw IllegalArgumentException (&quot;unknown tree digest: SHAKE256-LEN&quot;), 
and a SHA-256/192 key - which shares id-sha256 with the RFC 8391 n=32 set - 
encoded to the wrong OID and round-tripped to a different parameter set, while 
the matching public key already used the RFC 9802 form, so a keypair's halves 
carried different OIDs. Private keys for all standard sets now use the same RFC 
9802 id-alg-xmss-hashsig / id-alg-xmssmt-hashsig form as the public key, so the 
halves share one OID and a key round-trips losslessly. Non-standard tree 
heights keep the legacy form, which is still read on decode (issue <a 
href="https://redirect.github.com/bcgit/bc-java/issues/2176";>#2176</a>).</li>
   <li>The X.509 value objects returned by CertificateFactory 
(&quot;X.509&quot;, &quot;BC&quot;) deferred X.500 name validation to their 
lazy getSubjectX500Principal() / getIssuerX500Principal() accessors, so a 
distinguished name that decodes under BC's lenient X500Name but is rejected by 
the stricter X500Principal constructor parsed cleanly at generateCertificate() 
/ generateCRL() and then threw an unchecked IllegalArgumentException the first 
time the name was read. For a certificate this escaped 
CertPathValidator.validate() as an unchecked exception rather than the declared 
CertPathValidatorException, the issuer being read before signature 
verification, so an attacker-supplied leaf could trigger it. 
X509CertificateObject and X509CRLObject now validate the names in their 
constructor and reject a malformed one with a checked 
CertificateParsingException / CRLException, so the object is never 
constructed.</li>
   <li>During PKIX revocation checking against an indirect CRL, the three 
getCertStatus implementations in org.bouncycastle.jce.provider and 
org.bouncycastle.pkix.jcajce read the entry's certificateIssuer through 
X509CRLEntry.getCertificateIssuer(), whose own guard covers only the 
IOException from X500Name.getEncoded() and lets the IllegalArgumentException 
from the X500Principal constructor escape on a 
structurally-decodable-but-invalid name. A malformed certificateIssuer in a 
validly signed indirect CRL therefore leaked an unchecked exception rather than 
the declared AnnotatedException. All three now wrap the read and fail closed 
with AnnotatedException (&quot;CRL entry certificate issuer could not be 
parsed.&quot;) rather than swallowing it to null, which would fail revocation 
open.</li>
   <li>The JCE parameter-set classes KyberParameterSpec, SABERParameterSpec, 
HQCParameterSpec and SnovaParameterSpec (org.bouncycastle.pqc.jcajce.spec) 
built their static fromName(String) map with keys that never matched what 
getName() returns, so fromName(spec.getName()) returned null for every 
parameter set - Kyber was keyed &quot;kyber512&quot; against the ML-KEM names, 
HQC &quot;hqc128&quot; against &quot;hqc-128&quot;, Snova with upper-case names 
against a lower-cased lookup, and SABER had no static initializer at all. 
Because the BCPQC key classes implement getParameterSpec() as fromName(...), 
every such public and private key returned null and 
key.getParameterSpec().getName() raised a NullPointerException. Each map is now 
keyed by the lower-cased getName() value, Kyber and HQC retaining their legacy 
aliases, so the lookup round-trips for all parameter sets.</li>
   <li>Decrypting a CMS/S-MIME EnvelopedData or AuthEnvelopedData addressed to 
a password recipient ran PBKDF2 with the iteration count taken straight from 
the PBKDF2Params in the recipient's keyDerivationAlgorithm, with no upper 
bound. That count travels in the unauthenticated PasswordRecipientInfo (RFC 
3211) and EnvelopedData has no integrity gate before content decryption, so an 
attacker-supplied message could specify a count up to Integer.MAX_VALUE and 
make a single decryption attempt spin for tens of minutes. Both derivation 
paths - org.bouncycastle.cms.bc.BcPasswordRecipient and 
org.bouncycastle.cms.jcajce.EnvelopedDataHelper - now bound the count by 
Properties.PBE_MAX_ITERATION_COUNT (default 10,000,000, the ceiling the PBES2 
PKCS#8/PEM decrypt path already applies) and throw a CMSException before 
deriving the key when it is exceeded.</li>
   <li>The X.509 NameConstraints parser 
(org.bouncycastle.asn1.x509.NameConstraints / GeneralSubtree) did not reject 
structurally invalid empty sequences: an empty permittedSubtrees [0] or 
excludedSubtrees [1] was accepted even though RFC 5280 sec. 4.2.1.10 defines 
GeneralSubtrees as SEQUENCE SIZE (1..MAX), and an empty GeneralSubtree, missing 
its mandatory base GeneralName, parsed with an unchecked 
ArrayIndexOutOfBoundsException escaping the IllegalArgumentException-declared 
parse path. Both now reject the empty sequence with &quot;sequence may not be 
empty&quot;, matching the other SEQUENCE SIZE (1..MAX) extension types.</li>
   <li>Five more X.509 extension value parsers defined as SEQUENCE SIZE 
(1..MAX) by RFC 5280 - CertificatePolicies (sec. 4.2.1.4), PolicyMappings (sec. 
4.2.1.5), ExtendedKeyUsage (sec. 4.2.1.12), CRLDistPoint (sec. 4.2.1.13) and 
SubjectDirectoryAttributes (sec. 4.2.1.8) - accepted a structurally invalid 
empty SEQUENCE, yielding a degenerate empty extension rather than failing the 
parse. Each now rejects one with &quot;sequence may not be empty&quot; in its 
parse constructor, matching AuthorityInformationAccess and NameConstraints 
(issue <a 
href="https://redirect.github.com/bcgit/bc-java/issues/2331";>#2331</a>).</li>
   <li>The GPG S-expression parser (org.bouncycastle.gpg.SExpression, reached 
through SExprParser.parseSecretKey / PGPSecretKey.parseSecretKeyFromSExpr) 
allocated the buffer for a canonical string directly from the attacker-declared 
length before reading any data - a token such as &quot;(67108864:)&quot; 
declares a 64 MiB string from a handful of input bytes - and on a short stream 
the two-argument Streams.readFully silently left the buffer zero-padded rather 
than failing. The length is now read incrementally in bounded increments, so 
the allocation tracks the bytes the stream actually delivers and a truncated 
canonical string is rejected with an EOFException at the genuine end of input 
(github <a 
href="https://redirect.github.com/bcgit/bc-java/issues/2338";>#2338</a>).</li>
   <li>org.bouncycastle.openpgp.PGPObjectFactory.nextObject(), which is 
declared to throw only IOException, leaked an unchecked ClassCastException on a 
stream presenting a top-level SECRET_SUBKEY packet: tag 7 is not handled by the 
nextObject() switch, so it fell through to a default tail that blindly cast 
readPacket()'s result to UnknownPacket, while readPacket() decodes it into a 
typed SecretSubkeyPacket. The default tail now rejects any packet readPacket() 
decodes into a concrete type that the switch does not handle with an 
IOException (&quot;unexpected packet in stream: ...&quot;), covering this tag 
and any other typed one missing now or later; the genuine unknown-packet path 
is unchanged.</li>
   <li>The BC provider aliased the ARIA-CCM content-encryption OIDs 
(id-aria128-ccm/192/256, 1.2.410.200046.1.1.37/38/39) to the AES 
&quot;CCM&quot; Cipher rather than to ARIA-CCM, so a Cipher or 
AlgorithmParameters obtained by ARIA-CCM OID silently ran AES-CCM. The ARIA-CCM 
OIDs now resolve to the ARIA CCM Cipher and a dedicated ARIA-CCM 
AlgorithmParameters/AlgorithmParameterGenerator (the ARIA-GCM OID aliases were 
already correct). ARIA-CCM is thus now usable through the standard 
OID-addressed JCE path; the previously registered ARIA 
&quot;ARIAGCM&quot;/&quot;ARIACCM&quot; ciphers are unaffected.</li>
   <li>The RFC 3029 DVCS request builder DVCSRequestInformationBuilder, when 
seeded from an existing request through its 
DVCSRequestInformationBuilder(DVCSRequestInformation) constructor, silently 
dropped the requester ([0] GeneralNames) and extensions ([4] Extensions) 
fields, so build() re-emitted the request without the original requester 
identity or any extensions - unrecoverably for extensions, since 
setExtensions() throws on a seeded builder. This is exactly the 
seed-and-re-issue path RFC 3029 sec. 9.1 describes for a DVCS modifying a 
received request. The constructor now copies both fields, so rebuilding a 
parsed request is byte-for-byte faithful.</li>
   <li>BCJSSE's established session (ProvSSLSession) threw 
UnsupportedOperationException from getRequestedServerNames(); only the 
transient handshake session implemented it, so a server (e.g. Jetty) could not 
read the SNI the client requested once the handshake had completed. The 
requested server names are now captured from the handshake and retained on the 
established session, so getRequestedServerNames() returns them (an empty list 
when no SNI was sent, per the ExtendedSSLSession contract) on both the client 
and server side (issue <a 
href="https://redirect.github.com/bcgit/bc-java/issues/1773";>#1773</a>).</li>
   <li>BCJSSE endpoint identification for the HTTPS algorithm matched a dNSName 
SAN wildcard in any label of the certificate name rather than only in the 
complete left-most label, checkEndpointID dispatching the HTTPS case to 
HostnameUtil.checkHostname in the all-labels mode. A certificate whose SAN was 
&quot;foo.*.com&quot; therefore matched &quot;foo.evil.com&quot;, and 
&quot;*.*.com&quot; matched any two-label .com host - a weakening of the 
client's defence against an impersonating server, and more permissive than both 
SunJSSE and RFC 6125 sec. 6.4.3 / RFC 9525 sec. 6.3, which require the wildcard 
to be the complete content of the left-most label. The HTTPS path now matches 
left-most-label wildcards only, as the LDAP path already did; only a 
certificate carrying a wildcard in a non-left-most label, which no 
publicly-trusted CA will issue, changes outcome.</li>
   <li>A parameter-set-locked HQC KeyGenerator threw a NullPointerException 
when initialised with a KEMGenerateSpec or KEMExtractSpec, a consequence of the 
HQCParameterSpec fromName() mis-keying covered above; HQCKeyGeneratorSpi now 
compares against the upper-cased parameter name, matching the key's 
getAlgorithm(), as the other KEMs do. The dash form (&quot;HQC-128&quot;) is 
now the primary registered algorithm name across KeyFactory, KeyPairGenerator, 
KeyGenerator, Cipher and KEM, matching getName() and the pre-existing KEM 
registrations, with the non-hyphenated names retained as aliases. The 
equivalent handling in the NTRU+ KEM KeyGenerator was aligned to the same 
pattern.</li>
   <li>The lightweight cert-path validation rule 
org.bouncycastle.cert.path.validations.CRLValidation selected a CRL from the 
supplied Store by matching the issuer DN only, then consulted its revoked list 
without ever verifying the CRL signature, so code populating the Store from an 
attacker-influenceable feed could be given a forged CRL bearing the CA's issuer 
DN - an empty list to suppress a real revocation, or a fabricated entry to deny 
a valid certificate - and trust it. Each matched CRL's signature is now 
verified against the issuing CA's public key first, mirroring 
ParentCertIssuedValidation: a new constructor takes the trust anchor's 
SubjectPublicKeyInfo and an X509ContentVerifierProviderBuilder, and the 
previous (X500Name, Store) constructor is deprecated and fails closed, as it 
cannot verify signatures. The full JCA path already verified CRL 
signatures.</li>
   <li>The default BC &quot;BKS&quot; keystore would silently load a legacy 
version 0/1 store. Those formats derive the HMAC integrity key at only the 
digest size in bits rather than bytes - a 16-bit key for the SHA-1 HMAC - which 
is brute-forceable offline, so an attacker able to supply or tamper with a 
keystore file could downgrade the unauthenticated on-disk version field, forge 
a valid integrity MAC over modified contents such as an injected trusted 
certificate, and have it accepted (CVE-2018-5382). Loading a version 0/1 store 
through the default &quot;BKS&quot; type now throws an IOException unless the 
caller opts in through Properties.BKS_ENABLE_V1 
(&quot;org.bouncycastle.bks.enable_v1&quot;), which already gated creation of 
such stores and the separate &quot;BKS-V1&quot; type. The default type 
continues to read and write version 2 unchanged.</li>
   <li>The default BC &quot;BKS&quot; keystore and the legacy 
&quot;BKS-V1&quot; type derived the integrity-MAC key using the PBE iteration 
count read from the keystore header with no upper bound. KeyStore.load(stream, 
password) runs that derivation before the HMAC integrity check, so an attacker 
able to supply the file - the caller supplying the password being the normal 
load shape - could set the count near 2^31 and pin a CPU core for minutes per 
call, a pre-integrity-check denial of service; the store salt length was 
already bounded but the count was not. It is now rejected up front with an 
IOException when outside the new Properties.BKS_MAX_IT_COUNT (default 1048576), 
mirroring the caps on the UBER, PKCS12 and BCFKS stores, and the same bound 
applies to the per-entry count read when decrypting a sealed key. The BKS 
writer emits around 1024-2047.</li>
   <li>ArmoredInputStream mishandled dash-escaping in cleartext-signed 
messages. RFC 4880 sec. 7.1 requires every cleartext line beginning with a dash 
to be prefixed with &quot;- &quot;, but the reader instead dropped the two 
leading characters of any line starting with a dash, so a signature computed 
over &quot;payload&quot; also verified against a tampered &quot;-Xpayload&quot; 
line. A leading dash that is neither a &quot;-----&quot; armor header nor a 
&quot;- &quot; escape is now treated as malformed and rejected with an 
ArmoredInputException by default; RFC-conformant messages are unaffected, and 
ArmoredInputStream.Builder.setRejectPrefixedDashesInCSFMessages(false) restores 
a lenient mode that surfaces the offending bytes verbatim so the signature 
check fails rather than silently dropping them (github <a 
href="https://redirect.github.com/bcgit/bc-java/issues/2329";>#2329</a>).</li>
   <li>KGCMBlockCipher (DSTU 7624 GCM mode, and the KGMac built on it) did not 
detect nonce reuse: re-initialising the same instance for encryption with an 
identical key and nonce was silently accepted, though as with any GCM-family 
mode that leaks the authentication key and the XOR of the plaintexts. init now 
rejects it with an IllegalArgumentException (&quot;cannot reuse nonce for KGCM 
encryption&quot;), matching the existing GCMBlockCipher guard; reset()-based 
reuse, a fresh nonce, a fresh key and re-initialisation for decryption are all 
unaffected.</li>
   <li>KGCMBlockCipher (DSTU 7624 GCM mode) applied the AEADParameters initial 
associated text to its accumulator on init() without first clearing it, so 
re-initialising an instance carried the previous operation's associated data - 
left in the buffer by the prior doFinal's reset() - into the next 
authentication tag, producing a tag over the old AAD concatenated with the new 
and differing from a freshly constructed cipher. init() now resets the 
associated-text buffer in both the AEADParameters and ParametersWithIV 
branches, so a re-initialised cipher behaves exactly like a new one; 
reset()-based reuse was already correct (github PR <a 
href="https://redirect.github.com/bcgit/bc-java/issues/2349";>#2349</a>).</li>
   <li>The AEAD block-cipher modes EAXBlockCipher, CCMBlockCipher, 
OCBBlockCipher and KCCMBlockCipher did not detect nonce reuse on 
re-initialisation for encryption - the same footgun the KGCMBlockCipher guard 
above and the long-standing GCMBlockCipher and ChaCha20Poly1305 guards already 
reject - even though encrypting two messages under one key and nonce leaks the 
authentication key and the XOR of the plaintexts. RFC 5116 sec. 2.1 and RFC 
7253 sec. 5.1 put that obligation on the caller, so this is a defensive guard 
turning a silent violation into a fail-fast error. Each mode's init now throws 
IllegalArgumentException when the new nonce equals the previous one under the 
same key, CCM and OCB additionally catching the null-key form; reset()-based 
reuse, a fresh nonce or key, and decryption are unaffected. GCMSIVBlockCipher 
and KXTSBlockCipher are deliberately not guarded.</li>
   <li>CCM (CCMBlockCipher) released unverified plaintext on a failed 
authentication check: decryption CTR-decrypted the whole payload straight into 
the caller-supplied output buffer and only then compared the MAC, so on a tag 
mismatch it threw InvalidCipherTextException but left the unverified plaintext 
in that buffer, never zeroed. A caller that exposes the buffer on the failure 
path - through pooled-buffer reuse, logging or memory inspection - could 
thereby use forged ciphertexts as an unauthenticated CTR decryption oracle, 
contrary to NIST SP 800-38C sec. 6.2. CCM is non-streaming, so decryption now 
produces the plaintext into a private buffer, verifies the MAC, and copies to 
the caller's output only on success, clearing the private buffer on failure, as 
GCMSIVBlockCipher already did.</li>
   <li>The DSTU 7624 (Kalyna) AEAD modes KCCMBlockCipher and KGCMBlockCipher 
released unverified plaintext on the same failure path as CCM above, writing 
the recovered plaintext into the caller's output buffer before the 
authentication tag was compared. KGCM authenticates the ciphertext, so it now 
verifies the tag before decrypting; KCCM authenticates the plaintext, so it 
decrypts into a private buffer and copies to the caller's output only once the 
MAC verifies, clearing the private buffer on failure. Output for valid 
ciphertexts is unchanged.</li>
   <li>KCCMBlockCipher (DSTU 7624 CCM mode) no longer appends the 
authentication tag to the recovered plaintext on decryption. It previously 
wrote plaintext || MAC into the caller's output buffer while reporting only the 
plaintext length, leaving the verified MAC past the returned length, and 
getOutputSize() returned len + macSize for decryption as well as encryption. 
Decryption now writes the plaintext alone - the MAC remains available through 
getMac() - and getOutputSize() returns len - macSize, matching the contract 
CCMBlockCipher, GCMBlockCipher and KGCMBlockCipher follow. The output-buffer 
length check was made mode-specific so a caller may pass a plaintext-sized 
buffer on decryption, and getOutputSize() now accounts for buffered data so the 
multi-part path is sized correctly. MAC verification itself is unchanged.</li>
   <li>BIKE KEM decapsulation hardened the Fujisaki-Okamoto implicit-rejection 
step. The BGFDecoder returned null on a decoding failure, which the 
decapsulation path then dereferenced, raising a NullPointerException before the 
implicit-rejection branch could run - both crashing on malformed ciphertext and 
acting as a decryption-failure oracle; the decoder now always returns the 
recovered error vector and the re-encryption check rejects a bad decode. 
Separately, the final select between the genuine seed and the rejection seed 
sigma was written as a data-dependent if/else on the constant-time comparison 
result, so the branch direction leaked the FO oracle bit; it is now a 
branchless constant-time move (Bytes.cmov), as FrodoEngine already used, 
defending against the Guo-Johansson-Nilsson (CRYPTO 2020) timing key-recovery 
attack. KAT vectors are byte-identical.</li>
   <li>Salsa20Engine, ChaChaEngine and ChaCha7539Engine detected the carry out 
of the low 32-bit counter word in advanceCounter(long) with a signed comparison 
where an unsigned one is required, so a skip() from a non-zero counter by a 
distance whose low word crosses the 0x80000000 boundary mis-set the high 
counter word: for Salsa20 and ChaCha this silently desynced the 64-bit block 
counter after a large random-access seek, and for the 32-bit ChaCha7539 counter 
it both threw &quot;attempt to increase counter past 2^32&quot; on a valid skip 
and could miss a genuine wrap. The carry is now computed unsigned, matching 
retreatCounter(long). Sequential encryption and seekTo() from reset were 
already correct, so all KAT vectors are byte-identical.</li>
   <li>The lazy ASN.1 SEQUENCE parse path (ASN1InputStream with 
lazyEvaluate=true, used by the CMS and X509CRLHolder stream parsers) did not 
enforce the nested-construction depth guard the eager path applies: a lazily 
parsed SEQUENCE captured its contents as raw bytes and 
LazyEncodedSequence.force() re-parsed them through a fresh ASN1InputStream, 
resetting the depth budget (org.bouncycastle.asn1.max_cons_depth, default 64) 
at every level. Any whole-tree operation on a crafted deeply nested blob 
therefore recursed without bound and could raise a StackOverflowError, a denial 
of service for a consumer parsing untrusted CRLs, CMS or certificates. The 
remaining budget is now threaded into LazyEncodedSequence and 
LazyConstructionEnumeration, raising the same &quot;maximum nested construction 
level reached&quot; ASN1Exception the eager path raises.</li>
   <li>The OER decoder (OERInputStream), which parses IEEE 1609.2 / ETSI TS 103 
097 V2X structures before any signature verification, was hardened against 
three denial-of-service vectors reachable from a small crafted input. parse() 
recursed with no nesting-depth bound and the 1609.2 schema is cyclic, an 
Ieee1609Dot2Data nesting inside its own SignedData payload, so a few KB 
repeatedly selecting the signedData CHOICE drove a StackOverflowError; a hard 
depth cap, threaded across the open-type boundary, now rejects over-deep input. 
A SEQUENCE-OF decoded its element count from a few attacker-controlled bytes 
and looped that many times allocating objects without checking it against the 
remaining input, so a count such as 7F FF FF FF drove roughly 2^31 allocations; 
the count is now bounded by the bytes available, and the fixed-width element 
decoders fail on a short read rather than silently yielding 0 or TRUE. And the 
open-type EXTENSION branch allocated directly from an attacker-controll
 ed length, bypassing the cap every other branch honours; it now goes through 
the same bounded helper.</li>
   <li>IETFUtils.valueToString - reached from X500Name.toString() / equals() / 
hashCode() and from X509Certificate.getSubjectX500Principal().toString() - 
escaped RFC 4514 special characters and leading or trailing spaces by inserting 
a backslash into the StringBuilder it was scanning. Because each insert shifts 
the remainder of the buffer, escaping a value of n special characters cost 
O(n^2) character moves, so a single large attacker-supplied RDN - a long 
PrintableString of commas in a certificate, CSR, CRL or CMS SignerIdentifier - 
could pin a CPU core when the X500Name was logged, compared, hashed or printed. 
The escaping now runs in a single linear pass into a fresh builder; the 
produced string is unchanged.</li>
   <li>The jdk1.4 build variant of LDAPStoreHelper (org.bouncycastle.x509.util, 
used by bcprov-jdk14) did not escape DN-derived values before concatenating 
them into an LDAP search filter, so the CVE-2023-33201 filter-injection fix 
never reached that distribution: the jdk14 Ant build overlays this file, which 
carries its own private parseDN, over the patched main-Java one. A certificate 
whose Subject or Issuer CN embedded LDAP filter metacharacters could therefore 
rewrite the DirContext.search() filter when certification-path building or CRL 
lookup invoked the helper. parseDN now applies the same RFC 2254 escaping as 
the other three variants; the Gradle-built jars were already fixed.</li>
   <li>Importing a Diffie-Hellman or DSA public key validated it by computing a 
modular exponentiation - and, for DH safe primes, a Legendre symbol - modulo 
the supplied prime p, with no bound on the size of p. A crafted 
SubjectPublicKeyInfo arriving through KeyFactory import or certificate parsing 
and carrying a multi-million-bit p therefore forced a very expensive 
computation at import time, an import-time CPU-exhaustion denial of service of 
the same class as CVE-2024-29857. DHPublicKeyParameters and 
DSAPublicKeyParameters now reject a modulus whose bit length exceeds a 
configurable bound before the exponentiation, mirroring the existing RSA cap; 
the bounds default to 16384 bits, well above any standardised group, and are 
controlled by the new Properties.DH_MAX_SIZE and Properties.DSA_MAX_SIZE.</li>
   <li>ArmoredOutputStream sanitized armor header values against the line feed 
only: the additive paths (addComment / setComment / setMessageId / setCharset) 
split values on \n and setVersion rejected \n, but neither handled a bare 
carriage return. A header value carrying an embedded CR - for example a parsed 
User-ID re-armored as a Comment through 
OpenPGPCertificate.toAsciiArmoredString() - therefore survived into a single 
physical header line, which a reader treating a lone CR as end-of-line, 
including BouncyCastle's own ArmoredInputStream, splits into a forged extra 
header or armor boundary. The split paths now split on CR, LF and CRLF, and the 
singleton path rejects CR as it rejects LF.</li>
   </ul>
   <!-- raw HTML omitted -->
   </blockquote>
   <p>... (truncated)</p>
   </details>
   <details>
   <summary>Commits</summary>
   <ul>
   <li>See full diff in <a 
href="https://github.com/bcgit/bc-java/commits";>compare view</a></li>
   </ul>
   </details>
   <br />
   
   
   [![Dependabot compatibility 
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.bouncycastle:bcprov-jdk18on&package-manager=maven&previous-version=1.79&new-version=1.85)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
   
   Dependabot will resolve any conflicts with this PR as long as you don't 
alter it yourself. You can also trigger a rebase manually by commenting 
`@dependabot rebase`.
   
   [//]: # (dependabot-automerge-start)
   [//]: # (dependabot-automerge-end)
   
   ---
   
   <details>
   <summary>Dependabot commands and options</summary>
   <br />
   
   You can trigger Dependabot actions by commenting on this PR:
   - `@dependabot rebase` will rebase this PR
   - `@dependabot recreate` will recreate this PR, overwriting any edits that 
have been made to it
   - `@dependabot show <dependency name> ignore conditions` will show all of 
the ignore conditions of the specified dependency
   - `@dependabot ignore this major version` will close this PR and stop 
Dependabot creating any more for this major version (unless you reopen the PR 
or upgrade to it yourself)
   - `@dependabot ignore this minor version` will close this PR and stop 
Dependabot creating any more for this minor version (unless you reopen the PR 
or upgrade to it yourself)
   - `@dependabot ignore this dependency` will close this PR and stop 
Dependabot creating any more for this dependency (unless you reopen the PR or 
upgrade to it yourself)
   You can disable automated security fix PRs for this repo from the [Security 
Alerts page](https://github.com/apache/phoenix/network/alerts).
   
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to