aboutsummaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorpik <alexander.maznev@gmail.com>2017-04-22 08:11:43 -0500
committerRichard van der Hoff <richard@matrix.org>2017-04-24 12:29:45 +0100
commita3e5beab8969b09ba2e17407376aab0475f6cdc7 (patch)
treec86a9198015248680fddd39825b4364b24b7dca1 /python
parente632bc9e52578d7d73733f64e8ab30e485fc9d8a (diff)
Add ed25519_verify to __init__.py and add test for ed25519_verify
Signed-off-by: Alexander Maznev <alexander.maznev@gmail.com>
Diffstat (limited to 'python')
-rw-r--r--python/olm/__init__.py1
-rwxr-xr-xpython/olm/__main__.py10
-rwxr-xr-xpython/test_olm.sh4
3 files changed, 15 insertions, 0 deletions
diff --git a/python/olm/__init__.py b/python/olm/__init__.py
index 31b29b9..f74cbcb 100644
--- a/python/olm/__init__.py
+++ b/python/olm/__init__.py
@@ -2,3 +2,4 @@ from .account import Account
from .session import Session
from .outbound_group_session import OutboundGroupSession
from .inbound_group_session import InboundGroupSession
+from .utility import ed25519_verify
diff --git a/python/olm/__main__.py b/python/olm/__main__.py
index cb7f164..5546b9e 100755
--- a/python/olm/__main__.py
+++ b/python/olm/__main__.py
@@ -312,6 +312,8 @@ def build_arg_parser():
)
export_inbound_group.set_defaults(func=do_export_inbound_group)
+ ed25519_verify = commands.add_parser("ed25519_verify", help="Verify an ed25519 signature")
+ ed25519_verify.set_defaults(func=do_verify_ed25519_signature)
return parser
def do_outbound_group(args):
@@ -390,6 +392,14 @@ def do_export_inbound_group(args):
index = session.first_known_index()
args.export_file.write(session.export_session(index))
+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)
+
if __name__ == '__main__':
parser = build_arg_parser()
args = parser.parse_args()
diff --git a/python/test_olm.sh b/python/test_olm.sh
index 7c90daf..6ba92b6 100755
--- a/python/test_olm.sh
+++ b/python/test_olm.sh
@@ -37,3 +37,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