Integrated: 8296442: EncryptedPrivateKeyInfo can be created with an uninitialized AlgorithmParameters

Weijun Wang weijun at openjdk.org
Wed Nov 16 20:33:56 UTC 2022


On Wed, 9 Nov 2022 19:59:08 GMT, Weijun Wang <weijun at openjdk.org> wrote:

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

This pull request has now been integrated.

Changeset: 68d3ed5c
Author:    Weijun Wang <weijun at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/68d3ed5ceec38505b934d79f288eb78d09fb3cc4
Stats:     174 lines in 6 files changed: 102 ins; 46 del; 26 mod

8296442: EncryptedPrivateKeyInfo can be created with an uninitialized AlgorithmParameters

Reviewed-by: xuelei, kdriver, mullan

-------------

PR: https://git.openjdk.org/jdk/pull/11067


More information about the security-dev mailing list