Error with private/public keys openssl conf?

Error with private/public keys openssl conf?

от santi macia -
Количество ответов: 5
Hello

Im trying to connect two moodles in the same computer, with windows 2003 + xampp.


My first problem was generate public keys, so i replaced in /mnt/lib.php

$new_key = openssl_pkey_new();
$csr_rsc = openssl_csr_new($dn, $new_key, array('private_key_bits',2048));
$selfSignedCert = openssl_csr_sign($csr_rsc, null, $new_key, $days);


$config = array(
"config" => "C:/Internet/xampp/apache/Apache2.2.9/conf/openssl.cnf"
);

$new_key = openssl_pkey_new($config);
$csr_rsc = openssl_csr_new($dn, $new_key, $config);
$selfSignedCert = openssl_csr_sign($csr_rsc, null, $new_key, $days, $config);


And now i see the generated public key улыбаюсь
But now when i click on services, i have this problem.

Warning: openssl_sign() [function.openssl-sign]: supplied key param cannot be coerced into a private key in C:\Internet\xampp\htdocs\claudigital\educacio\mnet\lib.php on line 172

Warning: openssl_open() [function.openssl-open]: unable to coerce parameter 4 into a private key in C:\Internet\xampp\htdocs\claudigital\educacio\mnet\xmlrpc\client.php on line 216

Warning: openssl_open() [function.openssl-open]: unable to coerce parameter 4 into a private key in C:\Internet\xampp\htdocs\claudigital\educacio\mnet\xmlrpc\client.php on line 229

Warning: openssl_open() [function.openssl-open]: unable to coerce parameter 4 into a private key in C:\Internet\xampp\htdocs\claudigital\educacio\mnet\xmlrpc\client.php on line 229

Warning: openssl_open() [function.openssl-open]: unable to coerce parameter 4 into a private key in C:\Internet\xampp\htdocs\claudigital\educacio\mnet\xmlrpc\client.php on line 229

I see the network faq and I set the openssl path on config.php

But nothing happens. What I can do?

thanx
В ответ на santi macia

Re: Error with private/public keys openssl conf?

от Dan Marsden -
Изображение пользователя Core developers Изображение пользователя Particularly helpful Moodlers Изображение пользователя Peer reviewers Изображение пользователя Plugin developers Изображение пользователя Plugins guardians Изображение пользователя Testers Изображение пользователя Translators
you also need to make this change to the call to
openssl_pkey_export - as it requires a path to the openssl.cnf as well.

but - you'd be better upgrading your Moodle install as there's a fix in the latest version of 1.9Stable that allows you to set the path to openssl.cnf in your config.php file
В ответ на Dan Marsden

Re: Error with private/public keys openssl conf?

от santi macia -
thanx, now I understand the error.

It's correct this modification? the generation of public key seems ok, but don't work services.



$config = array(
"config" => "C:/Internet/xampp/apache/bin/openssl.cnf"
);
$new_key = openssl_pkey_new($config);
$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

// We export our self-signed certificate to a string.
openssl_x509_export($selfSignedCert, $keypair['certificate']);
openssl_x509_free($selfSignedCert);

// Export your public/private key pair as a PEM encoded string. You
// can protect it with an optional passphrase if you wish.
$export = openssl_pkey_export($new_key, $keypair['keypair_PEM'], null, $config /* , $passphrase */);
openssl_pkey_free($new_key);
unset($new_key); // Free up the resource

return $keypair;
В ответ на santi macia

Re: Error with private/public keys openssl conf?

от santi macia -
Now, i've updated to 1.96 but I still have this error. I need to create digital certificate with openssl before? I've suppose that moodle do all...

correct me, thanx!
В ответ на santi macia

Re: Error with private/public keys openssl conf?

от Dan Marsden -
Изображение пользователя Core developers Изображение пользователя Particularly helpful Moodlers Изображение пользователя Peer reviewers Изображение пользователя Plugin developers Изображение пользователя Plugins guardians Изображение пользователя Testers Изображение пользователя Translators