about summary refs log tree commit diff
path: root/src/libnm-core-impl/tests/test-crypto.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2022-08-12 19:21:11 +0200
committerMichael Biebl <biebl@debian.org>2022-08-12 19:21:11 +0200
commit6accbd3ec0e42d8633bbde4d47ed7bfe854e7e0b (patch)
treea77a0617213a5183a4de43824e3fbae9779e9b8e /src/libnm-core-impl/tests/test-crypto.c
parentf7c750061dab327e638c0129cfafd5b2215b3a2e (diff)
New upstream version 1.38.4 upstream/1.38.4
Diffstat (limited to 'src/libnm-core-impl/tests/test-crypto.c')
-rw-r--r--src/libnm-core-impl/tests/test-crypto.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/libnm-core-impl/tests/test-crypto.c b/src/libnm-core-impl/tests/test-crypto.c
index 896c3c2e..fb4c213f 100644
--- a/src/libnm-core-impl/tests/test-crypto.c
+++ b/src/libnm-core-impl/tests/test-crypto.c
@@ -111,7 +111,7 @@ test_load_private_key(const char *path,
 
     array = nmtst_crypto_decrypt_openssl_private_key(path, password, &key_type, &error);
     /* Even if the password is wrong, we should determine the key type */
-    g_assert_cmpint(key_type, ==, NM_CRYPTO_KEY_TYPE_RSA);
+    g_assert_cmpint(key_type, !=, NM_CRYPTO_KEY_TYPE_UNKNOWN);
 
     if (expected_error != -1) {
         g_assert(array == NULL);
@@ -226,7 +226,7 @@ test_encrypt_private_key(const char *path, const char *password)
 
     array = nmtst_crypto_decrypt_openssl_private_key(path, password, &key_type, &error);
     nmtst_assert_success(array, error);
-    g_assert_cmpint(key_type, ==, NM_CRYPTO_KEY_TYPE_RSA);
+    g_assert_cmpint(key_type, !=, NM_CRYPTO_KEY_TYPE_UNKNOWN);
 
     /* Now re-encrypt the private key */
     encrypted = nmtst_crypto_rsa_key_encrypt(g_bytes_get_data(array, NULL),
@@ -244,7 +244,7 @@ test_encrypt_private_key(const char *path, const char *password)
                                                                  &key_type,
                                                                  &error);
     nmtst_assert_success(re_decrypted, error);
-    g_assert_cmpint(key_type, ==, NM_CRYPTO_KEY_TYPE_RSA);
+    g_assert_cmpint(key_type, !=, NM_CRYPTO_KEY_TYPE_UNKNOWN);
 
     /* Compare the original decrypted key with the re-decrypted key */
     g_assert(g_bytes_equal(array, re_decrypted));
@@ -452,12 +452,21 @@ main(int argc, char **argv)
     g_test_add_data_func("/libnm/crypto/key/aes-128",
                          "test-aes-128-key.pem, test-aes-password",
                          test_key);
+    g_test_add_data_func("/libnm/crypto/key/aes-128-ec",
+                         "test-aes-128-ec-key.pem, test-aes-password",
+                         test_key);
     g_test_add_data_func("/libnm/crypto/key/aes-256",
                          "test-aes-256-key.pem, test-aes-password",
                          test_key);
+    g_test_add_data_func("/libnm/crypto/key/aes-256-ec",
+                         "test-aes-256-ec-key.pem, test-aes-password",
+                         test_key);
     g_test_add_data_func("/libnm/crypto/key/decrypted",
                          "test-key-only-decrypted.pem",
                          test_key_decrypted);
+    g_test_add_data_func("/libnm/crypto/key/decrypted-ec",
+                         "test-ec-key-only-decrypted.pem",
+                         test_key_decrypted);
 
     g_test_add_data_func("/libnm/crypto/PKCS#12/1", "test-cert.p12, test", test_pkcs12);
     g_test_add_data_func("/libnm/crypto/PKCS#12/2", "test2-cert.p12, 12345testing", test_pkcs12);