Hi everyone,

i got a serious problem here. Here is the setup

        const certificate_path = 'license/testpub.pem';
        const pass_phrase = '12345';
        const private_key_path = 'license/test.pem';
        
        /**
         * 
         * Encrypt data using a private key that has been created through 
open_ssl
         * requires passwort for private_key decryption
         * @param unknown_type $data
         * @param unknown_type $pkey_path path + filename of file that contains 
the
private key
         * @param unknown_type $passphrase
         * @return $data encrypted 
         */
        public static function EncryptWPrivateKey($data, $pkey_path,$passphrase)
        {
                $fp = fopen($pkey_path,"r");
                $private_key = fread($fp,8192);
                fclose($fp);
                $res = openssl_get_privatekey($private_key,pass_phrase);
                openssl_private_encrypt($data,$crypted,$res);
                return $crypted;
        }

If i call this function, the browser gives me after around 10 seconds a
connection reset. I figured through commenting that this line 

openssl_private_encrypt($data,$crypted,$res);

is the problem. But it seems that every parameter to the function is
correct, since altering those to be false gives me an exception immediatly
and the page is shown. So this line has to be the problem. I generated the
keys through openssl :

openssl genrsa -des3 -out pass.key 1024 
openssl rsa -in pass.key -out test.pem
openssl rsa -in test.pem -pubout -out testpub.pem

Doing this gives me a warning : can't open config file, but the keys are
still created

This is the php error log :

[Tue Feb 07 11:31:33 2012] [notice] Apache/2.2.21 (Win32) mod_ssl/2.2.21
OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming
normal operations
[Tue Feb 07 11:31:33 2012] [notice] Server built: Sep 10 2011 11:34:11
[Tue Feb 07 11:31:33 2012] [notice] Parent: Created child process 6932
[Tue Feb 07 11:31:34 2012] [notice] Digest: generating secret for digest
authentication ...
[Tue Feb 07 11:31:34 2012] [notice] Digest: done
[Tue Feb 07 11:31:35 2012] [notice] Child 6932: Child process is running
[Tue Feb 07 11:31:35 2012] [notice] Child 6932: Acquired the start mutex.
[Tue Feb 07 11:31:35 2012] [notice] Child 6932: Starting 150 worker threads.
[Tue Feb 07 11:31:35 2012] [notice] Child 6932: Starting thread to listen on
port 443.
[Tue Feb 07 11:31:35 2012] [notice] Child 6932: Starting thread to listen on
port 443.
[Tue Feb 07 11:31:35 2012] [notice] Child 6932: Starting thread to listen on
port 80.
[Tue Feb 07 11:31:35 2012] [notice] Child 6932: Starting thread to listen on
port 80.
[Tue Feb 07 11:31:36 2012] [notice] Parent: child process exited with status
255 -- Restarting.
[Tue Feb 07 11:31:36 2012] [notice] Digest: generating secret for digest
authentication ...
[Tue Feb 07 11:31:36 2012] [notice] Digest: done
[Tue Feb 07 11:31:37 2012] [notice] Apache/2.2.21 (Win32) mod_ssl/2.2.21
OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming
normal operations
[Tue Feb 07 11:31:37 2012] [notice] Server built: Sep 10 2011 11:34:11
[Tue Feb 07 11:31:37 2012] [notice] Parent: Created child process 2872
[Tue Feb 07 11:31:38 2012] [notice] Digest: generating secret for digest
authentication ...
[Tue Feb 07 11:31:38 2012] [notice] Digest: done
[Tue Feb 07 11:31:39 2012] [notice] Child 2872: Child process is running
[Tue Feb 07 11:31:39 2012] [notice] Child 2872: Acquired the start mutex.
[Tue Feb 07 11:31:39 2012] [notice] Child 2872: Starting 150 worker threads.
[Tue Feb 07 11:31:39 2012] [notice] Child 2872: Starting thread to listen on
port 443.
[Tue Feb 07 11:31:39 2012] [notice] Child 2872: Starting thread to listen on
port 443.
[Tue Feb 07 11:31:39 2012] [notice] Child 2872: Starting thread to listen on
port 80.
[Tue Feb 07 11:31:39 2012] [notice] Child 2872: Starting thread to listen on
port 80.

The only line that seems to have something to do with the problem is 

[Tue Feb 07 11:31:36 2012] [notice] Parent: child process exited with status
255 -- Restarting.

But honestly , it does not tell me much. Is anyone able to help me with this
? I first thought that the script might take to long so i reduced the key
size to 32 bit, but it didn't change anything 

greetings
-- 
View this message in context: 
http://old.nabble.com/openssl_private_encrypt-crashes-browser-after-10-seconds-tp33277720p33277720.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to