You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Gets the most specific `CryptographicAlgorithm` that matches the given `name`.
31
+
* A matching algorithm is one where the name of the algorithm matches the start of name, with allowances made for different name formats.
32
+
* In the case that multiple `CryptographicAlgorithm`s match the given `name`, the algorithm(s) with the longest name will be selected. This is intended to select more specific versions of algorithms when multiple versions could match - for example "SHA3_224" matches against both "SHA3" and "SHA3224", but the latter is a more precise match.
name.toUpperCase().regexpCapture("^([\\w]+)(?:-.*)?$",1),// the name prior to any dashes or spaces
42
+
name.toUpperCase().regexpCapture("^([A-Z0-9]+)(?:(-|_).*)?$",1)// the name prior to any dashes, spaces, or underscores
43
+
].regexpReplaceAll("[-_ ]","")// strip dashes, underscores, and spaces
44
+
|
45
+
algorithmorderbyalgorithm.getName().length()
46
+
)
47
+
}
48
+
29
49
/**
30
50
* A cryptographic algorithm.
31
51
*/
@@ -39,15 +59,11 @@ abstract class CryptographicAlgorithm extends TCryptographicAlgorithm {
39
59
abstractstringgetName();
40
60
41
61
/**
42
-
* Holds if the name of this algorithm matches `name` modulo case,
43
-
* white space, dashes, underscores, and anything after a dash or underscore in the name
44
-
* (to ignore modes of operation, such as CBC or ECB).
62
+
* Holds if the name of this algorithm is the most specific match for `name`.
63
+
* This predicate matches quite liberally to account for different ways of formatting algorithm names, e.g. using dashes, underscores, or spaces as separators, including or not including block modes of operation, etc.
* Gets the most specific `CryptographicAlgorithm` that matches the given `name`.
31
+
* A matching algorithm is one where the name of the algorithm matches the start of name, with allowances made for different name formats.
32
+
* In the case that multiple `CryptographicAlgorithm`s match the given `name`, the algorithm(s) with the longest name will be selected. This is intended to select more specific versions of algorithms when multiple versions could match - for example "SHA3_224" matches against both "SHA3" and "SHA3224", but the latter is a more precise match.
name.toUpperCase().regexpCapture("^([\\w]+)(?:-.*)?$",1),// the name prior to any dashes or spaces
42
+
name.toUpperCase().regexpCapture("^([A-Z0-9]+)(?:(-|_).*)?$",1)// the name prior to any dashes, spaces, or underscores
43
+
].regexpReplaceAll("[-_ ]","")// strip dashes, underscores, and spaces
44
+
|
45
+
algorithmorderbyalgorithm.getName().length()
46
+
)
47
+
}
48
+
29
49
/**
30
50
* A cryptographic algorithm.
31
51
*/
@@ -39,15 +59,11 @@ abstract class CryptographicAlgorithm extends TCryptographicAlgorithm {
39
59
abstractstringgetName();
40
60
41
61
/**
42
-
* Holds if the name of this algorithm matches `name` modulo case,
43
-
* white space, dashes, underscores, and anything after a dash or underscore in the name
44
-
* (to ignore modes of operation, such as CBC or ECB).
62
+
* Holds if the name of this algorithm is the most specific match for `name`.
63
+
* This predicate matches quite liberally to account for different ways of formatting algorithm names, e.g. using dashes, underscores, or spaces as separators, including or not including block modes of operation, etc.
* Gets the most specific `CryptographicAlgorithm` that matches the given `name`.
31
+
* A matching algorithm is one where the name of the algorithm matches the start of name, with allowances made for different name formats.
32
+
* In the case that multiple `CryptographicAlgorithm`s match the given `name`, the algorithm(s) with the longest name will be selected. This is intended to select more specific versions of algorithms when multiple versions could match - for example "SHA3_224" matches against both "SHA3" and "SHA3224", but the latter is a more precise match.
name.toUpperCase().regexpCapture("^([\\w]+)(?:-.*)?$",1),// the name prior to any dashes or spaces
42
+
name.toUpperCase().regexpCapture("^([A-Z0-9]+)(?:(-|_).*)?$",1)// the name prior to any dashes, spaces, or underscores
43
+
].regexpReplaceAll("[-_ ]","")// strip dashes, underscores, and spaces
44
+
|
45
+
algorithmorderbyalgorithm.getName().length()
46
+
)
47
+
}
48
+
29
49
/**
30
50
* A cryptographic algorithm.
31
51
*/
@@ -39,15 +59,11 @@ abstract class CryptographicAlgorithm extends TCryptographicAlgorithm {
39
59
abstractstringgetName();
40
60
41
61
/**
42
-
* Holds if the name of this algorithm matches `name` modulo case,
43
-
* white space, dashes, underscores, and anything after a dash or underscore in the name
44
-
* (to ignore modes of operation, such as CBC or ECB).
62
+
* Holds if the name of this algorithm is the most specific match for `name`.
63
+
* This predicate matches quite liberally to account for different ways of formatting algorithm names, e.g. using dashes, underscores, or spaces as separators, including or not including block modes of operation, etc.
0 commit comments