]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Raise a validation failure exception instead of asserting when an
authorBob Halley <halley@dnspython.org>
Sun, 19 Feb 2017 21:56:50 +0000 (13:56 -0800)
committerBob Halley <halley@dnspython.org>
Sun, 19 Feb 2017 21:56:50 +0000 (13:56 -0800)
ECDSA point is invalid.
[Issue #237]

dns/dnssec.py

index f316636affac768a9969128a2af820e807c968de..b91a64fed29155de6030d40aeb07ee88c49def52 100644 (file)
@@ -364,7 +364,8 @@ def _validate_rrsig(rrset, rrsig, keys, origin=None, now=None):
             keyptr = candidate_key.key
             x = Crypto.Util.number.bytes_to_long(keyptr[0:key_len])
             y = Crypto.Util.number.bytes_to_long(keyptr[key_len:key_len * 2])
-            assert ecdsa.ecdsa.point_is_valid(curve.generator, x, y)
+            if not ecdsa.ecdsa.point_is_valid(curve.generator, x, y):
+                raise ValidationFailure('invalid ECDSA key')
             point = ecdsa.ellipticcurve.Point(curve.curve, x, y, curve.order)
             verifying_key = ecdsa.keys.VerifyingKey.from_public_point(point,
                                                                       curve)