Skip to content

Commit 631757d

Browse files
author
royb
committed
Merge branch 'refs/heads/main' into x9.146-wolfssl-interop
# Conflicts: # tls/src/main/java/org/bouncycastle/tls/SignatureScheme.java # tls/src/main/java/org/bouncycastle/tls/crypto/impl/bc/BcDefaultTlsCredentialedSigner.java # tls/src/main/java/org/bouncycastle/tls/crypto/impl/bc/BcTlsRawKeyCertificate.java
2 parents cd8f726 + b77d970 commit 631757d

1,219 files changed

Lines changed: 71601 additions & 17075 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ jobs:
6767
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
6868

6969
# - run: |
70-
echo "Run, Build Application using script"
71-
gradle clean build
70+
# echo "Run, Build Application using script"
71+
# gradle clean build
7272

7373
- name: Perform CodeQL Analysis
7474
uses: github/codeql-action/analyze@v2

.gitlab-ci.yml

Lines changed: 11 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ stages:
22
- check
33
- build
44
- test
5+
- publish
6+
- sync
57

68
check-code:
79
stage: check
@@ -30,33 +32,13 @@ ant-build:
3032
- "ci_docker_run \"vm_base_intel:latest\" \"bc-java\" \"/workspace/bc-java/ci/build_1_8.sh\""
3133

3234

33-
test-code-8:
35+
test-code:
3436
stage: test
3537
needs: [ "check-code" ]
3638
script:
3739
- "ecr_login"
3840
- "ecr_pull vm_base_intel latest"
39-
- "ci_docker_run \"vm_base_intel:latest\" \"bc-java\" \"/workspace/bc-java/ci/test_8.sh\""
40-
artifacts:
41-
when: always
42-
reports:
43-
junit:
44-
- "core/build/test-results/**/*.xml"
45-
- "prov/build/test-results/**/*.xml"
46-
- "pg/build/test-results/**/*.xml"
47-
- "pkix/build/test-results/**/*.xml"
48-
- "mail/build/test-results/**/*.xml"
49-
- "util/build/test-results/**/*.xml"
50-
- "tls/build/test-results/**/*.xml"
51-
- "mls/build/test-results/**/*.xml"
52-
53-
test-code-11:
54-
stage: test
55-
needs: [ "check-code" ]
56-
script:
57-
- "ecr_login"
58-
- "ecr_pull vm_base_intel latest"
59-
- "ci_docker_run \"vm_base_intel:latest\" \"bc-java\" \"/workspace/bc-java/ci/test_11.sh\""
41+
- "ci_docker_run \"vm_base_intel:latest\" \"bc-java\" \"/workspace/bc-java/ci/test.sh\""
6042
artifacts:
6143
when: always
6244
reports:
@@ -71,43 +53,15 @@ test-code-11:
7153
- "mls/build/test-results/**/*.xml"
7254

7355

74-
test-code-17:
75-
stage: test
76-
needs: [ "check-code" ]
56+
publish:
57+
stage: publish
7758
script:
59+
- "apply_overlay bc-java-pub ./"
7860
- "ecr_login"
7961
- "ecr_pull vm_base_intel latest"
80-
- "ci_docker_run \"vm_base_intel:latest\" \"bc-java\" \"/workspace/bc-java/ci/test_17.sh\""
81-
artifacts:
82-
when: always
83-
reports:
84-
junit:
85-
- "core/build/test-results/**/*.xml"
86-
- "prov/build/test-results/**/*.xml"
87-
- "pg/build/test-results/**/*.xml"
88-
- "pkix/build/test-results/**/*.xml"
89-
- "mail/build/test-results/**/*.xml"
90-
- "util/build/test-results/**/*.xml"
91-
- "tls/build/test-results/**/*.xml"
92-
- "mls/build/test-results/**/*.xml"
93-
62+
- "ci_docker_run \"vm_base_intel:latest\" \"bc-java\" \"/workspace/bc-java/ci/pub.sh\""
9463

