Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DuniterPy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
python
DuniterPy
Commits
45a105cf
Commit
45a105cf
authored
6 years ago
by
Vincent Texier
Browse files
Options
Downloads
Patches
Plain Diff
[fix]
#74
Support binary signed data (Break BC)
parent
cc7e2fc5
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
duniterpy/key/verifying_key.py
+6
-6
6 additions, 6 deletions
duniterpy/key/verifying_key.py
examples/verify_binary_signed_message.py
+1
-1
1 addition, 1 deletion
examples/verify_binary_signed_message.py
with
7 additions
and
7 deletions
duniterpy/key/verifying_key.py
+
6
−
6
View file @
45a105cf
...
@@ -58,13 +58,13 @@ class VerifyingKey(libnacl.sign.Verifier):
...
@@ -58,13 +58,13 @@ class VerifyingKey(libnacl.sign.Verifier):
except
ValueError
:
except
ValueError
:
return
False
return
False
def
verif
y_message
(
self
,
message
:
bytes
)
->
str
:
def
get_
verif
ied_data
(
self
,
data
:
bytes
)
->
bytes
:
"""
"""
Check specified signed
message
signature and return
message
Check specified signed
data
signature and return
data
R
eturn error message
if signature is
i
nvalid
R
aise exception
if signature is n
ot
valid
:param
bytes message: Message
+ signature
:param
data: Data
+ signature
:return
str
:
:return:
"""
"""
return
self
.
verify
(
message
).
decode
(
'
utf-8
'
)
return
self
.
verify
(
data
)
This diff is collapsed.
Click to expand it.
examples/verify_binary_signed_message.py
+
1
−
1
View file @
45a105cf
...
@@ -23,7 +23,7 @@ if __name__ == '__main__':
...
@@ -23,7 +23,7 @@ if __name__ == '__main__':
# Verify the message!
# Verify the message!
verifier
=
VerifyingKey
(
pubkeyBase58
)
verifier
=
VerifyingKey
(
pubkeyBase58
)
try
:
try
:
message
=
verifier
.
verif
y_message
(
signed_message
)
message
=
verifier
.
get_
verif
ied_data
(
signed_message
)
.
decode
(
'
utf-8
'
)
print
(
"
Signature valid for this message:
"
)
print
(
"
Signature valid for this message:
"
)
except
ValueError
as
error
:
except
ValueError
as
error
:
message
=
str
(
error
)
message
=
str
(
error
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment