/** * Convert to compact serialization. * * @return string */ public function toCompact() { return Base64::urlEncode($this->_protectedHeader->toJSON()) . "." . Base64::urlEncode($this->_encryptedKey) . "." . Base64::urlEncode($this->_iv) . "." . Base64::urlEncode($this->_ciphertext) . "." . Base64::urlEncode($this->_authenticationTag); }
/** * Generate input for the signature computation. * * @param string $payload Payload * @param Header $header Protected header * @return string */ protected static function _generateSignatureInput($payload, Header $header) { $b64 = $header->hasB64Payload() ? $header->B64Payload()->value() : true; $data = Base64::urlEncode($header->toJSON()) . "."; $data .= $b64 ? Base64::urlEncode($payload) : $payload; return $data; }