aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDavid Baker <dbkr@users.noreply.github.com>2018-10-12 08:24:45 +0100
committerGitHub <noreply@github.com>2018-10-12 08:24:45 +0100
commitb1130fb77f0bcaa436a5308bd1093b0e94aa6585 (patch)
tree0224871c07b0a98989e122c1937606a1857a2aa4 /tests
parentb2d91f55ece853ca1a398d3c6814f18a3f10bee0 (diff)
parent50ed20f61e76c4569c001cf8acb6e5bc361957b3 (diff)
Merge pull request #61 from matrix-org/dbkr/pk_private_export_import
Work with PkDecryption keys by their private keys
Diffstat (limited to 'tests')
-rw-r--r--tests/test_pk.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/test_pk.cpp b/tests/test_pk.cpp
index ee12603..42cc8c9 100644
--- a/tests/test_pk.cpp
+++ b/tests/test_pk.cpp
@@ -36,7 +36,7 @@ const std::uint8_t *bob_public = (std::uint8_t *) "3p7bfXt9wbTTW2HC7OQ1Nz+DQ8hbe
std::uint8_t pubkey[::olm_pk_key_length()];
-olm_pk_generate_key(
+olm_pk_key_from_private(
decryption,
pubkey, sizeof(pubkey),
alice_private, sizeof(alice_private)
@@ -44,6 +44,11 @@ olm_pk_generate_key(
assert_equals(alice_public, pubkey, olm_pk_key_length());
+uint8_t *alice_private_back_out = (uint8_t *)malloc(olm_pk_private_key_length());
+olm_pk_get_private_key(decryption, alice_private_back_out, olm_pk_private_key_length());
+assert_equals(alice_private, alice_private_back_out, olm_pk_private_key_length());
+free(alice_private_back_out);
+
std::uint8_t encryption_buffer[olm_pk_encryption_size()];
OlmPkEncryption *encryption = olm_pk_encryption(encryption_buffer);
@@ -105,7 +110,7 @@ const std::uint8_t *alice_public = (std::uint8_t *) "hSDwCYkwp1R0i33ctD73Wg2/Og0
std::uint8_t pubkey[olm_pk_key_length()];
-olm_pk_generate_key(
+olm_pk_key_from_private(
decryption,
pubkey, sizeof(pubkey),
alice_private, sizeof(alice_private)