In Some cases, when you are integrating MAHARA with Moodle , the OpenSSL certificate Key is not displayed.
We came across this problem many times in a windows installation.The reason was the OpenSSL within the Apache folder is not configured in the MAHARA and Moodle.
They are more of configured to work on Linux than Windows.
The solution for the same is , using the OPENSSL methods we can override the existing methods by directly pointing to the openssl certificate file (openssl.cnf)
In Mahara,
Edit the File
$config is a array which holds the path of the Openssl.cnf in the your exisiting setup
$config = array("config" => "C:\Apache\openssl.cnf");
// ensure we remove trailing slashes
$dn["commonName"] = preg_replace(':/$:', '', $dn["commonName"]);
//if (!$new_key = openssl_pkey_new()) {
if (!$new_key = openssl_pkey_new($config)) {
throw new ConfigException('Could not generate a new SSL key. Are '
. 'you sure that both openssl and the PHP module for openssl are '
. 'installed on this machine?');
}
//if (!$csr_rsc = openssl_csr_new($dn, $new_key, array('private_key_bits',2048))) {
if (!$csr_rsc = openssl_csr_new($dn, $new_key, $config)) {
// This behaviour has been observed once before, on an ubuntu hardy box.
// The php5-openssl package was installed but somehow openssl
// wasn't.
throw new ConfigException('Could not generate a new SSL key. Are '
. 'you sure that both openssl and the PHP module for openssl are '
. 'installed on this machine?');
}
//$selfSignedCert = openssl_csr_sign($csr_rsc, null, $new_key, 365 /*days*/);
$selfSignedCert = openssl_csr_sign($csr_rsc, null, $new_key, 365 /*days*/,$config);
unset($csr_rsc); // Free up the resource
The Same applies to Moodle.
Edit the File :
$config = array("config" => "c:/apache/conf/openssl.cnf");
//$new_key = openssl_pkey_new();
$new_key = openssl_pkey_new($config);
//$csr_rsc = openssl_csr_new($dn, $new_key, array('private_key_bits',2048));
//$selfSignedCert = openssl_csr_sign($csr_rsc, null, $new_key, $days);
$csr_rsc = openssl_csr_new($dn, $new_key, $config);
$selfSignedCert = openssl_csr_sign($csr_rsc, null, $new_key, $days,$config);
unset($csr_rsc); // Free up the resource
