Skip to content

Commit 75de1b6

Browse files
committed
The PKCS12-DEF-AES256-AES128(-GCM) KeyStores now use the default JCA provider search rather than BC, and PKCS12-AES256-AES128(-GCM) are registered to the BC implementations.
1 parent 74c837a commit 75de1b6

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎docs/releasenotes.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ Date: 2026, TBD
6666
- The light-weight CryptoProWrapEngine (RFC 4357 sec. 6.3) diversified the key encryption key in the caller's own array, so after init the KeyParameter it was given held the diversified key, and initialising again with the same parameters - to unwrap what had just been wrapped, say - diversified it a second time and used a different key. It also failed with a NullPointerException when given no S-box, although init has a branch for that case. It now diversifies a copy, and given no S-box uses the GOST 28147 engine's default S-box for the diversification, the one the wrap itself then uses. The provider's GOST 28147 key wrap ciphers were unaffected, as they always supply an S-box and build a new KeyParameter on every init.
6767
- A UserKeyingMaterialSpec carrying a KDF salt was accepted by every KeyAgreement that takes one, although only the HKDF based agreements (X25519withSHA256HKDF, X448withSHA512HKDF and the RFC 8418 XDHwithSHA\*HKDF schemes) use a salt: the X9.63 and concatenation KDF agreements for EC, DH and XDH, and the ECGOST VKO agreements, derived their key without it and gave no sign of having done so. A salt given to any agreement whose KDF is not HKDF is now refused at init with an InvalidAlgorithmParameterException.
6868
- The light-weight ConcatenationKDFGenerator (NIST SP 800-56A concatenation KDF) threw NullPointerException from generateBytes when its KDFParameters carried no OtherInfo, although KDFParameters documents the additional input as optional and KDF1 and KDF2 already treated a null one as empty. Every provider key agreement over it that was given no user keying material hit it: ECCDHwithSHA\*CKDF initialised without a UserKeyingMaterialSpec, and ECCDHUwithSHA\*CKDF, ECMQVwithSHA\*CKDF, DHUwithSHA\*CKDF and MQVwithSHA\*CKDF initialised with a DHUParameterSpec or MQVParameterSpec that carried none. The XDH agreements were unaffected, as they substituted an empty value. A null OtherInfo now derives what an empty one does, H(counter || Z), and KDFParameters refuses a null shared secret at construction rather than leaving it to fail inside the KDF.
69+
- The PKCS12-DEF-AES256-AES128 and PKCS12-DEF-AES256-AES128-GCM KeyStores performed their key protection and MAC operations with the BC provider, rather than through the default JCA provider search that the other PKCS12-DEF stores use, as their implementations were built with the BC helper. They now use the default search, and the PKCS12-AES256-AES128 and PKCS12-AES256-AES128-GCM KeyStores, which had been registered to those same implementations, are now registered to the BC ones.
6970

7071
### 2.1.3 Additional Features and Functionality
7172

‎prov/src/main/java/org/bouncycastle/jcajce/provider/keystore/PKCS12.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public void configure(ConfigurableProvider provider)
3434

3535
provider.addAlgorithm("KeyStore.PKCS12-3DES-40RC2", PREFIX + "PKCS12KeyStoreSpi$BCPKCS12KeyStore");
3636
provider.addAlgorithm("KeyStore.PKCS12-3DES-3DES", PREFIX + "PKCS12KeyStoreSpi$BCPKCS12KeyStore3DES");
37-
provider.addAlgorithm("KeyStore.PKCS12-AES256-AES128", PREFIX + "PKCS12KeyStoreSpi$DefPKCS12KeyStoreAES256");
38-
provider.addAlgorithm("KeyStore.PKCS12-AES256-AES128-GCM", PREFIX + "PKCS12KeyStoreSpi$DefPKCS12KeyStoreAES256GCM");
37+
provider.addAlgorithm("KeyStore.PKCS12-AES256-AES128", PREFIX + "PKCS12KeyStoreSpi$BCPKCS12KeyStoreAES256");
38+
provider.addAlgorithm("KeyStore.PKCS12-AES256-AES128-GCM", PREFIX + "PKCS12KeyStoreSpi$BCPKCS12KeyStoreAES256GCM");
3939

4040
provider.addAlgorithm("KeyStore.PKCS12-DEF-3DES-40RC2", PREFIX + "PKCS12KeyStoreSpi$DefPKCS12KeyStore");
4141
provider.addAlgorithm("KeyStore.PKCS12-DEF-3DES-3DES", PREFIX + "PKCS12KeyStoreSpi$DefPKCS12KeyStore3DES");

‎prov/src/main/java/org/bouncycastle/jcajce/provider/keystore/pkcs12/PKCS12KeyStoreSpi.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2421,7 +2421,7 @@ public static class DefPKCS12KeyStoreAES256
24212421
{
24222422
public DefPKCS12KeyStoreAES256()
24232423
{
2424-
super(new BCJcaJceHelper(), new PKCS12KeyStoreSpi(new BCJcaJceHelper(), NISTObjectIdentifiers.id_aes256_CBC, NISTObjectIdentifiers.id_aes128_CBC));
2424+
super(new DefaultJcaJceHelper(), new PKCS12KeyStoreSpi(new DefaultJcaJceHelper(), NISTObjectIdentifiers.id_aes256_CBC, NISTObjectIdentifiers.id_aes128_CBC));
24252425
}
24262426
}
24272427

@@ -2430,7 +2430,7 @@ public static class DefPKCS12KeyStoreAES256GCM
24302430
{
24312431
public DefPKCS12KeyStoreAES256GCM()
24322432
{
2433-
super(new BCJcaJceHelper(), new PKCS12KeyStoreSpi(new BCJcaJceHelper(), NISTObjectIdentifiers.id_aes256_GCM, NISTObjectIdentifiers.id_aes128_GCM));
2433+
super(new DefaultJcaJceHelper(), new PKCS12KeyStoreSpi(new DefaultJcaJceHelper(), NISTObjectIdentifiers.id_aes256_GCM, NISTObjectIdentifiers.id_aes128_GCM));
24342434
}
24352435
}
24362436

0 commit comments

Comments
 (0)