95-
test-code-21:
96-
stage: test
97-
needs: [ "check-code" ]
64+
spongycastle:
65+
stage: "sync"
9866
script:
99-
- "ecr_login"
100-
- "ecr_pull vm_base_intel latest"
101-
- "ci_docker_run \"vm_base_intel:latest\" \"bc-java\" \"/workspace/bc-java/ci/test_21.sh\""
102-
artifacts:
103-
when: always
104-
reports:
105-
junit:
106-
- "core/build/test-results/**/*.xml"
107-
- "prov/build/test-results/**/*.xml"
108-
- "pg/build/test-results/**/*.xml"
109-
- "pkix/build/test-results/**/*.xml"
110-
- "mail/build/test-results/**/*.xml"
111-
- "util/build/test-results/**/*.xml"
112-
- "tls/build/test-results/**/*.xml"
113-
- "mls/build/test-results/**/*.xml"
67+
- "syncpongy.sh"

CONTRIBUTORS.html

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -447,16 +447,15 @@
447447
<li>Adam Vartanian &lt;https://github.com/flooey&gt; use of ShortBuffer exception and buffer size pre-check in Cipher.doFinal().</li>
448448
<li>Bernd &lt;https://github.com/ecki&gt; Fix to make PGPUtil.pipeFileContents use buffer and not leak file handle.</li>
449449
<li>Shartung &lt;https://github.com/shartung&gt; Additional EC Key Agreement algorithms in support of German BSI TR-03111.</li>
450-
<li>Paul Schaub &lt;https://github.com/vanitasvitae&gt; 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.</li>
450+
<li>Paul Schaub &lt;https://github.com/vanitasvitae&gt; 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.</li>
451451
<li>Nick of Nexxar &lt;https://github.com/nros&gt; update to OpenPGP package to handle a broader range of EC curves.</li>
452452
<li>catbref &lt;https://github.com/catbref&gt; sample implementation of RFC 7748/Ed25519 (incorporated work from github users Valodim and str4d as well).</li>
453453
<li>gerlion &lt;https://github.com/gerlion&gt; detection of concurrency issue with pre-1.60 EC math library.</li>
454454
<li>fgrieu &lt;fgrieu&#064gmail.com&gt; identification and suggested fixes for possible timing vulnerability in OAEPEncoding and RSACoreEngine.</li>
455455
<li>MTG &lt;https://github.com/mtgag&gt; patch for decoding issues in PKIPublicationInfo and CertifiedKeyPair, patch for adding jurisdiction{C,ST,L} to X500 name style.</li>
456456
<li>Andreas Gadermaier &lt;up.gadermaier&#064gmail.com&gt; initial version of Argon2 PBKDF algorithm.</li>
457-
<li>Tony Washer &lt;tony.washer&#64yahoo.co.uk&gt; 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.</li>
457+
<li>Tony Washer &lt;https://github.com/tonywasher&gt; 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.</li>
458458
<li>Vincent Bouckaert &lt;https://github.com/veebee&gt; initial version of RFC 4998 ASN.1 classes. Debugging and testing of high level RFC 4998 implementation.</li>
459-
<li>Tony Washer &lt;https://github.com/tonywasher&gt; ECIESKeyEncapsulation fix for use of OldCofactor mode. Submitted ChaCha20Poly1305 prototype. Remove support for maxXofLen in Kangaroo. Police Blake3 output limit. Add LEAEngine.</li>
460459
<li>Aurimas Liutikas &lt;https://github.com/liutikas&gt; JavaDoc patches to ReasonsMask.</li>
461460
<li>Gabriel Sroka &lt;https://github.com/gabrielsroka&gt; corrected comments in RSA validation.</li>
462461
<li>sarah-mdv &lt;https://github.com/sarah-mdv&gt; improvements to JceKeyTransRecipientInfoGenerator, tests for JournalingSecureRandom, initial implementation of JournaledAlgorithm.</li>
@@ -543,11 +542,21 @@
543542
<li>Bing Shi &lt;roadicing&#064gmail.com&gt; - addition of F2m bounds checking for imported EC F2m curves.</li>
544543
<li>Phil Brown &lt;https://github.com/brownp2k&gt; - additional ant targets for building util and pkix.</li>
545544
<li>Tamas Cservenak &lt;https://github.com/cstamas&gt; - initial patch for supporting Ed25519 keys in GnuPG S-expressions.</li>
546-
<li>chchen-scholar &lt;https://github.com/chchen-scholar&gt; - encoding fix for EccP256CurvePoint.</li>
545+
<li>chchen-scholar &lt;https://github.com/chchen-scholar&gt; - encoding fix for EccP256CurvePoint, fix missing extension EtsiTs102941TypesAuthorization.InnerAtRequest</li>
547546
<li>Seung Yeon &lt;https://github.com/seungyeonpark&gt; - addition of Memoable method implementations to CertPathValidationContext and CertificatePoliciesValidation.</li>
548547
<li>yuhh0328 &lt;https://github.com/yuhh0328&gt; - initial patch for adding ML-KEM support to TLS.</li>
549-
<li>Jan Oupick&yacute; &lt;https://github.com/Honzaik&gt; - update to draft 13 of composite PQC signatures.</li>
548+
<li>Jan Oupick&yacute; &lt;https://github.com/Honzaik&gt; - update to draft 13 of composite PQC signatures, patch for human readable algorithm name for composite private keys.</li>
550549
<li>Karsten Otto &lt;https://github.com/ottoka&gt; - finished the support for jdk.tls.server.defaultDHEParameters.</li>
550+
<li>Markus Sommer &lt;https://github.com/marsom&gt; - BCStyle lookup table fix for jurisdiction values.</li>
551+
<li>Jared Crawford &lt;https://github.com/jmcrawford45&gt; - Abstracting cire KEM functionality out of DHKEM to allow for use of alternative KEMs with HPKE.</li>
552+
<li>TaZbon &lt;https://github.com/TaZbon&gt; - Optional lax parsing patch for PEM parser.</li>
553+
<li>han-ji &lt;https://github.com/han-jl&gt; - Fix to sign extension issue in CTR random seek code.</li>
554+
<li>https://github.com/crlorentzen &lt;https://github.com/crlorentzen&gt; - Addition of system property for configuring GCM ciphers in 1.2 FIPS mode in the JSSE.</li>
555+
<li>Jakub Zelenka &lt;https://github.com/bukka&gt; - Initial SMIMEAuthEnvelopedData classes.</li>
556+
<li>rde-infologic &lt;https://github.com/rde-infologic&gt; - Initial SMIMEEnvelopedUtil class.</li>
557+
<li>moonfruit &lt;https://github.com/moonfruit&gt; - Patch to allow for extensions of GMSignatureSpi.</li>
558+
<li>Marcono1234 &lt;https://github.com/Marcono1234&gt; - Updates to OpenBSDBCrypt JavaDoc.</li>
559+
<li>DawidM &lt;https://github.com/dawmit&gt; - Implementation of EC J-PAKE.</li>
551560
</ul>
552561
</body>
553562
</html>

