RFR: 8268427: Improve AlgorithmConstraints:checkAlgorithm performance [v2]
Xue-Lei Andrew Fan
xuelei at openjdk.java.net
Fri Jun 18 04:17:24 UTC 2021
On Fri, 18 Jun 2021 01:54:30 GMT, Dongbo He <dongbohe at openjdk.org> wrote:
>> Sorry, I missed a "case" in the original comment (corrected). I meant to keep the property case sensitive in the hash set so that the keywords like "keySize" could be used correctly.
>
> [checkAlgorithm](https://github.com/openjdk/jdk/blob/a051e735cda0d5ee5cb6ce0738aa549a7319a28c/src/java.base/share/classes/sun/security/util/AbstractAlgorithmConstraints.java#L94) check whether the item is in the collection by ignoring case. If the item in the HashSet is case-sensitive, the method will lose its original algorithmic logic, but will retain it by using a ` new TreeSet<>(String.CASE_INSENSITIVE_ORDER);`
>
> Can we use case sensitivity in checkAlgorithm to check an algorithm?
The checkAlgorithm is using equalsIgnoreCase(), so it is safe for it. My concern is mainly about the keywords, like "keySize" used the property, not really the algorithm name. It is good to keep the current case sensitive checking behavior unchanged.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4424
More information about the security-dev
mailing list