Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Olm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
Olm
Commits
f8c61b8f
Commit
f8c61b8f
authored
7 years ago
by
Richard van der Hoff
Browse files
Options
Downloads
Patches
Plain Diff
Python: Make ed25519_verify take some arguments
It's not much use if everything is hardcoded.
parent
853ea8fb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
python/olm/__main__.py
+28
-8
28 additions, 8 deletions
python/olm/__main__.py
python/test_olm.sh
+6
-3
6 additions, 3 deletions
python/test_olm.sh
with
34 additions
and
11 deletions
python/olm/__main__.py
+
28
−
8
View file @
f8c61b8f
...
...
@@ -65,11 +65,25 @@ def build_arg_parser():
account
.
unpickle
(
args
.
key
,
read_base64_file
(
args
.
account_file
))
print
(
account
.
identity_keys
()[
'
curve25519
'
])
id_key
=
commands
.
add_parser
(
"
identity_key
"
,
help
=
"
Get the identity key for an account
"
)
id_key
=
commands
.
add_parser
(
"
identity_key
"
,
help
=
"
Get the public part of the identity key for an account
"
,
)
id_key
.
add_argument
(
"
account_file
"
,
help
=
"
Local account file
"
)
id_key
.
set_defaults
(
func
=
do_id_key
)
def
do_signing_key
(
args
):
account
=
Account
()
account
.
unpickle
(
args
.
key
,
read_base64_file
(
args
.
account_file
))
print
(
account
.
identity_keys
()[
'
ed25519
'
])
signing_key
=
commands
.
add_parser
(
"
signing_key
"
,
help
=
"
Get the public part of the signing key for an account
"
,
)
signing_key
.
add_argument
(
"
account_file
"
,
help
=
"
Local account file
"
)
signing_key
.
set_defaults
(
func
=
do_signing_key
)
def
do_one_time_key
(
args
):
account
=
Account
()
account
.
unpickle
(
args
.
key
,
read_base64_file
(
args
.
account_file
))
...
...
@@ -346,6 +360,16 @@ def build_arg_parser():
ed25519_verify
=
commands
.
add_parser
(
"
ed25519_verify
"
,
help
=
"
Verify an ed25519 signature
"
)
ed25519_verify
.
add_argument
(
"
signing_key
"
,
help
=
"
Public signing key used to create the signature
"
)
ed25519_verify
.
add_argument
(
"
signature
"
,
help
=
"
Signature to be verified
"
)
ed25519_verify
.
add_argument
(
"
message_file
"
,
help
=
"
Message file (default stdin)
"
,
type
=
argparse
.
FileType
(
'
r
'
),
nargs
=
'
?
'
,
default
=
sys
.
stdin
)
ed25519_verify
.
set_defaults
(
func
=
do_verify_ed25519_signature
)
return
parser
...
...
@@ -434,12 +458,8 @@ def do_export_inbound_group(args):
def
do_verify_ed25519_signature
(
args
):
account
=
Account
()
account
.
create
()
message
=
"
A Message
"
.
encode
(
"
ASCII
"
)
ed25519_key
=
account
.
identity_keys
()[
"
ed25519
"
].
encode
(
"
utf-8
"
)
signature
=
account
.
sign
(
message
)
ed25519_verify
(
ed25519_key
,
message
,
signature
)
message
=
args
.
message_file
.
read
()
ed25519_verify
(
args
.
signing_key
,
message
,
args
.
signature
)
if
__name__
==
'
__main__
'
:
...
...
This diff is collapsed.
Click to expand it.
python/test_olm.sh
+
6
−
3
View file @
f8c61b8f
#! /bin/bash
set
-e
cd
`
dirname
$0
`
OLM
=
"python -m olm"
...
...
@@ -38,6 +40,7 @@ $OLM group_decrypt $BOB_GROUP_SESSION group_message
$OLM
export_inbound_group
$BOB_GROUP_SESSION
|
$OLM
import_inbound_group
$CHARLIE_GROUP_SESSION
$OLM
group_decrypt
$CHARLIE_GROUP_SESSION
group_message
### Utility
$OLM
ed25519_verify
### Sign/verify
ALICE_SIGNING_KEY
=
"
$(
$OLM
signing_key
$ALICE_ACCOUNT
)
"
sig
=
"
$(
echo
"Test message"
|
$OLM
sign
$ALICE_ACCOUNT
- -
)
"
echo
"Test message"
|
$OLM
ed25519_verify
$ALICE_SIGNING_KEY
$sig
-
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