/** * @param CipherTextInterface $cipherText * @return bool */ public function canSerialize(CipherTextInterface $cipherText) { return $this->profile->equals($cipherText->getProfile()); }
/** * @param $cipherText * @return string */ protected function doSerialize(CipherTextInterface $cipherText) { $profile = array('key_name' => $cipherText->getProfile()->getKeyName(), 'cipher' => $cipherText->getProfile()->getCipher()); return sprintf('%s%s%s', base64_encode(json_encode($profile)), $this->separator, base64_encode($cipherText->getText())); }