mirror of
https://github.com/r4sas/py-i2phosts
synced 2025-02-03 10:24:20 +00:00
validation.py: fix EdDSA support
This commit is contained in:
parent
e6c301b379
commit
2634ae7c8e
@ -105,8 +105,8 @@ def validate_b64hash(data, check_uniq=True):
|
||||
if length == 516 and re.match(r'[a-zA-Z0-9\-~]+AA$', data) == None:
|
||||
raise ValidationError(_('Invalid base64 hash'))
|
||||
# check ECDSA validity
|
||||
if length == 524 and re.match(r'[a-zA-Z0-9\-~]+AEAAEAAA==$', data) == None:
|
||||
raise ValidationError(_('Invalid base64 ECDSA hash'))
|
||||
if length == 524 and re.match(r'[a-zA-Z0-9\-~]+AEAA[Ec]AAA==$', data) == None:
|
||||
raise ValidationError(_('Invalid base64 ECDSA or EdDSA hash'))
|
||||
if check_uniq == True:
|
||||
# Avoid adding non-unique hashes
|
||||
qs = i2phost.objects.filter(b64hash=data)
|
||||
|
Loading…
x
Reference in New Issue
Block a user