php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #38731 openssl_pkey_new does not support DSA key generation
Submitted: 2006-09-06 09:48 UTC Modified: 2006-09-08 20:11 UTC
From: marci at balabit dot hu Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 5CVS-2006-09-06 (CVS) OS: linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: marci at balabit dot hu
New email:
PHP Version: OS:

 

 [2006-09-06 09:48 UTC] marci at balabit dot hu
Description:
------------
It does not support DSA key generation, and it is not mentioned in the documentation. Also it misses some other DSA related functionality...

patch against Revision 1.98.2.5.2.17

--- openssl.c-orig      2006-09-06 11:36:26.000000000 +0200
+++ openssl.c   2006-09-06 11:39:32.000000000 +0200
@@ -2033,6 +2033,22 @@
                                if (EVP_PKEY_assign_RSA(req->priv_key, RSA_generate_key(req->priv_key_bits, 0x10001, NULL, NULL)))
                                        return_val = req->priv_key;
                                break;
+#ifndef NO_DSA
+                       case OPENSSL_KEYTYPE_DSA:
+                               {
+                                       DSA *dsapar = DSA_generate_parameters(req->priv_key_bits, NULL, 0, NULL, NULL, NULL, NULL);
+                                       if (dsapar) {
+                                               DSA_set_method(dsapar, DSA_get_default_method());
+                                               if (DSA_generate_key(dsapar)) {
+                                                       if (EVP_PKEY_assign_DSA(req->priv_key, dsapar))
+                                                               return_val = req->priv_key;
+                                               } else {
+                                                       DSA_free(dsapar);
+                                               }
+                                       }
+                               }
+                               break;
+#endif
                        default:
                                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported private key type");
                }




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-08 20:11 UTC] tony2001@php.net
Commited to 5_2 and HEAD, thanks for the patch.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Oct 13 01:01:28 2024 UTC