DSA/Signature/SSH2: fix infrequent error with too short sigs

This commit is contained in:
terrafrost 2017-12-05 00:08:56 -06:00
parent 0074539429
commit a96add4526

View File

@ -70,6 +70,9 @@ abstract class SSH2
if ($r->getLength() > 160 || $s->getLength() > 160) { if ($r->getLength() > 160 || $s->getLength() > 160) {
return false; return false;
} }
return Strings::packSSH2('ss', 'ssh-dss', $r->toBytes() . $s->toBytes()); return Strings::packSSH2('ss', 'ssh-dss',
str_pad($r->toBytes(), 20, "\0", STR_PAD_LEFT) .
str_pad($s->toBytes(), 20, "\0", STR_PAD_LEFT)
);
} }
} }