When the DER signature is malformed, the VerifyingKey.verify(sigdecode=sigdecode_der) raises unexpected exceptions and in some cases does not raise any exception.
UnexpectedDER, IndexError and AssertionError are raised in addition to BadSignatureError, at the same time flipping the 4th or 6th least significant bit of 2nd byte of a NIST521p signature does not cause it to be rejected (the DER encoding is strict, and every value has one defined encoding, any other encoding is invalid and needs to be rejected)
When the DER signature is malformed, the
VerifyingKey.verify(sigdecode=sigdecode_der)raises unexpected exceptions and in some cases does not raise any exception.UnexpectedDER,IndexErrorandAssertionErrorare raised in addition toBadSignatureError, at the same time flipping the 4th or 6th least significant bit of 2nd byte of a NIST521p signature does not cause it to be rejected (the DER encoding is strict, and every value has one defined encoding, any other encoding is invalid and needs to be rejected)