/** * Setup test environment * */ public function setUp() { if (!extension_loaded('openssl')) { throw new PrerequisitesNotMetError(PREREQUISITE_LIBRARYMISSING, $cause = NULL, array('openssl')); } if ($this->cert && $this->publickey && $this->privatekey) { return; } // Generate private & public key, using a self-signed certificate $keypair = KeyPair::generate(); $privatekey = $keypair->getPrivateKey(); $csr = new CSR(new Principal(array('C' => 'DE', 'ST' => 'Baden-Württemberg', 'L' => 'Karlsruhe', 'O' => 'XP', 'OU' => 'XP Team', 'CN' => 'XP Unittest', 'EMAIL' => '*****@*****.**')), $keypair); $cert = $csr->sign($keypair); $publickey = $cert->getPublicKey(); $this->cert = $cert; $this->publickey = $publickey; $this->privatekey = $privatekey; }