Skip to content

Commit 3b7c94f

Browse files
author
gefeili
committed
Merge branch 'main' into 1794-auth-enveloped-recipients-kek-keyagree
2 parents f8561f6 + decbe39 commit 3b7c94f

File tree

502 files changed

+21073
-9428
lines changed

Some content is hidden

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

502 files changed

+21073
-9428
lines changed

.gitlab-ci.yml

Lines changed: 7 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ stages:
22
- check
33
- build
44
- test
5+
- publish
56
- sync
67

78
check-code:
@@ -31,13 +32,13 @@ ant-build:
3132
- "ci_docker_run \"vm_base_intel:latest\" \"bc-java\" \"/workspace/bc-java/ci/build_1_8.sh\""
3233

3334

34-
test-code-8:
35+
test-code:
3536
stage: test
3637
needs: [ "check-code" ]
3738
script:
3839
- "ecr_login"
3940
- "ecr_pull vm_base_intel latest"
40-
- "ci_docker_run \"vm_base_intel:latest\" \"bc-java\" \"/workspace/bc-java/ci/test_8.sh\""
41+
- "ci_docker_run \"vm_base_intel:latest\" \"bc-java\" \"/workspace/bc-java/ci/test.sh\""
4142
artifacts:
4243
when: always
4344
reports:
@@ -51,68 +52,14 @@ test-code-8:
5152
- "tls/build/test-results/**/*.xml"
5253
- "mls/build/test-results/**/*.xml"
5354

54-
test-code-11:
55-
stage: test
56-
needs: [ "check-code" ]
57-
script:
58-
- "ecr_login"
59-
- "ecr_pull vm_base_intel latest"
60-
- "ci_docker_run \"vm_base_intel:latest\" \"bc-java\" \"/workspace/bc-java/ci/test_11.sh\""
61-
artifacts:
62-
when: always
63-
reports:
64-
junit:
65-
- "core/build/test-results/**/*.xml"
66-
- "prov/build/test-results/**/*.xml"
67-
- "pg/build/test-results/**/*.xml"
68-
- "pkix/build/test-results/**/*.xml"
69-
- "mail/build/test-results/**/*.xml"
70-
- "util/build/test-results/**/*.xml"
71-
- "tls/build/test-results/**/*.xml"
72-
- "mls/build/test-results/**/*.xml"
73-
74-
75-
test-code-17:
76-
stage: test
77-
needs: [ "check-code" ]
78-
script:
79-
- "ecr_login"
80-
- "ecr_pull vm_base_intel latest"
81-
- "ci_docker_run \"vm_base_intel:latest\" \"bc-java\" \"/workspace/bc-java/ci/test_17.sh\""
82-
artifacts:
83-
when: always
84-
reports:
85-
junit:
86-
- "core/build/test-results/**/*.xml"
87-
- "prov/build/test-results/**/*.xml"
88-
- "pg/build/test-results/**/*.xml"
89-
- "pkix/build/test-results/**/*.xml"
90-
- "mail/build/test-results/**/*.xml"
91-
- "util/build/test-results/**/*.xml"
92-
- "tls/build/test-results/**/*.xml"
93-
- "mls/build/test-results/**/*.xml"
9455

95-
96-
test-code-21:
97-
stage: test
98-
needs: [ "check-code" ]
56+
publish:
57+
stage: publish
9958
script:
59+
- "apply_overlay bc-java-pub ./"
10060
- "ecr_login"
10161
- "ecr_pull vm_base_intel latest"
102-
- "ci_docker_run \"vm_base_intel:latest\" \"bc-java\" \"/workspace/bc-java/ci/test_21.sh\""
103-
artifacts:
104-
when: always
105-
reports:
106-
junit:
107-
- "core/build/test-results/**/*.xml"
108-
- "prov/build/test-results/**/*.xml"
109-
- "pg/build/test-results/**/*.xml"
110-
- "pkix/build/test-results/**/*.xml"
111-
- "mail/build/test-results/**/*.xml"
112-
- "util/build/test-results/**/*.xml"
113-
- "tls/build/test-results/**/*.xml"
114-
- "mls/build/test-results/**/*.xml"
115-
62+
- "ci_docker_run \"vm_base_intel:latest\" \"bc-java\" \"/workspace/bc-java/ci/pub.sh\""
11663

