openssl

Главные вкладки

Аватар пользователя sasha- sasha- 13 августа 2008 в 9:38

извиняюсь, что тема не совсем связана с друпалом, но все же...
При создании запроса на подпись сертификата для уже созданного мной секретного ключа:
OpenSSL> req -new -key server.key -out server.csr
Появляется следующая ошибка:
Unable to load config info from D:\server\OpenSSL\bin\openssl.cnf
error in req
я понимаю, что он не может загрузить файл "openssl.cnf" из директории "D:\server\OpenSSL\bin\", когда я ставил apache_2.2.9-win32-x86-openssl-0.9.8h-r2.msi, такая директория не создалась. Я создал ее сам поместил туда файл "openssl.cnf" (в нем я ничего не исправлял), также этот файл я копировал сюда "D:\server\apache\bin", ну и по умолчанию после установки он находится тут "D:\server\apache\conf". Ошибка все равно появляется. В инете нашел только что "надо указать в переменных среды переменную SSLEAY_CONF=(полный путь к)\openssl.cnf" Вот только я не знаю (через поиск в файлах так же не нашел) в каком файле находится эта переменная. Подскажите, пожалуйста, как исправить.

Комментарии

Аватар пользователя despain despain 13 августа 2008 в 17:09

To use the CSR and key generation functions from PHP, you will need to install
an openssl.cnf file. We have included a sample file that can be used for this
purpose in this folder alongside this readme file.

The default path for the openssl.cnf file is determined as follows:

OPENSSL_CONF environmental variable, if set, is assumed to hold the
path to the file.

If it is not set, SSLEAY_CONF environmental variable is checked next.
If neither are set, PHP will look in the default certificate area that was set
at the time that the SSL DLLs were compiled. This is typically
"C:\usr\local\ssl\openssl.cnf".

If the default path is not suitable for your system, you can set the
OPENSSL_CONF variable; under windows 95 and 98 you can set this variable in
your autoexec.bat (or the batch file that starts your webserver/PHP).
Under NT, 2000 and XP you can set environmental variables using "My Computer"
properties.

If setting an environmental var is not suitable, and you don't want to install
the config file at the default location, you can override the default path
using code like this:

$configargs = array(
"config" => "path/to/openssl.cnf"
);

$pkey = openssl_pkey_new($config);
$csr = openssl_csr_new($dn, $pkey, $config);

Please consult the online manual for more information about these functions.

NOTE!

Windows Explorer gives special meaning to files with a .cnf extension.
This typically means that editing the file from the explorer (by double or
right-clicking) will be difficult or impossible depending on your setup.
It is often easier to open the file from within the editor.
You can avoid this issue by naming the file something else (you might need to
rename the file using a DOS box) and then setting up an environmental variable
as described above.

Аватар пользователя sasha- sasha- 19 августа 2008 в 6:25

$configargs = array(
"config" => "path/to/openssl.cnf");

$pkey = openssl_pkey_new($config);
$csr = openssl_csr_new($dn, $pkey, $config);

куда этот код надо писать/вставлять, в какой именно файл?