Generate SignaturePacket trailer

This commit is contained in:
Stephen Paul Weber 2010-04-01 09:22:37 -05:00
parent 1e2db5b249
commit ec4b5c5f72

View File

@ -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();