public function testPlugins() { $adapter = new TestAsset\MockAdapter(); $this->requireMcryptAndOpensslOrSkip(); $infoCard = new InfoCard\InfoCard(); $infoCard->setAdapter($adapter); $result = $infoCard->getAdapter() instanceof Adapter; $this->assertTrue($result); $this->assertTrue($infoCard->getAdapter() instanceof TestAsset\MockAdapter); $infoCard->addCertificatePair($this->sslPrvKey, $this->sslPubKey); $claims = $infoCard->process($this->_xmlDocument); $pki_object = new \Zend\InfoCard\Cipher\PKI\Adapter\RSA(\Zend\InfoCard\Cipher\PKI\Adapter\AbstractAdapter::NO_PADDING); $infoCard->setPkiCipherObject($pki_object); $this->assertTrue($pki_object === $infoCard->getPkiCipherObject()); $sym_object = new \Zend\InfoCard\Cipher\Symmetric\Adapter\AES256CBC(); $infoCard->setSymCipherObject($sym_object); $this->assertTrue($sym_object === $infoCard->getSymCipherObject()); }
public function testPlugins() { if (version_compare(PHP_VERSION, '5.2.0', '<')) { $this->markTestSkipped('DOMDocument::C14N() not available until PHP 5.2.0'); } $adapter = new TestAsset\MockAdapter(); try { $infoCard = new InfoCard\InfoCard(); } catch (InfoCard\Exception $e) { $message = $e->getMessage(); if (preg_match('/requires.+mcrypt/', $message)) { $this->markTestSkipped($message); } else { throw $e; } } $infoCard->setAdapter($adapter); $result = $infoCard->getAdapter() instanceof Adapter; $this->assertTrue($result); $this->assertTrue($infoCard->getAdapter() instanceof TestAsset\MockAdapter); $infoCard->addCertificatePair($this->sslPrvKey, $this->sslPubKey); $claims = $infoCard->process($this->_xmlDocument); $pki_object = new \Zend\InfoCard\Cipher\PKI\Adapter\RSA(\Zend\InfoCard\Cipher\PKI\Adapter\AbstractAdapter::NO_PADDING); $infoCard->setPkiCipherObject($pki_object); $this->assertTrue($pki_object === $infoCard->getPkiCipherObject()); $sym_object = new \Zend\InfoCard\Cipher\Symmetric\Adapter\AES256CBC(); $infoCard->setSymCipherObject($sym_object); $this->assertTrue($sym_object === $infoCard->getSymCipherObject()); }
public function testPlugins() { if (version_compare(PHP_VERSION, '5.2.0', '<')) { $this->markTestSkipped('DOMDocument::C14N() not available until PHP 5.2.0'); } $adapter = new TestAsset\MockAdapter(); $this->requireMcryptAndOpensslOrSkip(); $infoCard = new InfoCard\InfoCard(); $infoCard->setAdapter($adapter); $result = $infoCard->getAdapter() instanceof Adapter; $this->assertTrue($result); $this->assertTrue($infoCard->getAdapter() instanceof TestAsset\MockAdapter); $infoCard->addCertificatePair($this->sslPrvKey, $this->sslPubKey); $claims = $infoCard->process($this->_xmlDocument); $pki_object = new \Zend\InfoCard\Cipher\PKI\Adapter\RSA(\Zend\InfoCard\Cipher\PKI\Adapter\AbstractAdapter::NO_PADDING); $infoCard->setPkiCipherObject($pki_object); $this->assertTrue($pki_object === $infoCard->getPkiCipherObject()); $sym_object = new \Zend\InfoCard\Cipher\Symmetric\Adapter\AES256CBC(); $infoCard->setSymCipherObject($sym_object); $this->assertTrue($sym_object === $infoCard->getSymCipherObject()); }
/** * Sets the InfoCard component Adapter to use * * @param Zend\InfoCard\Adapter $a * @return Zend\Authentication\Adapter\InfoCard Provides a fluent interface */ public function setAdapter(ZendInfoCard\Adapter $a) { $this->_infoCard->setAdapter($a); return $this; }