Skip to content

Commit

Permalink
Implement most of the "new" packet format
Browse files Browse the repository at this point in the history
  • Loading branch information
singpolyma committed Mar 30, 2010
1 parent dc7bc43 commit e3f332c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/openpgp.php
Expand Up @@ -213,7 +213,17 @@ static function parse(&$input) {
*/
static function parse_new_format($input) {
$tag = ord($input[0]) & 63;
// TODO
$len = ord($input[1]);
if($len < 192) { // One octet length
return array($tag, 2, $len);
}
if($len > 191 && $len < 224) { // Two octet length
return array($tag, 3, (($len - 192) << 8) + ord($input[2]) + 192);
}
if($len == 255) { // Five octet length
return array($tag, 6, unpack('N', substr($input, 2, 4)));
}
// TODO: Partial body lengths. 1 << ($len & 0x1F)
}

/**
Expand Down

0 comments on commit e3f332c

Please sign in to comment.