aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Stapleton <alexs@prol.etari.at>2014-10-09 15:28:27 +0100
committerAlex Stapleton <alexs@prol.etari.at>2014-10-09 15:28:27 +0100
commit368af30ad2ca6609b745f70a6692ea9e1c786417 (patch)
tree3c8fd1ed3acf64195de7408c1b6959e98ea7a9e4
parentb19a930f7346343a5c5bd5ae8d4bd706f6e918ca (diff)
parent9d82f6657f72b6be747addf6b5e00be325ebbf64 (diff)
downloadcryptography-368af30ad2ca6609b745f70a6692ea9e1c786417.tar.gz
cryptography-368af30ad2ca6609b745f70a6692ea9e1c786417.tar.bz2
cryptography-368af30ad2ca6609b745f70a6692ea9e1c786417.zip
Merge pull request #1393 from alex/clean-up-error-message
Improved error message
-rw-r--r--cryptography/hazmat/primitives/asymmetric/dsa.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/cryptography/hazmat/primitives/asymmetric/dsa.py b/cryptography/hazmat/primitives/asymmetric/dsa.py
index 18076338..5e72299a 100644
--- a/cryptography/hazmat/primitives/asymmetric/dsa.py
+++ b/cryptography/hazmat/primitives/asymmetric/dsa.py
@@ -32,9 +32,12 @@ def _check_dsa_parameters(parameters):
(1024, 160),
(2048, 256),
(3072, 256)):
- raise ValueError("p and q lengths must be "
- "one of these pairs (1024, 160) or (2048, 256) "
- "or (3072, 256).")
+ raise ValueError(
+ "p and q's bit-lengths must be one of these pairs (1024, 160), "
+ "(2048, 256), or (3072, 256). Not ({0:d}, {1:d})".format(
+ utils.bit_length(parameters.p), utils.bit_length(parameters.q)
+ )
+ )
if not (1 < parameters.g < parameters.p):
raise ValueError("g, p don't satisfy 1 < g < p.")