Show More
@@ -1,5 +1,5 b'' | |||
|
1 | 1 | import base64 |
|
2 | from ecdsa import SigningKey, VerifyingKey | |
|
2 | from ecdsa import SigningKey, VerifyingKey, BadSignatureError | |
|
3 | 3 | from django.db import models |
|
4 | 4 | |
|
5 | 5 | TYPE_ECDSA = 'ecdsa' |
@@ -30,8 +30,7 b' class KeyPairManager(models.Manager):' | |||
|
30 | 30 | public = VerifyingKey.from_pem(public_key_str) |
|
31 | 31 | signature_byte = base64.b64decode(signature) |
|
32 | 32 | try: |
|
33 | return public.verify(signature_byte, | |
|
34 | string.encode()) | |
|
33 | return public.verify(signature_byte, string.encode()) | |
|
35 | 34 | except BadSignatureError: |
|
36 | 35 | return False |
|
37 | 36 | else: |
General Comments 0
You need to be logged in to leave comments.
Login now