From ec4b5c5f7260c5e4b73e87ea9a0e627b0852b1de Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Thu, 1 Apr 2010 09:22:37 -0500 Subject: [PATCH] Generate SignaturePacket trailer --- lib/openpgp.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/openpgp.php b/lib/openpgp.php index 7abab01..319d369 100644 --- a/lib/openpgp.php +++ b/lib/openpgp.php @@ -420,7 +420,7 @@ class OpenPGP_SignaturePacket extends OpenPGP_Packet { } } - function body() { + function body($trailer=false) { $body = chr(4).chr($this->signature_type).chr($this->key_algorithm).chr($this->hash_algorithm); $hashed_subpackets = ''; @@ -429,6 +429,9 @@ class OpenPGP_SignaturePacket extends OpenPGP_Packet { } $body .= pack('n', strlen($hashed_subpackets)).$hashed_subpackets; + // The trailer is just the top of the body plus some crap + if($trailer) return $body.chr(4).chr(0xff).pack('N', strlen($body)); + $unhashed_subpackets = ''; foreach((array)$this->unhashed_subpackets as $p) { $unhashed_subpackets .= $p->to_bytes();