Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dnsviz/dnsviz.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCasey Deccio <casey@deccio.net>2016-11-09 18:53:18 +0300
committerCasey Deccio <casey@deccio.net>2016-11-09 18:53:18 +0300
commitd953c7c6756390a9c8a8a4f207b96d501a5be71d (patch)
tree0a7ae04bbb23e2b86cdb8b6b3993def94f3ca3d6
parentc07ff152168cf2e2e6628ae3dfe2954b7c2058ca (diff)
Check for invalid ECDSA key
-rw-r--r--dnsviz/crypto.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/dnsviz/crypto.py b/dnsviz/crypto.py
index ee4978c..9e502f4 100644
--- a/dnsviz/crypto.py
+++ b/dnsviz/crypto.py
@@ -244,7 +244,10 @@ def _dnskey_to_ec(alg, key):
else:
raise ValueError('Algorithm not supported')
- return EC.pub_key_from_params(curve, EC_NOCOMPRESSION + key)
+ try:
+ return EC.pub_key_from_params(curve, EC_NOCOMPRESSION + key)
+ except ValueError:
+ return None
def _validate_rrsig_rsa(alg, sig, msg, key):
pubkey = _dnskey_to_rsa(key)
@@ -314,6 +317,10 @@ def _validate_rrsig_gost(alg, sig, msg, key):
def _validate_rrsig_ec(alg, sig, msg, key):
pubkey = _dnskey_to_ec(alg, key)
+ # if the key is invalid, then the signature is also invalid
+ if pubkey is None:
+ return False
+
if alg in (13,):
alg='sha256'
sigsize = 64