Skip to content

Commit

Permalink
Merge branch 'MDL-64723' of git://github.com/paulholden/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
snake committed Oct 28, 2020
2 parents 36f29a2 + e5fa5c3 commit f9f9092
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion admin/tool/mobile/classes/api.php
Expand Up @@ -603,8 +603,21 @@ public static function get_potential_config_issues() {
$timenow = time();
$expectedissuer = null;
foreach ($info['certinfo'] as $cert) {

// Due to a bug in certain curl/openssl versions the signature algorithm isn't always correctly parsed.
// See https://github.com/curl/curl/issues/3706 for reference.
if (!array_key_exists('Signature Algorithm', $cert)) {
// The malformed field that does contain the algorithm we're looking for looks like the following:
// <WHITESPACE>Signature Algorithm: <ALGORITHM><CRLF><ALGORITHM>.
preg_match('/\s+Signature Algorithm: (?<algorithm>[^\s]+)/', $cert['Public Key Algorithm'], $matches);

$signaturealgorithm = $matches['algorithm'] ?? '';
} else {
$signaturealgorithm = $cert['Signature Algorithm'];
}

// Check if the signature algorithm is weak (Android won't work with SHA-1).
if ($cert['Signature Algorithm'] == 'sha1WithRSAEncryption' || $cert['Signature Algorithm'] == 'sha1WithRSA') {
if ($signaturealgorithm == 'sha1WithRSAEncryption' || $signaturealgorithm == 'sha1WithRSA') {
$warnings[] = ['insecurealgorithmwarning', 'tool_mobile'];
}
// Check certificate start date.
Expand Down

0 comments on commit f9f9092

Please sign in to comment.