README.md

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# The Bouncy Castle Crypto Package For Java
22

3-
[![Build Status](https://travis-ci.org/bcgit/bc-java.svg?branch=master)](https://travis-ci.org/bcgit/bc-java)
4-
53
The Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms, it was developed by the Legion of the Bouncy Castle, a registered Australian Charity, with a little help! The Legion, and the latest goings on with this package, can be found at [https://www.bouncycastle.org](https://www.bouncycastle.org).
64

75
The Legion also gratefully acknowledges the contributions made to this package by others (see [here](https://www.bouncycastle.org/contributors.html) for the current list). If you would like to contribute to our efforts please feel free to get in touch with us or visit our [donations page](https://www.bouncycastle.org/donate), sponsor some specific work, or purchase a support contract through [Crypto Workshop](https://www.keyfactor.com/platform/bouncy-castle-support/) (now part of Keyfactor).
@@ -12,17 +10,39 @@ Except where otherwise stated, this software is distributed under a license base
1210

1311
**Note**: this source tree is not the FIPS version of the APIs - if you are interested in our FIPS version please contact us directly at [office@bouncycastle.org](mailto:office@bouncycastle.org).
1412

13+
## Maven Public Key
14+
15+
The file [bc_maven_public_key.asc](bc_maven_public_key.asc) contains the public key used to sign our artifacts on Maven Central. You will need to use
16+
17+
```
18+
gpg -o bc_maven_public_key.gpg --dearmor bc_maven_public_key.asc
19+
```
20+
21+
to dearmor the key before use. Once that is done, a file can be verified by using:
22+
23+
```
24+
gpg --no-default-keyring --keyring ./bc_maven_public_key.gpg --verify file_name.jar.asc file_name.jar
25+
```
26+
27+
Note: the ./ is required in front of the key file name to tell gpg to look locally.
28+
29+
## Building overview
30+
31+
This project can now be built and tested with JDK21.
32+
33+
If the build script detects BC_JDK8, BC_JDK11, BC_JDK17 it will add to the usual test task a dependency on test tasks
34+
that specifically use the JVMs addressed by those environmental variables. The script relies on JAVA_HOME for picking up Java 21 if it is use.
35+
36+
We support testing on specific JVMs as it is the only way to be certain the library is compatible.
1537

1638
## Environmental Variables
1739

18-
Before invoking gradlew you need to ensure the following environmental variables are defined and point
19-
to valid JAVA_HOMEs for each JVM version:
40+
The following environmental variables can optionally point to the JAVA_HOME for each JVM version.
2041

2142
```
2243
export BC_JDK8=/path/to/java8
2344
export BC_JDK11=/path/to/java11
2445
export BC_JDK17=/path/to/java17
25-
export BC_JDK21=/path/to/java21
2646
```
2747

2848
## Building
@@ -32,7 +52,8 @@ The project now uses ```gradlew``` which can be invoked for example:
3252
```
3353
# from the root of the project
3454
35-
# Ensure JAVA_HOME points to JDK 17 or higher JAVA_HOME
55+
# Ensure JAVA_HOME points to JDK 21 or higher JAVA_HOME or that
56+
# gradlew can find a java 21 installation to use.
3657
3758
3859
./gradlew clean build
@@ -43,19 +64,17 @@ The gradle script will endeavour to verify their existence but not the correctne
4364

4465

4566
## Multi-release jars and testing
46-
Some subprojects produce multi-release jars and these jars are tested in different jvm versions.
47-
Default testing on these projects is done on java 1.8 and there are specific test tasks for other versions.
48-
49-
1. test11 test on java 11 JVM
50-
2. test17 test on java 17 JVM
51-
3. test21 test on java 21 JVM
52-
53-
To run all of them:
67+
Some subprojects produce multi-release jars and these jars are can be tested on different jvm versions specifically.
5468

69+
If the env vars are defined:
5570
```
56-
./gradlew clean build test11 test17 test21
71+
export BC_JDK8=/path/to/java8
72+
export BC_JDK11=/path/to/java11
73+
export BC_JDK17=/path/to/java17
5774
```
5875

76+
If only a Java 21 JDK is present then the normal test task and test21 are run only.
77+
5978

6079
## Code Organisation
6180

ant/bc+-build.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@
302302
<include name="org/bouncycastle/util/**/*.java" />
303303
<include name="org/bouncycastle/asn1/**/*.java" />
304304
<include name="org/bouncycastle/internal/**/*.java" />
305+
<exclude name="org/bouncycastle/test/AllTests.java" />
305306
<include name="org/bouncycastle/test/*.java" />
306307
<include name="org/bouncycastle/pqc/legacy/**/*.java" />
307308
<include name="org/bouncycastle/pqc/crypto/**/*.java" />
@@ -1012,7 +1013,7 @@
10121013
<property name="test.target.src.dir" value="${test.target.dir}/src" />
10131014

10141015
<mkdir dir="${basedir}/${build.dir}/${target.prefix}" />
1015-
<junit fork="yes" dir="${basedir}/${build.dir}/${target.prefix}" failureProperty="test.failed" printsummary="${junit.printsummary}">
1016+
<junit fork="yes" dir="${basedir}/${build.dir}/${target.prefix}" failureProperty="test.failed" printsummary="${junit.printsummary}" maxmemory="${junit.maxmemory}">
10161017
<classpath>
10171018
<path refid="project.classpath" />
10181019
<fileset dir="${artifacts.jars.dir}">

ant/build.regexp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

2-
regexp: <List<PGPSignature>>|<Map<CertID, OCSPResponse>>|<URI[^>]*>>|<[A-Z?][^>@]*[a-zA-Z0-9\\]]>|<[A-Z]>|<[a-z][^>@]*[a-z\\]]>|@SuppressWarnings(.*)|@Override|@Deprecated|@FunctionalInterface
2+
regexp: <List<PGPSignature>>|<Map<CertID, OCSPResponse>>|<URI[^>]*\\>>|<[A-Z?][^>@]*[a-zA-Z0-9\\]]>|<[A-Z]>|<[a-z][^>@]*[a-z\\]]>|@SuppressWarnings(.*)|@Override|@Deprecated|@FunctionalInterface
33

0 commit comments

Comments
 (0)