corretto / amazon-corretto-crypto-provider

The Amazon Corretto Crypto Provider is a collection of high-performance cryptographic implementations exposed via standard JCA/JCE interfaces.
Apache License 2.0
238 stars 56 forks source link

Fix exception message for key params #326

Closed SalusaSecondus closed 1 year ago

SalusaSecondus commented 1 year ago

ACCP uses the incorrect variable when constructing the exception thrown for incorrect key parameters. In EvpKey.nativeParams() on line 122, it is currently using the variable encoded rather than encodedParams. This means that rather reporting on the incorrect parameters (stored in encodedParams) it is trying to report on the fully encoded copy of the key (which is stored in encoded). This second variable (encoded) is lazily calculated and cached so if nativeParams() fails before an encoded copy of the key is retrieved, a second NullPointerException is thrown when handling encoded.

amirhosv commented 1 year ago

Thanks for reporting this.

amirhosv commented 1 year ago

PR merged.