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