/** * Set PEM string * * @param string $value * @return RsaOptions */ public function setPemString($value) { $this->pemString = $value; try { $this->privateKey = new Rsa\PrivateKey($this->pemString, $this->passPhrase); $this->publicKey = $this->privateKey->getPublicKey(); } catch (Rsa\Exception\RuntimeException $e) { $this->privateKey = null; $this->publicKey = new Rsa\PublicKey($this->pemString); } return $this; }
/** * Set private key * * @param Rsa\PrivateKey $key * @return RsaOptions */ public function setPrivateKey(Rsa\PrivateKey $key) { $this->privateKey = $key; $this->publicKey = $this->privateKey->getPublicKey(); return $this; }