RFR: 8268427: Improve AlgorithmConstraints:checkAlgorithm performance [v2]
Dongbo He
dongbohe at openjdk.java.net
Fri Jun 18 01:57:31 UTC 2021
On Thu, 17 Jun 2021 16:08:15 GMT, Xue-Lei Andrew Fan <xuelei at openjdk.org> wrote:
>> I did not get the point to use TreeSet. Is it sufficient if the toLowerCase() is not added (and don't compare keywords like "keySize" by ignoring cases)?
>>
>>
>> - algorithmsInProperty[i] = algorithmsInProperty[i].trim().toLowerCase(...);
>> + algorithmsInProperty[i] = algorithmsInProperty[i].trim();
>
> 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?
-------------
PR: https://git.openjdk.java.net/jdk/pull/4424
More information about the security-dev
mailing list