RFR: 8296442: EncryptedPrivateKeyInfo can be created with an uninitialized AlgorithmParameters
    Weijun Wang 
    weijun at openjdk.org
       
    Wed Nov  9 20:09:20 UTC 2022
    
    
  
An `EncryptedPrivateKeyInfo` object can be created with an uninitialized `AlgorithmParameters`, but before you call `getEncoded` on it you need to remember to initialize the params. This is unfortunate but since this is a public API, I hesitate to make a change.
Instead, this code change fixes the much more widely used internal class `AlgorithmId` so that it cannot be created with an uninitialized `AlgorithmParameters`. `EncryptedPrivateKeyInfo` now works with both initialized and uninitialized params, and it's immutable.
No intention to make `AlgorithmId` immutable this time. It has a child class named `AlgIdDSA` which makes things complicated.
-------------
Commit messages:
 - the fix
Changes: https://git.openjdk.org/jdk/pull/11067/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11067&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8296442
  Stats: 131 lines in 5 files changed: 97 ins; 12 del; 22 mod
  Patch: https://git.openjdk.org/jdk/pull/11067.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11067/head:pull/11067
PR: https://git.openjdk.org/jdk/pull/11067
    
    
More information about the security-dev
mailing list