Error with private/public keys openssl conf?

Error with private/public keys openssl conf?

Nosūtīja santi macia
Atbilžu skaits: 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 smaidīgs
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
Vidējais novērtējums: -
Atbildot uz santi macia

Re: Error with private/public keys openssl conf?

Nosūtīja Dan Marsden
Core developers attēls Particularly helpful Moodlers attēls Peer reviewers attēls Plugin developers attēls Plugins guardians attēls Testers attēls Translators attēls
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
Atbildot uz Dan Marsden

Re: Error with private/public keys openssl conf?

Nosūtīja 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;
Atbildot uz santi macia

Re: Error with private/public keys openssl conf?

Nosūtīja 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!
Atbildot uz santi macia

Re: Error with private/public keys openssl conf?

Nosūtīja Dan Marsden
Core developers attēls Particularly helpful Moodlers attēls Peer reviewers attēls Plugin developers attēls Plugins guardians attēls Testers attēls Translators attēls
Atbildot uz Dan Marsden

Re: Error with private/public keys openssl conf?

Nosūtīja santi macia
yes, I see that before.

The solution was reconfiguring the moodle network again. And now everything runs well.

The step, redo the setup its very important :D