File tree Expand file tree Collapse file tree
src/main/java/com/rabbitmq/client Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5050 * The following modifications have been made to the original source code:
5151 * <ul>
5252 * <li>removed methods around loading trustStores.</li>
53+ * <li>updated the regular expressions to avoid exponential backtracking.</li>
5354 * </ul>
5455 */
5556public final class PemReader {
5657
5758 private static final Pattern CERT_PATTERN = Pattern .compile (
58- "-+BEGIN\\ s+.*CERTIFICATE[^-]*-+(?: \\ s| \\ r| \\ n)+" // Header
59- + "([a-z0-9+/=\\ r\\ n]+)" // Base64 text
60- + "-+END\\ s+.*CERTIFICATE[^-]*-+" , // Footer
59+ "-+BEGIN\\ s+.*CERTIFICATE[^-]*-+\\ s*" // Header
60+ + "([a-z0-9+/=\\ r\\ n]+)" // Base64 text
61+ + "-+END\\ s+.*CERTIFICATE[^-]*-+" , // Footer
6162 CASE_INSENSITIVE );
6263
6364 private static final Pattern PRIVATE_KEY_PATTERN = Pattern .compile (
64- "-+BEGIN\\ s+.*PRIVATE\\ s+KEY[^-]*-+(?: \\ s| \\ r| \\ n)+" // Header
65- + "([a-z0-9+/=\\ r\\ n]+)" // Base64 text
66- + "-+END\\ s+.*PRIVATE\\ s+KEY[^-]*-+" , // Footer
65+ "-+BEGIN\\ s+.*PRIVATE\\ s+KEY[^-]*-+\\ s*" // Header
66+ + "([a-z0-9+/=\\ r\\ n]+)" // Base64 text
67+ + "-+END\\ s+.*PRIVATE\\ s+KEY[^-]*-+" , // Footer
6768 CASE_INSENSITIVE );
6869
6970 private PemReader () {
You can’t perform that action at this time.
0 commit comments