summaryrefslogtreecommitdiff
path: root/tests/pubkey-import-export.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/pubkey-import-export.c')
-rw-r--r--tests/pubkey-import-export.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/pubkey-import-export.c b/tests/pubkey-import-export.c
index 46bfb729d9..b11ce560d6 100644
--- a/tests/pubkey-import-export.c
+++ b/tests/pubkey-import-export.c
@@ -168,6 +168,7 @@ int check_pubkey_import_export(void)
gnutls_datum_t p, q, g, y, x;
gnutls_datum_t m, e;
gnutls_ecc_curve_t curve;
+ unsigned bits;
int ret;
global_init();
@@ -180,6 +181,11 @@ int check_pubkey_import_export(void)
if (ret < 0)
fail("error\n");
+ bits = 0;
+ ret = gnutls_pubkey_get_pk_algorithm(key, &bits);
+ if (ret <= 0 || bits == 0)
+ fail("error: %s [%u]\n", gnutls_strerror(ret), bits);
+
ret = gnutls_pubkey_export_dsa_raw2(key, &p, &q, &g, &y, 0);
if (ret < 0)
fail("error: %s\n", gnutls_strerror(ret));
@@ -216,6 +222,11 @@ int check_pubkey_import_export(void)
if (ret < 0)
fail("error\n");
+ bits = 0;
+ ret = gnutls_pubkey_get_pk_algorithm(key, &bits);
+ if (ret <= 0 || bits == 0)
+ fail("error: %s [%u]\n", gnutls_strerror(ret), bits);
+
ret = gnutls_pubkey_export_rsa_raw2(key, &m, &e, 0);
if (ret < 0)
fail("error\n");
@@ -244,6 +255,11 @@ int check_pubkey_import_export(void)
if (ret < 0)
fail("error\n");
+ bits = 0;
+ ret = gnutls_pubkey_get_pk_algorithm(key, &bits);
+ if (ret <= 0 || bits == 0)
+ fail("error: %s [%u]\n", gnutls_strerror(ret), bits);
+
ret = gnutls_pubkey_export_ecc_raw2(key, &curve, &x, &y, 0);
if (ret < 0)
fail("error\n");
@@ -285,6 +301,11 @@ int check_pubkey_import_export(void)
if (ret < 0)
fail("error\n");
+ bits = 0;
+ ret = gnutls_pubkey_get_pk_algorithm(key, &bits);
+ if (ret <= 0 || bits == 0)
+ fail("error: %s [%u]\n", gnutls_strerror(ret), bits);
+
ret = gnutls_pubkey_verify_params(key);
if (ret != 0)
fail("error: %s\n", gnutls_strerror(ret));