11764
spongycastle:
11865
stage: "sync"

CONTRIBUTORS.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@
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, 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>
@@ -549,8 +549,10 @@
549549
<li>Jan Oupick&yacute; &lt;https://github.com/Honzaik&gt; - update to draft 13 of composite PQC signatures.</li>
550550
<li>Karsten Otto &lt;https://github.com/ottoka&gt; - finished the support for jdk.tls.server.defaultDHEParameters.</li>
551551
<li>Markus Sommer &lt;https://github.com/marsom&gt; - BCStyle lookup table fix for jurisdiction values.</li>
552+
<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>
552553
<li>TaZbon &lt;https://github.com/TaZbon&gt; - Optional lax parsing patch for PEM parser.</li>
553554
<li>han-ji &lt;https://github.com/han-jl&gt; - Fix to sign extension issue in CTR random seek code.</li>
555+
<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>
554556
</ul>
555557
</body>
556558
</html>

README.md

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,39 @@ Except where otherwise stated, this software is distributed under a license base
1010

1111
**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 [[email protected]](mailto:[email protected]).
1212

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.
1337

1438
## Environmental Variables
1539

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

1942
```
2043
export BC_JDK8=/path/to/java8
2144
export BC_JDK11=/path/to/java11
2245
export BC_JDK17=/path/to/java17
23-
export BC_JDK21=/path/to/java21
2446
```
2547

