Do not rely on asserts for behaviour

Closes #35
This commit is contained in:
Stephen Paul Weber 2018-07-25 14:35:51 -05:00
parent f2e1710da5
commit cba1ecce8a

View File

@ -685,7 +685,9 @@ class OpenPGP_SignaturePacket extends OpenPGP_Packet {
switch($this->version = ord($this->read_byte())) { switch($this->version = ord($this->read_byte())) {
case 2: case 2:
case 3: case 3:
assert(ord($this->read_byte()) == 5); if(ord($this->read_byte()) != 5) {
throw new Exception("Invalid version 2 or 3 SignaturePacket");
}
$this->signature_type = ord($this->read_byte()); $this->signature_type = ord($this->read_byte());
$creation_time = $this->read_timestamp(); $creation_time = $this->read_timestamp();
$keyid = $this->read_bytes(8); $keyid = $this->read_bytes(8);