summaryrefslogtreecommitdiff
path: root/tests/dn.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2015-06-01 14:34:57 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2015-06-02 08:50:16 +0200
commitff04ce2f22b58cf5dee5347e7fc11d130fc7ff90 (patch)
tree66d960cde4b6ae372c6d4faf4137a615aaabb796 /tests/dn.c
parentc18644935bc61be1a2d6bca2c3929a23495377a6 (diff)
downloadgnutls-ff04ce2f22b58cf5dee5347e7fc11d130fc7ff90.tar.gz
tests: added check for gnutls_x509_dn_get_str
Diffstat (limited to 'tests/dn.c')
-rw-r--r--tests/dn.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/dn.c b/tests/dn.c
index 05710fda3b..97c3ea1041 100644
--- a/tests/dn.c
+++ b/tests/dn.c
@@ -89,6 +89,7 @@ void doit(void)
int ret;
gnutls_datum_t pem_cert = { (unsigned char *) pem, sizeof(pem) };
gnutls_x509_crt_t cert;
+ gnutls_datum_t strdn;
gnutls_x509_dn_t xdn;
ret = global_init();
@@ -116,6 +117,15 @@ void doit(void)
if (ret < 0)
fail("get_subject %d\n", ret);
+ ret = gnutls_x509_dn_get_str(xdn, &strdn);
+ if (ret < 0)
+ fail("gnutls_x509_dn_get_str %d\n", ret);
+
+ if (strdn.size != 44 || strcmp((char*)strdn.data, "CN=CAcert WoT User,EMAIL=simon@josefsson.org") != 0) {
+ fail("gnutls_x509_dn_get_str string comparison failed: '%s'/%d\n", strdn.data, strdn.size);
+ }
+ gnutls_free(strdn.data);
+
if (debug) {
printf("Subject:\n");
print_dn(xdn);