June 2017
Beginner to intermediate
368 pages
8h 31m
English
The sample code at https://github.com/iandavidwild/moodle-local_certificateapi includes an example PHP client (check out the /client folder). This will require a means to connect to our new external API (using curl) and also a method to decrypt the data. Again, we can use the PHP OpenSSL extension for decryption:
function decrypt($response) { $output = false; if(count($response) == 2) { // response should have 'data' and an 'envelope' if(isset($response['data']) && isset($response['envelope'])) { $data = base64_decode($response['data']); $envelope = base64_decode($response['envelope']); // load private key from file static $certificateapi_key= null; if ($certificateapi_key === null) { $certificateapi_key= ...Read now
Unlock full access