Skip to content

Commit 647b603

Browse files
committed
The jdk1.4 and jdk1.3 providers no longer register the AES256 PKCS12 KeyStore variants, which their PKCS12KeyStoreSpi does not implement.
1 parent 05958c2 commit 647b603

2 files changed

Lines changed: 54 additions & 0 deletions

File tree

‎docs/releasenotes.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ Date: 2026, TBD
7272

7373
- With org.bouncycastle.emulate.oracle set, the X25519 and X448 KeyAgreements took the name they report under it, XDH, for the algorithm itself: the unified agreements (X25519UwithSHA256KDF, X448UwithSHA512KDF and their CKDF forms) refused a DHUParameterSpec and ran as plain static agreements without one, and the curve specific agreements accepted a key on the other curve. The property now affects only the name used in exception messages.
7474

75+
- The jdk1.4 and jdk1.3 providers registered the PKCS12-AES256-AES128, PKCS12-AES256-AES128-GCM, PKCS12-DEF-AES256-AES128 and PKCS12-DEF-AES256-AES128-GCM KeyStores against classes those distributions do not contain. They are no longer registered there; the legacy PKCS12 stores can still read PBES2/AES protected files.
76+
7577
### 2.1.3 Additional Features and Functionality
7678

7779
- The CRMF certificate request message controls now include the RFC 4211 sec. 6.6 protocolEncrKey control, which names the key a CA is to encrypt its response with: org.bouncycastle.cert.crmf.ProtocolEncrKeyControl carries the SubjectPublicKeyInfo the control is defined to take, and CertificateRequestMessage.getControl() recognises id-regCtrl-protocolEncrKey alongside the regToken, authenticator and pkiArchiveOptions controls it already returned (github PR #2443).
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package org.bouncycastle.jcajce.provider.keystore;
2+
3+
import org.bouncycastle.jcajce.provider.config.ConfigurableProvider;
4+
import org.bouncycastle.jcajce.provider.util.AsymmetricAlgorithmProvider;
5+
import org.bouncycastle.util.Properties;
6+
7+
/**
8+
* NOTE: this overlay exists because the jdk1.4 (and, by layering, jdk1.3) PKCS12KeyStoreSpi
9+
* overlays do not implement the AES256 store variants, so the PKCS12-AES256-AES128(-GCM) and
10+
* PKCS12-DEF-AES256-AES128(-GCM) registrations of the base class are left out here - they would
11+
* name classes that do not exist. The legacy stores can still read PBES2/AES protected files.
12+
* Keep everything else in step with the base PKCS12.java.
13+
*/
14+
public class PKCS12
15+
{
16+
private static final String PREFIX = "org.bouncycastle.jcajce.provider.keystore" + ".pkcs12.";
17+
18+
public static class Mappings
19+
extends AsymmetricAlgorithmProvider
20+
{
21+
public Mappings()
22+
{
23+
}
24+
25+
public void configure(ConfigurableProvider provider)
26+
{
27+
String defType = Properties.getPropertyValue("org.bouncycastle.pkcs12.default");
28+
29+
if (defType != null)
30+
{
31+
provider.addAlgorithm("Alg.Alias.KeyStore.PKCS12", defType);
32+
provider.addAlgorithm("Alg.Alias.KeyStore.BCPKCS12", defType);
33+
provider.addAlgorithm("Alg.Alias.KeyStore.PKCS12-DEF", defType.substring(0, 5) + "-DEF" + defType.substring(6));
34+
}
35+
else
36+
{
37+
provider.addAlgorithm("KeyStore.PKCS12", PREFIX + "PKCS12KeyStoreSpi$BCPKCS12KeyStore");
38+
provider.addAlgorithm("KeyStore.BCPKCS12", PREFIX + "PKCS12KeyStoreSpi$BCPKCS12KeyStore");
39+
provider.addAlgorithm("KeyStore.PKCS12-DEF", PREFIX + "PKCS12KeyStoreSpi$DefPKCS12KeyStore");
40+
}
41+
42+
provider.addAlgorithm("KeyStore.PKCS12-3DES-40RC2", PREFIX + "PKCS12KeyStoreSpi$BCPKCS12KeyStore");
43+
provider.addAlgorithm("KeyStore.PKCS12-3DES-3DES", PREFIX + "PKCS12KeyStoreSpi$BCPKCS12KeyStore3DES");
44+
45+
provider.addAlgorithm("KeyStore.PKCS12-DEF-3DES-40RC2", PREFIX + "PKCS12KeyStoreSpi$DefPKCS12KeyStore");
46+
provider.addAlgorithm("KeyStore.PKCS12-DEF-3DES-3DES", PREFIX + "PKCS12KeyStoreSpi$DefPKCS12KeyStore3DES");
47+
48+
provider.addAlgorithm("KeyStore.PKCS12-PBMAC1", PREFIX + "PKCS12PBMAC1KeyStoreSpi$BCPKCS12KeyStore");
49+
50+
}
51+
}
52+
}

0 commit comments

Comments
 (0)