ID: 46149
Updated by: [EMAIL PROTECTED]
Reported By: hanbsd at 163 dot com
-Status: Open
+Status: Bogus
Bug Type: OpenSSL related
Operating System: Centos 5.0
PHP Version: 5.2.6
New Comment:
Duplicate of #41033 (which is fixed)
Previous Comments:
------------------------------------------------------------------------
[2008-11-07 07:48:21] t dot dettrick at its dot uq dot edu dot au
This is related to Bug #41033 - PHP doesn't support signing or
verification with DSA, because it requires EVP_dss1() instead of
EVP_sha1(), and the patch to provide a constant for that hash algorithm
hasn't been merged yet.
------------------------------------------------------------------------
[2008-09-22 11:45:57] hanbsd at 163 dot com
Description:
------------
I create private key with
$configargs = array(
"digest_alg" => "sha1",
"private_key_bits" => 1024,
"private_key_type" => OPENSSL_KEYTYPE_DSA,
"encrypt_key" => false
);
But I can not get signature by openssl_sign($data, $signature, $key).
Then I use openssl in shell
#openssl dgst -dss1 -sign id_dsa foo.sha1 > sigfile.bin
openssl create a signature file : sigfile.bin
#openssl dgst -dss1 -verify id_dsa.pub -signature sigfile.bin foo.sha1
openssl print: "Verified OK"
It looks something bug of PHP function openssl_sign()
Reproduce code:
---------------
$data = "sfsdfsdfs";
$fp = fopen("/home/id_dsa", "r");
$pkey = fread($fp, 8192);
fclose($fp);
$key = openssl_get_privatekey($pkey);
openssl_sign($data, $signature, $key);
openssl_free_key($key);
echo $signature;
Expected result:
----------------
openssl_sign() can create signature
Actual result:
--------------
openssl_sign() can not create signature , $signature is empty
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46149&edit=1