|
|
@ -609,8 +609,8 @@ class DkimKeyField(fields.String):
|
|
|
|
|
|
|
|
|
|
|
|
# check key validity
|
|
|
|
# check key validity
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
serialization.load_pem_private_key(value, password=None)
|
|
|
|
serialization.load_pem_private_key(bytes(value, "ascii"), password=None)
|
|
|
|
except crypto.Error as exc:
|
|
|
|
except (UnicodeEncodeError, ValueError) as exc:
|
|
|
|
raise ValidationError(f'invalid dkim key {bad_key!r}') from exc
|
|
|
|
raise ValidationError(f'invalid dkim key {bad_key!r}') from exc
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return value
|
|
|
|
return value
|
|
|
|