/** * @expectedException RuntimeException * @expectedExceptionCode 203 */ public function testDecryptionRuntimeException203() { $msg = new Msg(); $msg->setVersion(1); $msg->setId('cafed00d-2131-4159-8e11-0b4dbadb1738'); $msg->setSrcNodeId('cafed00d-2331-4159-8e11-0b4dbadb1738'); $msg->setSrcSslKeyPub(static::SRC1_SSL_KEY_PUB); $msg->setSrcUserNickname('username1'); $msg->setDstNodeId('cafed00d-2431-4159-8e11-0b4dbadb1738'); $msg->setDstSslPubKey(static::DST1_SSL_KEY_PUB); $msg->setSubject('subj1'); $msg->setText('text1'); $msg->setSslKeyPrv(static::SRC1_SSL_KEY_PRV, static::SSL_KEY_PRV_PASS); $msg->setIgnore(false); $this->assertTrue($msg->encrypt()); $body = $msg->getBody(); $timeCreated = $msg->getTimeCreated(); $password = $msg->getPassword(); $checksum = $msg->getChecksum(); $body = base64_decode($body); $body = gzdecode($body); $body = json_decode($body, true); $body['data'] = 'invalid'; $body = json_encode($body); $body = gzencode($body, 9); $body = base64_encode($body); $msg = new Msg(); $msg->setVersion(1); $msg->setId('cafed00d-2131-4159-8e11-0b4dbadb1738'); $msg->setSrcNodeId('cafed00d-2331-4159-8e11-0b4dbadb1738'); $msg->setBody($body); $msg->setSrcSslKeyPub(static::SRC1_SSL_KEY_PUB); $msg->setDstSslPubKey(static::DST1_SSL_KEY_PUB); $msg->setSslKeyPrv(static::DST1_SSL_KEY_PRV, static::SSL_KEY_PRV_PASS); $msg->setDstNodeId('cafed00d-2431-4159-8e11-0b4dbadb1738'); $msg->setTimeCreated($timeCreated); $msg->setPassword($password); $msg->setChecksum($checksum); $msg->decrypt(); }