RFR: 8296442: EncryptedPrivateKeyInfo can be created with an uninitialized AlgorithmParameters [v2]
Kevin Driver
kdriver at openjdk.org
Thu Nov 10 17:11:31 UTC 2022
On Thu, 10 Nov 2022 15:27:52 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.
>
> Weijun Wang has updated the pull request incrementally with one additional commit since the last revision:
>
> address xuelei's comments
test/jdk/javax/crypto/EncryptedPrivateKeyInfo/GetAlgName.java line 72:
> 70: epki = new EncryptedPrivateKeyInfo(ap2, BYTES);
> 71: if (!epki.getAlgName().equalsIgnoreCase(algo)) {
> 72: System.out.println("...expect: " + algo);
should be "...expected: "
-------------
PR: https://git.openjdk.org/jdk/pull/11067
More information about the security-dev
mailing list