Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sakia
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
clients
python
sakia
Commits
b7b7b210
Commit
b7b7b210
authored
12 years ago
by
Donald Stufft
Browse files
Options
Downloads
Patches
Plain Diff
Properly handle bytes <-> str for Python 3
parent
bfe36dcf
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_signing.py
+9
-8
9 additions, 8 deletions
tests/test_signing.py
with
9 additions
and
8 deletions
tests/test_signing.py
+
9
−
8
View file @
b7b7b210
from
__future__
import
division
from
__future__
import
division
import
binascii
import
binascii
import
codecs
import
os
import
os
import
pytest
import
pytest
...
@@ -14,15 +15,15 @@ def ed25519_known_answers():
...
@@ -14,15 +15,15 @@ def ed25519_known_answers():
answers
=
[]
answers
=
[]
path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"
data
"
,
"
ed25519
"
)
path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"
data
"
,
"
ed25519
"
)
with
open
(
path
,
"
r
"
)
as
fp
:
with
codecs
.
open
(
path
,
"
r
"
,
encoding
=
"
utf-8
"
)
as
fp
:
for
line
in
fp
:
for
line
in
fp
:
x
=
line
.
split
(
"
:
"
)
x
=
line
.
split
(
"
:
"
)
answers
.
append
({
answers
.
append
({
"
seed
"
:
x
[
0
][
0
:
64
],
"
seed
"
:
x
[
0
][
0
:
64
]
.
encode
(
"
ascii
"
)
,
"
public_key
"
:
x
[
1
],
"
public_key
"
:
x
[
1
]
.
encode
(
"
ascii
"
)
,
"
message
"
:
x
[
2
],
"
message
"
:
x
[
2
]
.
encode
(
"
ascii
"
)
,
"
signed
"
:
x
[
3
],
"
signed
"
:
x
[
3
]
.
encode
(
"
ascii
"
)
,
"
signature
"
:
binascii
.
hexlify
(
binascii
.
unhexlify
(
x
[
3
])[:
64
]),
"
signature
"
:
binascii
.
hexlify
(
binascii
.
unhexlify
(
x
[
3
]
.
encode
(
"
ascii
"
)
)[:
64
]),
})
})
return
answers
return
answers
...
@@ -68,8 +69,8 @@ class TestVerifyKey:
...
@@ -68,8 +69,8 @@ class TestVerifyKey:
def
test_invalid_signed_message
(
self
):
def
test_invalid_signed_message
(
self
):
skey
=
nacl
.
signing
.
SigningKey
.
generate
()
skey
=
nacl
.
signing
.
SigningKey
.
generate
()
smessage
=
skey
.
sign
(
"
A Test Message!
"
)
smessage
=
skey
.
sign
(
b
"
A Test Message!
"
)
signature
,
message
=
smessage
.
signature
,
"
A Forged Test Message!
"
signature
,
message
=
smessage
.
signature
,
b
"
A Forged Test Message!
"
# Small sanity check
# Small sanity check
assert
skey
.
verify_key
.
verify
(
smessage
)
assert
skey
.
verify_key
.
verify
(
smessage
)
...
...
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