Implement OpenPGP_SignaturePacket_EmbeddedSignaturePacket

This commit is contained in:
Stephen Paul Weber 2010-04-01 18:18:02 -05:00
parent e931ebed25
commit 417c206bee

View File

@ -719,8 +719,19 @@ class OpenPGP_SignaturePacket_SignatureTargetPacket extends OpenPGP_SignaturePac
// TODO // TODO
} }
class OpenPGP_SignaturePacket_EmbeddedSignaturePacket extends OpenPGP_SignaturePacket_Subpacket { class OpenPGP_SignaturePacket_EmbeddedSignaturePacket extends OpenPGP_SignaturePacket {
// TODO // TODO: This is duplicated from subpacket... improve?
function __construct($data=NULL) {
parent::__construct($data);
$this->tag = array_search(substr(substr(get_class($this), 8+16), 0, -6), OpenPGP_SignaturePacket::$subpacket_types);
}
function header_and_body() {
$body = $this->body(); // Get body first, we will need it's length
$size = chr(255).pack('N', strlen($body)+1); // Use 5-octet lengths + 1 for tag as first packet body octet
$tag = chr($this->tag);
return array('header' => $size.$tag, 'body' => $body);
}
} }
/** /**