openpgp-php/lib/OpenPgP/SignaturePacket/EmbeddedSignaturePacket.php

24 lines
523 B
PHP
Raw Normal View History

2020-06-07 06:25:59 +00:00
<?php
namespace Leenooks\OpenPGP\SignaturePacket;
use Leenooks\OpenPGP\SignaturePacket;
/**
* @see http://tools.ietf.org/html/rfc4880#section-5.2.3.26
*/
class EmbeddedSignaturePacket extends SignaturePacket
{
protected $tag = 32;
2020-06-24 12:37:14 +00:00
protected function header_and_body(): array
2020-06-07 06:25:59 +00:00
{
2020-06-24 12:37:14 +00:00
return ['header'=>$this->size().chr($this->tag),'body'=>$this->body()];
}
2020-06-07 06:25:59 +00:00
2020-06-24 12:37:14 +00:00
protected function size(): string
{
// Use 5-octet lengths + 1 for tag as first packet body octet
return chr(255).pack('N',strlen($this->body())+1);
2020-06-07 06:25:59 +00:00
}
}