You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a5e172b
Browse filesBrowse the repository at this point in the historyBrowse files
The three java.security.cert.X509CRL accessors no longer let an unchecked exception escape when an indirect CRL carries an entry whose certificateIssuer does not decode to a directoryName, getRevokedCertificates(), getRevokedCertificate(BigInteger) and isRevoked(Certificate) having re-parsed it as GeneralNames.getInstance(...).getNames()[0] in both X509CRLImpl and the deprecated jce.provider.X509CRLObject the registered X509StreamParser.CRL service returns, which also refused the well-formed encoding that names the directoryName after another GeneralName although X509CRLEntryObject read the same CRL correctly, so all six sites now share that sibling's logic, promoted to a package-private static in each of the two packages, and an entry naming no directoryName is treated as having no certificate issuer of its own, which java.security.cert.X509CRLEntry defines as the CRL issuer's, relates to github #2425.
Copy file name to clipboardExpand all lines: docs/releasenotes.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -172,6 +172,8 @@ Date: 2026, TBD
172
172
- The GOST R 34.10-2001 / 2012 signer (org.bouncycastle.crypto.signers.ECGOST3410Signer, and ECGOST3410_2012Signer which extends it) drew its per-signature nonce uniformly over the bit length of the group order and rejected only a draw of zero, where the GOST R 34.10-94 signer beside it already redraws anything at or past the order. A draw that landed at or past n was therefore not discarded but folded to k mod n by the reductions that followed, which makes the bottom of the range likelier than the top. On most of the named curves that costs nothing - the order is either just below the next power of two, so such a draw essentially never happens, or close to half of it, so the fold covers the range exactly twice and the result stays uniform - but on the three whose order is about 0.61 of 2^256 (GostR3410-2001-CryptoPro-C, GostR3410-2001-CryptoPro-XchB and Tc26-Gost-3410-12-256-paramSetD) the bottom 64.5% of the range takes 78.4% of the draws, so a nonce fell below n/2 about 61% of the time rather than 50%. A nonce that is not uniform over [1, n-1] is the input a lattice attack on the signing key consumes, and while no key recovery is demonstrated here, the scheme's security argument assumes a uniform one. The nonce is now redrawn until it is below the order, as the GOST R 34.10-94 signer does. That signer had the mirror of the same gap and is corrected with it: it redrew a nonce at or past q but accepted one of zero, which is the single value that gives the signing key away outright - the blinded exponent becomes a multiple of q, so r is 1 and s = k * m + x * r collapses to x. It is a 2^-256 draw, but free to close, and it is now redrawn like any other unusable value. A caller supplying a deterministic stream of test randomness will see further bytes requested where a draw is out of range and previously was not redrawn; the GOST R 34.10 vectors all draw in range and are unaffected. Note the redraw is also what the constant-time assembly above depends on, since that rejects rather than reduces an operand at or past the modulus.
173
173
- org.bouncycastle.openpgp.api.DoubleBufferedInputStream has been removed. The class has been present since 1.81, to withhold a trailing window of decrypted data so that unauthenticated plaintext is not emitted, but it was never referenced by anything in the library - no class in any source tree constructed one, and no policy or setting connected it to the decryption pipeline - and it did not work. Its read() returned the buffered byte unmasked, so every byte from 0x80 upwards came back negative and 0xFF came back as -1, which a caller reads as end of stream: data was silently corrupted and then silently truncated. Reading an OpenPGP message through one failed on the first packet, the new-format tag octet 0xCB being read as -53. Its read(byte[], int, int) also returned 0 where the underlying stream returned 0, which the InputStream contract does not allow. Beyond that it never filled its buffers, taking whatever a single read of the underlying stream returned, so the amount withheld was one read rather than the configured buffer size - for a tampered five megabyte message a corrected version of the class still released all but about 1.7 kilobytes of the plaintext with a one megabyte buffer. It is removed rather than repaired: it was unusable as shipped, nothing in the library depended on it, and the withholding it offered was not the guarantee its documentation described. This is a removal from the exported org.bouncycastle.openpgp.api package, so it is a public API change, but no caller can have been reading data through one successfully. Note that the high-level decryption API still hands version 1 (MDC) integrity-protected plaintext to a streaming caller before the integrity check runs at end of stream, so callers must not act on data read from an OpenPGPMessageInputStream until close() has returned without error; version 2 (AEAD) messages are unaffected, each chunk being authenticated before it is released (github #2424).
174
174
175
+
- The three X509CRL accessors let an unchecked exception escape when an indirect CRL carried an entry whose certificateIssuer extension did not decode to a directoryName. getRevokedCertificates(), getRevokedCertificate(BigInteger) and isRevoked(Certificate) each re-parsed the extension with GeneralNames.getInstance(...).getNames()[0], which raises ArrayIndexOutOfBoundsException for an empty GeneralNames and IllegalArgumentException for a first GeneralName that is not a directoryName, neither of them declared by java.security.cert.X509CRL, so a caller guarding only the CRLException the API names did not catch them; a CRL is routinely fetched and parsed before its signature is checked, so the bytes reaching these methods are not necessarily trusted. The same three sites appear again in the deprecated org.bouncycastle.jce.provider.X509CRLObject, which the registered X509StreamParser.CRL service returns, and in the jdk1.1 and jdk1.3 overlays of both classes. This was not only a robustness problem: because the parse assumed the directoryName was first, a CRL naming its entry issuer as a directoryName after some other GeneralName - a well-formed encoding, GeneralNames being a SEQUENCE OF with no ordering requirement - was refused as well, while X509CRLEntryObject, which iterates for the directoryName inside a try/catch, read the same CRL correctly. All six call sites now use that sibling's logic, which has been promoted to a package-private static in each of the two packages rather than left as a fourth hand-written copy, so the accessors and the entry objects can no longer disagree about the same CRL. An entry whose certificateIssuer names no directoryName is treated as having no certificate issuer of its own, which java.security.cert.X509CRLEntry.getCertificateIssuer() defines as the CRL issuer's, so isRevoked reports such an entry against the CRL issuer rather than throwing (github #2425).
0 commit comments