RFR: 8268427: Improve AlgorithmConstraints:checkAlgorithm performance [v2]

Xue-Lei Andrew Fan xuelei at openjdk.java.net
Thu Jun 17 16:03:26 UTC 2021


On Thu, 17 Jun 2021 12:05:28 GMT, Dongbo He <dongbohe at openjdk.org> wrote:

>> src/java.base/share/classes/sun/security/util/AbstractAlgorithmConstraints.java line 72:
>> 
>>> 70:             algorithmsInProperty = property.split(",");
>>> 71:             for (int i = 0; i < algorithmsInProperty.length; i++) {
>>> 72:                 algorithmsInProperty[i] = algorithmsInProperty[i].trim().toLowerCase(Locale.ENGLISH);
>> 
>> Is it possible to keep the current behavior that the property could be sensitive?  It may be not desired to allow "keysize" for "keySize" spec in the property.
>
> If we keep property sensitive, we may need to use TreeSet. I have updated the PR with TreeSet. Fortunately, the performance hasn't changed much.

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();

-------------

PR: https://git.openjdk.java.net/jdk/pull/4424



More information about the security-dev mailing list