Skip to content

Commit 38c7e7b

Browse files
committed
The HMAC SHA-512/224 and SHA-512/256 object identifiers are now registered as Mac and KeyGenerator aliases, which the SHA512 mappings had omitted while registering them for SecretKeyFactory, so getInstance by those OIDs resolves as it does for every other HMAC.
1 parent 1080579 commit 38c7e7b

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

‎docs/releasenotes.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Date: 2026, TBD
1616
### 2.1.2 Defects Fixed
1717

1818
- A KeyAgreement asked for its shared secret before doPhase returned data rather than refusing. javax.crypto.KeyAgreement specifies IllegalStateException for that state, but nothing in the provider tracked it, so each SPI handed back whatever its result field held: for Diffie-Hellman that was the private value itself - engineInit seeded result with x, so generateSecret() returned the private exponent padded to the prime's length and generateSecret("AES") an all-zero key taken from that padding - while ECDH returned null and its named-algorithm overload raised NullPointerException. BaseAgreementSpi now records whether a doPhase has completed the agreement since the last init and refuses the request with an IllegalStateException naming the algorithm, so every family in the provider - DH, ECDH and ECMQV, the SM2 exchange, both ECGOST families, XDH, SM9 and NewHope - answers the same way, and the DH SPI no longer holds the private value in that field at all.
19+
- Mac.getInstance and KeyGenerator.getInstance by the HMAC SHA-512/224 and SHA-512/256 object identifiers (1.2.840.113549.2.12 and .13) failed, although the same algorithms resolved by name and the matching SecretKeyFactory aliases were registered: the SHA512 mappings called addHMACAlgorithm for the two truncated variants without the addHMACAlias that registers their OIDs against Mac and KeyGenerator. Both are now aliased, as every other HMAC in that class already was.
1920

2021
### 2.1.3 Additional Features and Functionality
2122

‎prov/src/main/java/org/bouncycastle/jcajce/provider/digest/SHA512.java‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,10 @@ public void configure(ConfigurableProvider provider)
208208
addHMACAlias(provider, "SHA512", PKCSObjectIdentifiers.id_hmacWithSHA512);
209209

210210
addHMACAlgorithm(provider, "SHA512/224", PREFIX + "$HashMacT224", PREFIX + "$KeyGeneratorT224");
211+
addHMACAlias(provider, "SHA512/224", PKCSObjectIdentifiers.id_hmacWithSHA512_224);
212+
211213
addHMACAlgorithm(provider, "SHA512/256", PREFIX + "$HashMacT256", PREFIX + "$KeyGeneratorT256");
214+
addHMACAlias(provider, "SHA512/256", PKCSObjectIdentifiers.id_hmacWithSHA512_256);
212215

213216
provider.addAlgorithm("SecretKeyFactory.HMACSHA512", PREFIX + "$KeyFactory");
214217
provider.addAlgorithm("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.id_hmacWithSHA512, "HMACSHA512");

0 commit comments

Comments
 (0)