RFR: 8296442: EncryptedPrivateKeyInfo can be created with an uninitialized AlgorithmParameters
    Weijun Wang 
    weijun at openjdk.org
       
    Thu Nov 10 15:20:30 UTC 2022
    
    
  
On Thu, 10 Nov 2022 14:43:00 GMT, Weijun Wang <weijun at openjdk.org> wrote:
>> src/java.base/share/classes/javax/crypto/EncryptedPrivateKeyInfo.java line 199:
>> 
>>> 197:         if (tmp != null) {
>>> 198:             this.algid = tmp;
>>> 199:             this.params = null;
>> 
>> There is a getAlgParameters() method in the class.  Does it make sense to cache the params?
>
> OK. Thanks.
I rethink about this. More logic is needed when both can be non-null. On the other hand, `algid.getParameters()` just returns a field. I'd rather keep my original code.
-------------
PR: https://git.openjdk.org/jdk/pull/11067
    
    
More information about the security-dev
mailing list