Provide more specific error message when ed25519 private key is invalid

This commit is contained in:
Scott Kitterman
2021-11-24 15:37:06 -05:00
parent 9c8e46eb5c
commit 6dcaaac712
2 changed files with 4 additions and 0 deletions
+2
View File
@@ -832,6 +832,8 @@ class DKIM(DomainSigner):
pk = nacl.signing.SigningKey(privkey, encoder=nacl.encoding.Base64Encoder)
except NameError:
raise NaClNotFoundError('pynacl module required for ed25519 signing, see README.md')
except nacl.exceptions.ValueError:
raise KeyFormatError('invalid ed25519 private key or format')
if identity is not None and not identity.endswith(domain):
raise ParameterError("identity must end with domain")