Bug #25614 [Com]: openssl_pkey_get_public() fails when given a private key

From: Date: Sun, 19 Apr 2015 18:19:10 +0000
Subject: Bug #25614 [Com]: openssl_pkey_get_public() fails when given a private key
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-192206@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=25614&edit=1 ID: 25614 Comment by: pasindu@php.net Reported by: six at t0x dot net Summary: openssl_pkey_get_public() fails when given a private key Status: Assigned Type: Bug Package: OpenSSL related Operating System: Linux 2.4 PHP Version: 6CVS, 5CVS, 4CVS Assigned To: pajoye Block user comment: N Private report: N New Comment: The Documentation on this was fixed sometime ago, If this is a documentation issues it can be closed. Previous Comments: ------------------------------------------------------------------------ [2009-02-09 10:07:57] pajoye@php.net take the hand on this one, related to an issue I'm trying to solve as well. ------------------------------------------------------------------------ [2006-06-01 14:33:59] tony2001@php.net Unified diff against the current CVS, of course. ------------------------------------------------------------------------ [2006-06-01 14:33:17] tony2001@php.net Please provide unified diff. And no C++, thank you. ------------------------------------------------------------------------ [2006-06-01 14:27:57] andrey dot gladilin at gmail dot com Sorry, it's a c++ code. Hope this wont prevent you from a fix. ------------------------------------------------------------------------ [2006-06-01 14:22:33] andrey dot gladilin at gmail dot com To fix this bug you have to change file php-4.4.0/ext/openssl/openssl.c. php-4.4.0 is just my source distributive of PHP. In file openssl.c replace string key = PEM_read_bio_PUBKEY(in, NULL,NULL, NULL); with another code RSA * rsa = PEM_read_bio_RSAPublicKey(in, NULL, NULL, NULL); BIO_free(in); if(NULL == rsa) { throw Exc("Error while processing the Public Key."); } pkey = EVP_PKEY_new(); EVP_PKEY_assign_RSA(pkey, rsa); Unsusccessfully I have no time to test it, but this must work. Hope to see this bugfix in a new release. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=25614 -- Edit this bug report at https://bugs.php.net/bug.php?id=25614&edit=1

« previous php.bugs (#192206) next »