agent: raise explicit error when signature fails

This commit is contained in:
Roman Zeyde 2016-05-07 20:49:51 +03:00
parent 9888ef971a
commit 695079e4b9

View File

@ -123,10 +123,11 @@ def sign(sock, keygrip, digest):
line = _unescape(line) line = _unescape(line)
log.debug('line: %r', line) log.debug('line: %r', line)
prefix, sig = line.split(' ', 1) prefix, sig = line.split(' ', 1)
assert prefix == 'D' if prefix != 'D':
raise ValueError(line)
sig, leftover = _parse(sig) sig, leftover = _parse(sig)
assert not leftover assert not leftover, leftover
return _parse_sig(sig) return _parse_sig(sig)