From b41bc2c533668c0b760f9c064e2bc559e6000856 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Wed, 31 Mar 2010 14:26:16 -0500 Subject: [PATCH] Implement body for OpenPGP_CompressedDataPacket --- lib/openpgp.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/openpgp.php b/lib/openpgp.php index 2b6074d..ab4e799 100644 --- a/lib/openpgp.php +++ b/lib/openpgp.php @@ -792,6 +792,27 @@ class OpenPGP_CompressedDataPacket extends OpenPGP_Packet implements IteratorAgg } } + function body() { + $body = chr($this->algorithm); + switch($this->algorithm) { + case 0: + $body .= $this->data->to_bytes(); + break; + case 1: + $body .= gzdeflate($this->data->to_bytes()); + break; + case 2: + $body .= gzcompress($this->data->to_bytes()); + break; + case 3: + $body .= bzcompress($this->data->to_bytes()); + break; + default: + /* TODO error? */ + } + return $body; + } + // IteratorAggregate interface function getIterator() {