2648
## Building
@@ -30,7 +52,8 @@ The project now uses ```gradlew``` which can be invoked for example:
3052
```
3153
# from the root of the project
3254
33-
# 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.
3457
3558
3659
./gradlew clean build
@@ -41,19 +64,17 @@ The gradle script will endeavour to verify their existence but not the correctne
4164

4265

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

69+
If the env vars are defined:
5370
```
54-
./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
5574
```
5675

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

5879
## Code Organisation
5980

ant/bc+-build.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@
10121012
<property name="test.target.src.dir" value="${test.target.dir}/src" />
10131013

10141014
<mkdir dir="${basedir}/${build.dir}/${target.prefix}" />
1015-
<junit fork="yes" dir="${basedir}/${build.dir}/${target.prefix}" failureProperty="test.failed" printsummary="${junit.printsummary}">
1015+
<junit fork="yes" dir="${basedir}/${build.dir}/${target.prefix}" failureProperty="test.failed" printsummary="${junit.printsummary}" maxmemory="${junit.maxmemory}">
10161016
<classpath>
10171017
<path refid="project.classpath" />
10181018
<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

ant/jdk13.xml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<property name="artifacts.dir" value="${build.dir}/artifacts/${jdk.name}" />
1414
<property name="target.prefix" value="jdk13" />
1515
<property name="javadoc.args" value="-protected" />
16+
<property name="junit.maxmemory" value="1536m" />
1617

1718
<target name="init">
1819
<mkdir dir="${src.dir}" />
@@ -55,6 +56,7 @@
5556
<exclude name="**/asymmetric/dstu/*.java" />
5657
<exclude name="**/Logging*.java" />
5758
<exclude name="**/provider/config/PKCS12StoreParameter.java" />
59+
<exclude name="**/COMPOSITE.java"/>
5860
<exclude name="**/gemss/*.java"/>
5961
<exclude name="**/rainbow/*.java"/>
6062
<exclude name="**/Rainbow*.java"/>
@@ -89,6 +91,7 @@
8991
<exclude name="**/gemss/*.java" />
9092
<exclude name="**/CertPathReviewer*.java" />
9193
<exclude name="**/PKIXCertPathReviewer.java" />
94+
<exclude name="**/COMPOSITE.java"/>
9295
<exclude name="**/PKIXAttrCert*.java" />
9396
<exclude name="**/PKIXNameConstraints*.java" />
9497
<exclude name="**/PKCS12StoreParameter.java" />
@@ -248,6 +251,7 @@
248251
<exclude name="**/jce/provider/test/CertLocaleTest.java" />
249252
</fileset>
250253
<fileset dir="pkix/src/test/java">
254+
<exclude name="**/CheckNameConstraintsTest.java"/>
251255
<exclude name="**/pkix/test/RevocationTest.java"/>
252256
<exclude name="**/SunProviderTest.java" />
253257
<exclude name="**/NullProviderTest.java" />
@@ -328,19 +332,29 @@
328332

329333
<replaceregexp match="${regexp}" replace=" " flags="g" byline="true">
330334
<fileset dir="${src.dir}">
331-
<include name="**/*.java"/>
335+
<include name="**/*.java"/>
336+
<exclude name="**/SICBlockCipher.java"/>
332337
</fileset>
333338
</replaceregexp>
334339
<replaceregexp match="(List|Map|Set) >" replace="\1" flags="g" byline="true">
335340
<fileset dir="${src.dir}">
336341
<include name="**/*.java"/>
337342
<exclude name="**/MultipartParserTest.java"/>
343+
<exclude name="**/SICBlockCipher.java"/>
344+
</fileset>
345+
</replaceregexp>
346+
<replaceregexp match="StringBuilder" replace="StringBuffer" flags="g" byline="true">
347+
<fileset dir="${src.dir}">
348+
<include name="**/*.java"/>
349+
<exclude name="**/MultipartParserTest.java"/>
350+
<exclude name="**/SICBlockCipher.java"/>
338351
</fileset>
339352
</replaceregexp>
340353
<replaceregexp match="LinkedHashSet" replace="HashSet" flags="g" byline="true">
341354
<fileset dir="${src.dir}">
342355
<include name="**/*.java"/>
343356
<exclude name="**/MultipartParserTest.java"/>
357+
<exclude name="**/SICBlockCipher.java"/>
344358
</fileset>
345359
</replaceregexp>
346360
<replaceregexp match="\.\.\." replace="[]" flags="g" byline="true">

ant/jdk14.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<property name="artifacts.dir" value="${build.dir}/artifacts/${jdk.name}"/>
1313
<property name="target.prefix" value="jdk14"/>
1414
<property name="javadoc.args" value="-breakiterator"/>
15+
<property name="junit.maxmemory" value="1536m" />
1516

1617
<target name="init">
1718
<mkdir dir="${src.dir}"/>
@@ -77,6 +78,7 @@
7778
<exclude name="**/JDKPKCS12StoreParameter.java"/>
7879
<exclude name="**/SIKE*.java"/>
7980
<exclude name="**/CompositeSign*.java"/>
81+
<exclude name="**/COMPOSITE*.java"/>
8082
<exclude name="**/rainbow/*.java"/>
8183
<exclude name="**/Rainbow*.java"/>
8284
<exclude name="**/XMS*.java"/>
@@ -131,6 +133,9 @@
131133
<exclude name="**/keybox/**/*.java"/>
132134
<exclude name="**/gpg/test/*.java"/>
133135
<exclude name="**/BcImplProviderTest.java"/>
136+
<exclude name="**/OperatorJcajceTest.java"/>
137+
<exclude name="**/AEADWithArgon2Test.java"/>
138+
<exclude name="**/AEADProtectedPGPSecretKeyTest.java"/>
134139
</fileset>
135140
<fileset dir="pkix/src/test/java">
136141
<exclude name="**/est/**/*.java"/>
@@ -142,6 +147,7 @@
142147
<exclude name="**/bouncycastle/cms/test/*AuthEnvelopedData*Test.java"/>
143148
<exclude name="**/PKIXRevocationTest.java"/>
144149
<exclude name="**/its/**/*.java"/>
150+
<exclude name="**/CheckNameConstraintsTest.java"/>
145151
</fileset>
146152
<fileset dir="mail/src/test/java">
147153
<exclude name="**/MailGeneralTest.java"/>
@@ -224,6 +230,13 @@
224230
</copy>
225231

226232
<replaceregexp match="${regexp}" replace=" " flags="g" byline="true">
233+
<fileset dir="${src.dir}">
234+
<include name="**/*.java"/>
235+
<exclude name="**/SICBlockCipher.java"/>
236+
<exclude name="**/MultipartParserTest.java"/>
237+
</fileset>
238+
</replaceregexp>
239+
<replaceregexp match="StringBuilder" replace="StringBuffer" flags="g" byline="true">
227240
<fileset dir="${src.dir}">
228241
<include name="**/*.java"/>
229242
<exclude name="**/MultipartParserTest.java"/>
@@ -232,6 +245,7 @@
232245
<replaceregexp match="(List|Map|Set|Iterator) >" replace="\1" flags="g" byline="true">
233246
<fileset dir="${src.dir}">
234247
<include name="**/*.java"/>
248+
<exclude name="**/SICBlockCipher.java"/>
235249
<exclude name="**/MultipartParserTest.java"/>
236250
</fileset>
237251
</replaceregexp>

ant/jdk15+.xml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
<property name="src.dir" value="${build.dir}/${jdk.name}" />
1111
<property name="target.prefix" value="jdk15to18" />
1212
<property name="javadoc.args" value="-breakiterator" />
13+
<property name="jmail.present" value="true" />
14+
<property name="junit.maxmemory" value="1536m" />
1315

1416
<target name="clean">
1517
<delete dir="${build.dir}" />
@@ -39,22 +41,18 @@
3941
<fileset dir="prov/src/test/resources" includes="**/*.*" />
4042

4143
<fileset dir="tls/src/main/java" includes="**/*.java" />
42-
<fileset dir="tls/src/main/jdk1.5" includes="**/*.java" />
4344
<fileset dir="tls/src/main/javadoc" includes="**/*.html" />
4445
<fileset dir="tls/src/test/java" includes="**/*.java" />
45-
<fileset dir="tls/src/test/jdk1.5" includes="**/*.java" />
4646
<fileset dir="tls/src/test/resources" includes="**/*.*" />
4747

4848
<fileset dir="pkix/src/main/java" includes="**/*.java" />
49-
<fileset dir="pkix/src/main/jdk1.5" includes="**/*.java" />
5049
<fileset dir="pkix/src/main/javadoc" includes="**/*.html" />
5150
<fileset dir="pkix/src/main/resources" includes="**/*.properties" />
5251
<fileset dir="pkix/src/test/java" includes="**/*.java" />
5352
<fileset dir="pkix/src/test/javadoc" includes="**/*.html" />
5453
<fileset dir="pkix/src/test/resources" includes="**/*.*" />
5554

5655
<fileset dir="pg/src/main/java" includes="**/*.java" />
57-
<fileset dir="pg/src/main/jdk1.5" includes="**/*.java" />
5856
<fileset dir="pg/src/main/javadoc" includes="**/*.html" />
5957
<fileset dir="pg/src/main/java" includes="**/*.properties" />
6058
<fileset dir="pg/src/test/java" includes="**/*.java" />
@@ -74,6 +72,14 @@
7472
<fileset dir="mail/src/test/resources" includes="**/*.*" />
7573

7674
</copy>
75+
<copy todir="${src.dir}" overwrite="true">
76+
<fileset dir="pkix/src/main/jdk1.5" includes="**/*.java" />
77+
<fileset dir="tls/src/main/jdk1.5" includes="**/*.java" />
78+
<fileset dir="tls/src/test/jdk1.5" includes="**/*.java" />
79+
<fileset dir="pg/src/main/jdk1.5" includes="**/*.java" />
80+
<fileset dir="pg/src/test/jdk1.5" includes="**/*.java" />
81+
</copy>
82+
7783
<available classname="com.puppycrawl.tools.checkstyle.CheckStyleTask" property="checkstyle.on" />
7884
</target>
7985

0 commit comments

Comments
 (0)