Skip to content

Commit

Permalink
Implement body for OpenPGP_SignaturePacket
Browse files Browse the repository at this point in the history
  • Loading branch information
singpolyma committed Mar 31, 2010
1 parent 408c912 commit acdf5d1
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/openpgp.php
Expand Up @@ -382,6 +382,27 @@ function read() {
}
}

function body() {
$body = chr(4).chr($this->signature_type).chr($this->key_algorithm).chr($this->hash_algorithm);

$hashed_subpackets = '';
foreach($this->hashed_subpackets as $p) {
$hashed_subpackets .= $p->to_bytes();
}
$body .= pack('n', strlen($hashed_subpackets)).$hashed_subpackets;

$unhashed_subpackets = '';
foreach($this->unhashed_subpackets as $p) {
$unhashed_subpackets .= $p->to_bytes();
}
$body .= pack('n', strlen($unhashed_subpackets)).$unhashed_subpackets;

$body .= pack('n', $this->hash_head);
$body .= pack('n', floor((strlen($this->data) - 7)*8)).$this->data;

return $body;
}

/**
* @see http://tools.ietf.org/html/rfc4880#section-5.2.3.1
*/
Expand Down

0 comments on commit acdf5d1

Please sign in to comment.