mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 04:52:36 +02:00
MDL-77840 mnet: Avoid passing nulls to base64_encode
This commit is contained in:
parent
4e632b7251
commit
b318ce307d
@ -495,6 +495,8 @@ $string['onlyadmins'] = 'Only administrators can do that';
|
||||
$string['onlyeditingteachers'] = 'Only editing teachers can do that';
|
||||
$string['onlyeditown'] = 'You can only edit your own information';
|
||||
$string['orderidnotfound'] = 'Order ID {$a} not found';
|
||||
$string['opensslsignerror'] = 'OpenSSL unable to sign data';
|
||||
$string['opensslsealerror'] = 'OpenSSL unable to seal data';
|
||||
$string['pagenotexisttitle'] = '404 Error: File not found';
|
||||
$string['pagenotexist'] = '<p>An unusual error occurred trying to view a page that does not exist:</p>{$a}';
|
||||
$string['pathdoesnotstartslash'] = 'No valid arguments supplied, path does not start with slash!';
|
||||
|
13
mnet/lib.php
13
mnet/lib.php
@ -216,7 +216,12 @@ function mnet_sign_message($message, $privatekey = null) {
|
||||
// The '$sig' value below is returned by reference.
|
||||
// We initialize it first to stop my IDE from complaining.
|
||||
$sig = '';
|
||||
$bool = openssl_sign($message, $sig, $privatekey); // TODO: On failure?
|
||||
$bool = openssl_sign($message, $sig, $privatekey);
|
||||
|
||||
// Avoid passing null values to base64_encode.
|
||||
if ($bool === false) {
|
||||
throw new \moodle_exception('opensslsignerror');
|
||||
}
|
||||
|
||||
$message = '<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<signedMessage>
|
||||
@ -283,6 +288,12 @@ function mnet_encrypt_message($message, $remote_certificate) {
|
||||
|
||||
// passed by ref -> &$encryptedstring &$symmetric_keys
|
||||
$bool = openssl_seal($message, $encryptedstring, $symmetric_keys, array($publickey), 'RC4');
|
||||
|
||||
// Avoid passing null values to base64_encode.
|
||||
if ($bool === false) {
|
||||
throw new \moodle_exception('opensslsealerror');
|
||||
}
|
||||
|
||||
$message = $encryptedstring;
|
||||
$symmetrickey = array_pop($symmetric_keys);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user