Updates to pass unit testing
This commit is contained in:
@@ -13,7 +13,7 @@ class IssuerPacket extends Subpacket
|
||||
{
|
||||
$bytes = '';
|
||||
for($i = 0; $i < strlen($this->data); $i += 2) {
|
||||
$bytes .= chr(hexdec($this->data{$i}.$this->data{$i+1}));
|
||||
$bytes .= chr(hexdec($this->data[$i].$this->data[$i+1]));
|
||||
}
|
||||
return $bytes;
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@ class RevocationKeyPacket extends Subpacket
|
||||
$bytes .= chr($this->key_algorithm);
|
||||
|
||||
for($i = 0; $i < strlen($this->fingerprint); $i += 2) {
|
||||
$bytes .= chr(hexdec($this->fingerprint{$i}.$this->fingerprint{$i+1}));
|
||||
$bytes .= chr(hexdec($this->fingerprint[$i].$this->fingerprint[$i+1]));
|
||||
}
|
||||
|
||||
return $bytes;
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Leenooks\OpenPGP\SignaturePacket;
|
||||
|
||||
use Leenooks\OpenPGP\Exceptions\PacketTagException;
|
||||
use Leenooks\OpenPGP\Packet;
|
||||
|
||||
class Subpacket extends Packet
|
||||
@@ -21,10 +22,18 @@ class Subpacket extends Packet
|
||||
|
||||
return ['header'=>$size.$tag,'body'=>$body];
|
||||
}
|
||||
|
||||
|
||||
/* Defaults for unsupported packets */
|
||||
function read()
|
||||
{
|
||||
$this->data = $this->input;
|
||||
}
|
||||
|
||||
public function setTag(int $tag): void
|
||||
{
|
||||
if (get_class($this) !== Subpacket::class)
|
||||
throw new PacketTagException('Attempting to set a tag for invalid class: ',get_class($this));
|
||||
|
||||
$this->tag = $tag;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user