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:
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2014 The PHP Group
All rights reserved.
Last updated: Sat Apr 19 19:02:15 2014 UTC