/** * @inheritDoc */ public function encrypt($unencrypted) { try { $encrypted = $this->crypto->encrypt($unencrypted); } catch (CryptoException $ex) { return null; } return $this->uriSafeEncode($encrypted); }
public function testEncryption() { $crypto = new LibsodiumSymmetricCrypto($this->secret); $cleartext = 'By the power of Grayskull!'; $encrypted = $crypto->encrypt($cleartext); $len = \strlen($encrypted); $this->assertSame(98, $len); }