Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../var/softacul.../moodle43
File: privatekey.php
<?php
[0] Fix | Delete
[1] Fix | Delete
// We do not need this file any more
[2] Fix | Delete
@unlink('privatekey.php');
[3] Fix | Delete
[4] Fix | Delete
$ltikey = __mod_lti_verify_private_key();
[5] Fix | Delete
$enrol_lti = __mod_lti_verify_private_key();
[6] Fix | Delete
[7] Fix | Delete
echo '<kid>'.$ltikey['kid'].'</kid>';
[8] Fix | Delete
echo '<privatekey>'.$ltikey['privatekey'].'</privatekey>';
[9] Fix | Delete
[10] Fix | Delete
echo '<enrol_lti_kid>'.$enrol_lti['kid'].'</enrol_lti_kid>';
[11] Fix | Delete
echo '<enrol_lti_privatekey>'.$enrol_lti['privatekey'].'</enrol_lti_privatekey>';
[12] Fix | Delete
[13] Fix | Delete
function __mod_lti_verify_private_key() {
[14] Fix | Delete
global $error;
[15] Fix | Delete
[16] Fix | Delete
if (!function_exists('openssl_random_pseudo_bytes')) {
[17] Fix | Delete
$error[] = "openssl must be loaded for openssl_random_pseudo_bytes to function";
[18] Fix | Delete
return null;
[19] Fix | Delete
}
[20] Fix | Delete
[21] Fix | Delete
// Create the private key.
[22] Fix | Delete
$kid = bin2hex(openssl_random_pseudo_bytes(10));
[23] Fix | Delete
[24] Fix | Delete
$config = array(
[25] Fix | Delete
"digest_alg" => "sha256",
[26] Fix | Delete
"private_key_bits" => 2048,
[27] Fix | Delete
"private_key_type" => OPENSSL_KEYTYPE_RSA,
[28] Fix | Delete
);
[29] Fix | Delete
$res = openssl_pkey_new($config);
[30] Fix | Delete
openssl_pkey_export($res, $privatekey);
[31] Fix | Delete
[32] Fix | Delete
return array(
[33] Fix | Delete
'kid' => $kid,
[34] Fix | Delete
'privatekey' => $privatekey,
[35] Fix | Delete
);
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
?>
[39] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function