Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.2.1

Bug #26925 getPublicKey() returns private key
Submitted: 2020-03-30 04:32 UTC
From: terrafrost Assigned:
Status: Open Package: Crypt_RSA (version 1.2.1)
PHP Version: Irrelevant OS: any
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 48 - 44 = ?

 
 [2020-03-30 04:32 UTC] terrafrost (Jim Wigginton)
Description: ------------ Crypt_RSA_KeyPair::getPublicKey() returns the private key - not the public key. The fix is to replace this line (in Crypt/RSA/KeyPair.php): $this->_public_key = &$obj; With this: $this->_public_key = $obj; I suppose I could make a PR to do just this but if I did that I'd also need to do a unit test and tbh I don't care enough to do that lol. Test script: --------------- $key_pair = new Crypt_RSA_KeyPair(1024); echo $key_pair->getPrivateKey()->toString() . "\n\n\n"; echo $key_pair->getPublicKey()->toString() . "\n\n\n"; Expected result: ---------------- Should return a private key and a pubic key Actual result: -------------- Returns two private keys.

Comments