php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31634 openssl_seal always return false
Submitted: 2005-01-21 14:31 UTC Modified: 2005-02-13 18:29 UTC
From: stanislav dot chachkov at gmail dot com Assigned: wez (profile)
Status: Not a bug Package: OpenSSL related
PHP Version: 4CVS, 5CVS (2005-01-25) OS: BSD/OS 4.2 i386
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: stanislav dot chachkov at gmail dot com
New email:
PHP Version: OS:

 

 [2005-01-21 14:31 UTC] stanislav dot chachkov at gmail dot com
Description:
------------
openssl_seal always returns FALSE 

Returned sealed data and envelope keys are empty. 

There is no error returned by openssl_error_string

I also tried various certificates and key lengths.

config: 

php4.3.10 / openssl OpenSSL 0.9.7e / on BSD/OS 4.2 i386

'./configure' '--with-mysql' '--enable-ftp' '--enable-dbase' '--with-gd' '--enable-gd' '--with-apxs=/web/bin/apxs' '--with-openssl=/usr/local/ssl' '--with-zlib-dir=/usr/local' '--enable-curl' '--with-curl=/usr/local' '--enable-mhash' '--with-mhas=/usr/local'

The another config: '--with-openssl' , also produces this bug.

The same script runs ok on another computers (php4.3.9/macosx or php4.3.10/linux)



Reproduce code:
---------------
<?php
	
function seal($info,$key){

  if($pk = openssl_get_publickey($key)){
    echo openssl_error_string();echo '<br>';

    $res=openssl_seal($info, $sealed, $ekeys, array($pk));
    echo openssl_error_string();echo '<br>';
    var_dump($res);echo '<br>';

    openssl_free_key($pk);	
			
    return array('sealed'=>$sealed,'ekey'=>$ekeys[0]);
  }
  echo openssl_error_string();echo '<br>';
  return FALSE;
}

$key="-----BEGIN CERTIFICATE-----
MIIBdDCCAR4CAQAwDQYJKoZIhvcNAQEEBQAwRTELMAkGA1UEBhMCQVUxEzARBgNV
BAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0
ZDAeFw0wNTAxMTgxOTUyMjBaFw0wNTA3MTcxOTUyMjBaMEUxCzAJBgNVBAYTAkFV
MRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRz
IFB0eSBMdGQwXDANBgkqhkiG9w0BAQEFAANLADBIAkEAx7Z4soVmUJvKfhtBzKAP
oRs9bdllaaTvy9I1kdf0AVFCKN7+US2LQBpGyCpTuENM+WQxJ6vGtJ2pYhGmbPm5
0QIDAQABMA0GCSqGSIb3DQEBBAUAA0EAlvwJFlCbuagfpc6XM7zY8JP0Gz+CXlbh
NUjPgT8xkXzOBtjNxe+yNmhAfGyMXc7uKR+3tS6uHXzPvMg3PKCvqw==
-----END CERTIFICATE-----
";

print_r(seal("Secret data",$key));echo '<br>';
?>


Expected result:
----------------
int(11)
Array ( [sealed] => ...here goes the encrypted string in binary ... [ekey] => ..here goes the envelope key in binary ...)

Actual result:
--------------
bool(false)
Array ( [sealed] => [ekey] => ) 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-25 09:18 UTC] stanislav dot chachkov at gmail dot com
Same bug appears with  http://snaps.php.net/php4-STABLE-latest.tar.gz
 [2005-02-10 15:03 UTC] sniper@php.net
Assigning to the maintainer of ext/openssl

 [2005-02-10 15:53 UTC] tony2001@php.net
Can't reproduce.
Check your OpenSSL installation.
 [2005-02-10 17:20 UTC] stanislav dot chachkov at gmail dot com
It's on the hosting computer, I cannot really check it. Sorry.

If that can help you (or someone else with same bug) :

Only openssl_seal has this problem, openssl_encrypt works fine. 

Thanks
 [2005-02-13 18:29 UTC] sniper@php.net
Your example code works just fine for me too. There is something wrong in that hosting machine, not PHP..

 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Dec 03 08:03:33 2021 UTC