diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
index a4c720847e..3ec390f55e 100644
--- a/.github/workflows/codeql.yml
+++ b/.github/workflows/codeql.yml
@@ -67,8 +67,8 @@ jobs:
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
- echo "Run, Build Application using script"
- gradle clean build
+ # echo "Run, Build Application using script"
+ # gradle clean build
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
diff --git a/.gitignore b/.gitignore
index 72ab296f63..6c3cd331f6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,6 +8,8 @@
*.swp
*.iml
*/*.iml
+*.ipr
+*.iws
bin/
build/
@@ -22,7 +24,7 @@ pg/*.bak
pg/*.bpg
pg/*.txt
-.idea
+.idea/
codesigning.jks
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index add5521b3c..f24b068b93 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,6 +1,9 @@
stages:
- check
+ - build
- test
+ - publish
+ - sync
check-code:
stage: check
@@ -17,74 +20,52 @@ check-code:
- "pkix/build/reports"
- "mail/build/reports"
- "util/build/reports"
- - "tls/build/reports"
-
-test-code-8:
- stage: test
- needs: []
- script:
- - "ecr_login"
- - "ecr_pull vm_base_intel latest"
- - "ci_docker_run \"vm_base_intel:latest\" \"bc-java\" \"/workspace/bc-java/ci/test_8.sh\""
- artifacts:
- when: always
- paths:
- - "core/build/reports"
- - "prov/build/reports"
- - "pg/build/reports"
- - "pkix/build/reports"
- - "mail/build/reports"
- - "util/build/reports"
- - "tls/build/reports"
-
-test-code-11:
- stage: test
- needs: []
+ - "tls/build/reports"
+ - "mls/build/reports"
+
+ant-build:
+ stage: build
+ needs: [ "check-code" ]
script:
- - "ecr_login"
- - "ecr_pull vm_base_intel latest"
- - "ci_docker_run \"vm_base_intel:latest\" \"bc-java\" \"/workspace/bc-java/ci/test_11.sh\""
- artifacts:
- when: always
- paths:
- - "core/build/reports"
- - "prov/build/reports"
- - "pg/build/reports"
- - "pkix/build/reports"
- - "mail/build/reports"
- - "util/build/reports"
- - "tls/build/reports"
-
-test-code-17:
+ - "ecr_login"
+ - "ecr_pull vm_base_intel latest"
+ - "ci_docker_run \"vm_base_intel:latest\" \"bc-java\" \"/workspace/bc-java/ci/build_1_8.sh\""
+
+
+test-code:
stage: test
+ needs: [ "check-code" ]
script:
- - "ecr_login"
- - "ecr_pull vm_base_intel latest"
- - "ci_docker_run \"vm_base_intel:latest\" \"bc-java\" \"/workspace/bc-java/ci/test_17.sh\""
+ - "ecr_login"
+ - "ecr_pull vm_base_intel latest"
+ - "ci_docker_run \"vm_base_intel:latest\" \"bc-java\" \"/workspace/bc-java/ci/test.sh\""
artifacts:
when: always
- paths:
- - "core/build/reports"
- - "prov/build/reports"
- - "pg/build/reports"
- - "pkix/build/reports"
- - "mail/build/reports"
- - "util/build/reports"
- - "tls/build/reports"
-test-code-21:
- stage: test
- needs: []
+ reports:
+ junit:
+ - "core/build/test-results/**/*.xml"
+ - "prov/build/test-results/**/*.xml"
+ - "pg/build/test-results/**/*.xml"
+ - "pkix/build/test-results/**/*.xml"
+ - "mail/build/test-results/**/*.xml"
+ - "util/build/test-results/**/*.xml"
+ - "tls/build/test-results/**/*.xml"
+ - "mls/build/test-results/**/*.xml"
+
+
+publish:
+ stage: publish
+ rules:
+ - if: $CI_COMMIT_BRANCH == "main"
script:
+ - "apply_overlay bc-java-pub ./"
- "ecr_login"
- "ecr_pull vm_base_intel latest"
- - "ci_docker_run \"vm_base_intel:latest\" \"bc-java\" \"/workspace/bc-java/ci/test_21.sh\""
- artifacts:
- when: always
- paths:
- - "core/build/reports"
- - "prov/build/reports"
- - "pg/build/reports"
- - "pkix/build/reports"
- - "mail/build/reports"
- - "util/build/reports"
- - "tls/build/reports"
\ No newline at end of file
+ - "ci_docker_run \"vm_base_intel:latest\" \"bc-java\" \"/workspace/bc-java/ci/pub.sh\""
+
+spongycastle:
+ stage: "sync"
+ rules:
+ - if: $CI_COMMIT_BRANCH == "main"
+ script:
+ - "syncpongy.sh"
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000000..771bf2884b
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,51 @@
+# Bouncy Castle Contributing Guidelines
+
+Thank you for contributing to Bouncy Castle!
+
+In this guide, you get an overview of the contribution workflow from starting a discussion or opening an issue, to creating, reviewing, and merging a pull request.
+
+For an overview of the project, see [README](README.md).
+
+### Start a discussion
+If you have a question or problem, you can [search in discussions](https://github.com/bcgit/bc-java/discussions), if someone has already found a solution to your problem.
+
+Or you can [start a new discussion](https://github.com/bcgit/bc-java/discussions/new/choose) and ask your question.
+
+### Create an issue
+
+If you find a problem with Bouncy Castle, [search if an issue already exists](https://github.com/bcgit/bc-java/issues).
+
+> **_NOTE:_** If the issue is a __potential security problem__, please contact us
+before posting anything public. See [Security Policy](SECURITY.md).
+
+If a related discussion or issue doesn't exist, and the issue is not security related, you can [open a new issue](https://github.com/bcgit/bc-java/issues/new). An issue can be converted into a discussion if regarded as one.
+
+### Contribute to the code
+
+For substantial, non-trivial contributions, you may be asked to sign a contributor assignment agreement. Optionally, you can also have your name and contact information listed in [Contributors](https://www.bouncycastle.org/contributors.html).
+
+Please note we are unable to accept contributions which cannot be released under the [Bouncy Castle License](https://www.bouncycastle.org/licence.html). Issuing a pull request on our public github mirror is taken as agreement to issuing under the Bouncy Castle License.
+
+#### Create a pull request
+
+> **_NOTE:_** If the issue is a __potential security problem__, please contact us. See [Security Policy](SECURITY.md).
+
+You are welcome to send patches, under the Bouncy Castle License, as pull requests. For more information, see [Creating a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request). For minor updates, you can instead choose to create an issue with short snippets of code. See above.
+
+* For contributions touching multiple files try and split up the pull request, smaller changes are easier to review and test, as well as being less likely to run into merge issues.
+* Create a test cases for your change, it may be a simple addition to an existing test. If you do not know how to do this, ask us and we will help you.
+* If you run into any merge issues, check out this [git tutorial](https://github.com/skills/resolve-merge-conflicts) to help you resolve merge conflicts and other issues.
+
+For more information, refer to the Bouncy Castle documentation on [Getting Started with Bouncy Castle](https://doc.primekey.com/bouncycastle/introduction#Introduction-GettingStartedwithBouncyCastle).
+
+#### Self-review
+
+Don't forget to self-review. Please follow these simple guidelines:
+* Keep the patch limited, only change the parts related to your patch.
+* Do not change other lines, such as whitespace, adding line breaks to Java doc, etc. It will make it very hard for us to review the patch.
+
+
+#### Your pull request is merged
+
+For acceptance, pull requests need to meet specific quality criteria, including tests for anything substantial. Someone on the Bouncy Castle core team will review the pull request when there is time, and let you know if something is missing or suggest improvements. If it is a useful and generic feature it will be integrated in Bouncy Castle to be available in a later release.
+
diff --git a/CONTRIBUTORS.html b/CONTRIBUTORS.html
index 5be72106c7..e8721a6f88 100644
--- a/CONTRIBUTORS.html
+++ b/CONTRIBUTORS.html
@@ -384,7 +384,7 @@
Tobias Wich<tobias.wich@ecsec.de> Provided patch for TLS to work around servers sending Supported Elliptic Curves extension unexpectedly.
Hauke Mehrtens<hauke@hauke-m.de> TLS patch to add ECDHE_ECDSA CCM ciphersuites from RFC 7251.
Daniel Zimmerman<dmz@galois.com> Further key quality improvements to RSAKeyPairGenerator.
-Jens Kapitza<j.kapitza@schwarze-allianz.de> Iterable support in OpenPGP API, code cleanup in OpenPGP API.
+Jens Kapitza<j.kapitza@schwarze-allianz.de> Iterable support in OpenPGP API, code cleanup in OpenPGP API.
Johan Eklund<johan@primekey.se> update to RFC 6960 for OCSPObjectIdentifiers.
nikosn<https://github.com/nikosn> Fix to encoding of EC private keys to ensure encoding matches order length.
Axel von dem Bruch <axel-vdb@riseup.net> Contributions to BCrypt/OpenBSDBCrypt, original version of Blake2bDigest.
@@ -447,16 +447,15 @@
Adam Vartanian <https://github.com/flooey> use of ShortBuffer exception and buffer size pre-check in Cipher.doFinal().
Bernd <https://github.com/ecki> Fix to make PGPUtil.pipeFileContents use buffer and not leak file handle.
Shartung <https://github.com/shartung> Additional EC Key Agreement algorithms in support of German BSI TR-03111.
-Paul Schaub <https://github.com/vanitasvitae> bringing PGPSecretKey.getUserIds() into line with PGPPublicKey.getUserIds(). Exception message fix in BcPublicKeyDataDecryptorFactory. Additional tests on PGP key ring generation. Improved functionality of PGPSignatureSubpacketGenerator, PGPPublicKeyRing. Tweaks to PGPDataEncryptorBuilder interface, fix for JcaPGP/BcPGP Ed25519 private key conversion. Added configurable CRC detection to ArmoredInputStream, additional control character skipping in ArmoredInputStream. Rewind code for PGPPBEEncryptedData, addition of PGPSignature.getDigestPrefix(). Wrong list traversal fix in PGPSecretKeyRing. Further improvement to use of generics in PGP API. General interop improvements. PGP Public / Secure keyring ignore marker packets when reading. Initial work on PGP session key handling, filtering literal data for canoncialization. Addition of direct key identified key-ring construction. PGPSecretKeyRing.insertOrReplacePublicKey addition. Addition of utility methods for joining/merging signatures and public keys. Addition of PGP regexp packet, PolicyURI packet handling, UTF8 comment testing. Efficiency improvements to TruncatedStream. Initial Argon2 support for OpenPGP. General cleanups. Fast CRC24 implementation, SHA3 addtions to BcImplProvider, improvements to One Pass Signature support, signatue validation, read() consistency in BCPGInputStream. Contributions to AEAD support (v6 & v5) in PGP API. Addition of PGP WildCard ID, moving the PGP example code into the 21st century. Security patches for encrypted data generation, initial thread safe certification verification. Support for V6 EC keys, PGP packet criticality, and Preferred AEAD CipherSuites sigsubpacket support.
+Paul Schaub <https://github.com/vanitasvitae> bringing PGPSecretKey.getUserIds() into line with PGPPublicKey.getUserIds(). Exception message fix in BcPublicKeyDataDecryptorFactory. Additional tests on PGP key ring generation. Improved functionality of PGPSignatureSubpacketGenerator, PGPPublicKeyRing. Tweaks to PGPDataEncryptorBuilder interface, fix for JcaPGP/BcPGP Ed25519 private key conversion. Added configurable CRC detection to ArmoredInputStream, additional control character skipping in ArmoredInputStream. Rewind code for PGPPBEEncryptedData, addition of PGPSignature.getDigestPrefix(). Wrong list traversal fix in PGPSecretKeyRing. Further improvement to use of generics in PGP API. General interop improvements. PGP Public / Secure keyring ignore marker packets when reading. Initial work on PGP session key handling, filtering literal data for canoncialization. Addition of direct key identified key-ring construction. PGPSecretKeyRing.insertOrReplacePublicKey addition. Addition of utility methods for joining/merging signatures and public keys. Addition of PGP regexp packet, PolicyURI packet handling, UTF8 comment testing. Efficiency improvements to TruncatedStream. Initial Argon2 support for OpenPGP. General cleanups. Fast CRC24 implementation, SHA3 addtions to BcImplProvider, improvements to One Pass Signature support, signatue validation, read() consistency in BCPGInputStream. Contributions to AEAD support (v6 & v5) in PGP API. Addition of PGP WildCard ID, moving the PGP example code into the 21st century. Security patches for encrypted data generation, initial thread safe certification verification. Support for V6 EC keys, V6 signatures, V6 encryption, V6 PKESK, PGP packet criticality, and Preferred AEAD CipherSuites sigsubpacket support. Introduce high-level OpenPGP API for message creation/consumption and certificate evaluation. OpenPGP fuzz testing. Fix to prevent a null pointer exception on processing a partial stripped key.
Nick of Nexxar <https://github.com/nros> update to OpenPGP package to handle a broader range of EC curves.
catbref <https://github.com/catbref> sample implementation of RFC 7748/Ed25519 (incorporated work from github users Valodim and str4d as well).
gerlion <https://github.com/gerlion> detection of concurrency issue with pre-1.60 EC math library.
fgrieu <fgrieu@gmail.com> identification and suggested fixes for possible timing vulnerability in OAEPEncoding and RSACoreEngine.
-MTG <https://github.com/mtgag> patch for decoding issues in PKIPublicationInfo and CertifiedKeyPair.
+MTG <https://github.com/mtgag> patch for decoding issues in PKIPublicationInfo and CertifiedKeyPair, patch for adding jurisdiction{C,ST,L} to X500 name style.
Andreas Gadermaier <up.gadermaier@gmail.com> initial version of Argon2 PBKDF algorithm.
-Tony Washer <tony.washer@yahoo.co.uk> review of qTesla, Java 1.9 module code, additional test code and debugging for GOST, DSTU, and ECNR algorithms. Initial lightweight implementation of the ZUC ciphers and macs. Additions to LMS/HSS API implementations, fix for truncation issue with big HSS keys, contributions to optimization of LMS/HSS. Patch for XDH/EdDSA key handling and mcEliece decryption using kobaraImai. Initial GCM-SIV, Blake3, and Kangaroo implementation.
+Tony Washer <https://github.com/tonywasher> ECIESKeyEncapsulation fix for use of OldCofactor mode. Submitted ChaCha20Poly1305 prototype. Remove support for maxXofLen in Kangaroo. Police Blake3 output limit. Add LEAEngine. Review of qTesla, Java 1.9 module code, additional test code and debugging for GOST, DSTU, and ECNR algorithms. Initial lightweight implementation of the ZUC ciphers and macs. Additions to LMS/HSS API implementations, fix for truncation issue with big HSS keys, contributions to optimization of LMS/HSS. Patch for XDH/EdDSA key handling and mcEliece decryption using kobaraImai. Initial GCM-SIV, Blake3, and Kangaroo implementation. Corrections to length outputs for getUpdateOutputSize()/doFinal() in ISAP, PhotonBeetle, and Xoodyak. Fix GCFB reset. Fix Elephant multi-part process. Fix AsconXof support multi-part outputs.
Vincent Bouckaert <https://github.com/veebee> initial version of RFC 4998 ASN.1 classes. Debugging and testing of high level RFC 4998 implementation.
-Tony Washer <https://github.com/tonywasher> ECIESKeyEncapsulation fix for use of OldCofactor mode. Submitted ChaCha20Poly1305 prototype. Remove support for maxXofLen in Kangaroo. Police Blake3 output limit. Add LEAEngine.
Aurimas Liutikas <https://github.com/liutikas> JavaDoc patches to ReasonsMask.
Gabriel Sroka <https://github.com/gabrielsroka> corrected comments in RSA validation.
sarah-mdv <https://github.com/sarah-mdv> improvements to JceKeyTransRecipientInfoGenerator, tests for JournalingSecureRandom, initial implementation of JournaledAlgorithm.
@@ -488,7 +487,7 @@
vvvlado <https://github.com/vvvlado> Fix to support repeated headers in PGP armored data.
a--v--k <https://github.com/a--v--k> Clean up for some invalid mappings in the Java provider.
lipnitsk <https://github.com/lipnitsk> Fix for non-CRT RSA Private serialisation.
-Niccolò Fontana <https://github.com/NicFontana> Initial fix for high-latency DTLS HelloVerifyRequest handshakes.
+Niccolò Fontana <https://github.com/NicFontana> Initial fix for high-latency DTLS HelloVerifyRequest handshakes.
sudheernv <https://github.com/sudheernv> Patch for KMAC rightEncode() encoding.
Mathias Neuhaus <https://github.com/mneuhaus-cv> Patch for cSHAKE extra padding on block aligned N and S bug.
Yuri Schimke <https://github.com/yschimke> Patch for nested exception handling in BcKeyStoreSpi.
@@ -529,7 +528,7 @@
Amazon AWS Security Team - isolation and identification of performance bottlenecks in the BC PEM parsing support.
Phillip Schichtel <https://github.com/pschichtel> - initial code for specifying wrapping algorithm with PGP PBE encryption method, forcing of session key usage.
Alexander Dippel <https://github.com/adippel> - corrections to prevent NPEs on chunked encoding of EST responses.
-Johann N. Löfflmann <https://github.com/jonelo> - fix to "too small" buffer issue in Blake2sp.
+Johann N. Löfflmann <https://github.com/jonelo> - fix to "too small" buffer issue in Blake2sp.
Scott Xu <https://github.com/scott-xu> - message fix in OpenSSHPublicKeyUtil
Scott Arciszewski <https://github/scottarc> - correction to ant scripts to ensure UTF8 support.
GitHub Security team - identification of the X509LDAPCertStoreSpi wildcard bug (see CVE-2023-33201).
@@ -541,6 +540,38 @@
Thomas Devanneaux <tdevanneaux@apple.com> - extensions to the HPKE API to support encryption/decryption from byte ranges, allow sender selected ephemeral key.
Norman Maurer <norman_maurer@apple.com> - extensions to the HPKE API to support encryption/decryption from byte ranges, allow sender selected ephemeral key.
Bing Shi <roadicing@gmail.com> - addition of F2m bounds checking for imported EC F2m curves.
+Phil Brown <https://github.com/brownp2k> - additional ant targets for building util and pkix.
+Tamas Cservenak <https://github.com/cstamas> - initial patch for supporting Ed25519 keys in GnuPG S-expressions.
+chchen-scholar <https://github.com/chchen-scholar> - encoding fix for EccP256CurvePoint, fix missing extension EtsiTs102941TypesAuthorization.InnerAtRequest
+Seung Yeon <https://github.com/seungyeonpark> - addition of Memoable method implementations to CertPathValidationContext and CertificatePoliciesValidation.
+yuhh0328 <https://github.com/yuhh0328> - initial patch for adding ML-KEM support to TLS.
+Jan Oupický <https://github.com/Honzaik> - update to draft 13 of composite PQC signatures, patch for human readable algorithm name for composite private keys.
+Karsten Otto <https://github.com/ottoka> - finished the support for jdk.tls.server.defaultDHEParameters.
+Markus Sommer <https://github.com/marsom> - BCStyle lookup table fix for jurisdiction values.
+Jared Crawford <https://github.com/jmcrawford45> - Abstracting cire KEM functionality out of DHKEM to allow for use of alternative KEMs with HPKE.
+TaZbon <https://github.com/TaZbon> - Optional lax parsing patch for PEM parser.
+han-ji <https://github.com/han-jl> - Fix to sign extension issue in CTR random seek code.
+https://github.com/crlorentzen <https://github.com/crlorentzen> - Addition of system property for configuring GCM ciphers in 1.2 FIPS mode in the JSSE.
+Jakub Zelenka <https://github.com/bukka> - Initial SMIMEAuthEnvelopedData classes.
+rde-infologic <https://github.com/rde-infologic> - Initial SMIMEEnvelopedUtil class.
+moonfruit <https://github.com/moonfruit> - Patch to allow for extensions of GMSignatureSpi.
+Marcono1234 <https://github.com/Marcono1234> - Updates to OpenBSDBCrypt JavaDoc.
+DawidM <https://github.com/dawmit> - Implementation of EC J-PAKE.
+Syed Quasim <https://github.com/HawkItzme> - lint checker fix for EST getTrustAllTrustManager().
+winfriedgerlach <https://github.com/winfriedgerlach> - patch to SecretKeyUtil class, patch to DigestFactory cloner for SHA-1, additional patches for dealing with ErrorProne warnings, Java language updates and improvements.
+feuxfollets1013 <https://github.com/feuxfollets1013> - Initial add JDK21 KEM API implementation for HQC algorithm.
+cragkhit <https://github.com/cragkhit> - addition of null check in some test utility methods to avoid needless exceptions.
+zhsnew <https://github.com/zhsnew> - correct AsconCXof128 implementation and add test vectors
+mt-johan <https://github.com/mt-johan> - patch to preserve PRF on initializing from protectionAlgorithm with PBMAC1.
+oscerd <https://github.com/oscerd> - comment corrections in GMSSRootSig.java.
+Léonard Dallot <leonard.dallot@taztag.com> - initial patches for GNU PG Divert to card format support.
+Linuka Ratnayake <https://github.com/linukaratnayake> - initial patches for including KEM-type algorithms in TLS key shares.
+Rune Flobakk <https://github.com/runeflobakk> - initial gradle mods for BOM (Bill of Materials) creation.
+Jon Marius Venstad <https://github.com/jonmv> - Fixed a KangarooTwelve padding bug caused by premature absorption of queued data.
+Lomig Mégard <https://github.com/lomigmegard> - BLAKE2 defensive improvements and cleanup.
+Prasanth Sundararajan <prasanth.srihari@gmail.com> - identification of the LDAPStoreHelper wildcard bug (see CVE-2023-33201).
+XlabAI Team of Tencent Xuanwu Lab, Atuin Automated Vulnerability Discovery Engine, Lili Tang, Guannan Wang, and Guancheng Li<xlabai@tencent.com> - detection of the DSTU4145 random number defect, correction of the G3413BlockCipher class (see CVE-2025-14813).
+stevemit <https://github.com/stevemit> - Identified incorrect tagging in the AuthEnvelopedData stream generator.