Skip to content
Snippets Groups Projects
Commit cd072acb authored by Florian Schaal's avatar Florian Schaal
Browse files

changed the regex; new line at the end is allowed - prevents problems when...

changed the regex; new line at the end is allowed - prevents problems when using cut&paste for the private-key in the interface
parent c220da99
No related branches found
No related tags found
No related merge requests found
......@@ -87,10 +87,10 @@ class validate_dkim {
function validate_post($key, $value) {
switch ($key) {
case 'public':
if (preg_match("/(^-----BEGIN PUBLIC KEY-----)[a-zA-Z0-9\r\n\/\+=]{1,221}(-----END PUBLIC KEY-----(\n|\r)$)/", $value) === 1) { return true; } else { return false; }
if (preg_match("/(^-----BEGIN PUBLIC KEY-----)[a-zA-Z0-9\r\n\/\+=]{1,221}(-----END PUBLIC KEY-----(\n|\r)?$)/", $value) === 1) { return true; } else { return false; }
break;
case 'private':
if (preg_match("/(^-----BEGIN RSA PRIVATE KEY-----)[a-zA-Z0-9\r\n\/\+=]{1,850}(-----END RSA PRIVATE KEY-----(\n|\r)$)/", $value) === 1) { return true; } else { return false; }
if (preg_match("/(^-----BEGIN RSA PRIVATE KEY-----)[a-zA-Z0-9\r\n\/\+=]{1,850}(-----END RSA PRIVATE KEY-----(\n|\r)?$)/", $value) === 1) { return true; } else { return false; }
break;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment