summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDmitry Baryshkov <dbaryshkov@gmail.com>2020-05-24 18:49:23 +0000
committerDmitry Baryshkov <dbaryshkov@gmail.com>2020-05-24 18:49:23 +0000
commitd4da78171ea106628a77c07bcca594a4a3fb1e0e (patch)
tree5dd974d2a6b3f0c478b502c0574bc63468cbbf5e /lib
parente6ba23adfbb10d38aa406fc075ef118e832f790a (diff)
parenta79c1b931c116bdda2559d31b14a509e16a8fd93 (diff)
downloadgnutls-d4da78171ea106628a77c07bcca594a4a3fb1e0e.tar.gz
Merge branch 'x509-common-name' into 'master'
x509: support commonName extension Closes #989 See merge request gnutls/gnutls!1250
Diffstat (limited to 'lib')
-rw-r--r--lib/x509/output.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/x509/output.c b/lib/x509/output.c
index a41e4963df..705e8babfa 100644
--- a/lib/x509/output.c
+++ b/lib/x509/output.c
@@ -1262,6 +1262,22 @@ static void print_extension(gnutls_buffer_st * str, const char *prefix,
critical ? _("critical") : _("not critical"));
print_issuer_sign_tool(str, prefix, der);
+ } else if (strcmp(oid, "2.5.4.3") == 0) {
+ int ret;
+ gnutls_datum_t tmp = {NULL, 0};
+
+ addf(str, _("%s\t\tCommon Name (%s):\n"),
+ prefix,
+ critical ? _("critical") : _("not critical"));
+
+ ret = _gnutls_x509_decode_string(ASN1_ETYPE_PRINTABLE_STRING, der->data, der->size, &tmp, 0);
+ if (ret < 0) {
+ addf(str, "error: x509_decode_string: %s\n",
+ gnutls_strerror(ret));
+ } else {
+ addf(str, "%s\t\t\t%s\n", prefix, tmp.data);
+ gnutls_free(tmp.data);
+ }
} else {
addf(str, _("%s\t\tUnknown extension %s (%s):\n"),
prefix, oid,