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)    

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