public function testEncryptionUsingPrivateKeyBase64Encryption() { $rsa = new Rsa(new RsaOptions(array('pem_string' => $this->_testPemString))); $encrypted = $rsa->encrypt('1234567890', $rsa->getOptions()->getPrivateKey(), Rsa::FORMAT_BASE64); $this->assertEquals( '1234567890', $rsa->decrypt($encrypted, $rsa->getOptions()->getPublicKey(), Rsa::FORMAT_BASE64) ); }
public function testEncryptionUsingPrivateKeyBase64Encryption() { $encrypted = $this->rsaBase64Out->encrypt('1234567890', $this->rsaBase64Out->getOptions()->getPrivateKey()); $decrypted = $this->rsaBase64Out->decrypt(base64_decode($encrypted), $this->rsaBase64Out->getOptions()->getPublicKey()); $this->assertEquals('1234567890', $decrypted); }
public function testDecryptCorruptRaw() { $data = 'vNKINbWV6qUKGsmawN8ii0mak7PPNoVQPC7fwXJOgMNfCgdT+9W4PUte4fic6U4A6fMra4gv7NCTESxap2qpBQ=='; $this->setExpectedException('Zend\\Crypt\\PublicKey\\Rsa\\Exception\\RuntimeException'); $this->rsa->decrypt($data, null, Rsa::MODE_RAW); }
/** * {@inheritdoc} */ public function decrypt($value) { return $this->zendRsa->decrypt($value); }