diff options
author | Stef Walter <stef@thewalter.net> | 2014-09-05 15:46:51 +0200 |
---|---|---|
committer | Stef Walter <stef@thewalter.net> | 2014-09-05 15:46:51 +0200 |
commit | c3fc7b49890bef7c28c1315476c6270d8ed1a492 (patch) | |
tree | d6bc4e94e21405ed285331c5af3af6377d6a753e | |
parent | d715fe5312f7b7c1b881cc49847cc15347e286fc (diff) |
trust: Show public-key-info in 'trust list --details'
Since the public-key-info is an important part of the way we
represent trust, show it in 'trust list' if --details is present.
-rw-r--r-- | trust/list.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/trust/list.c b/trust/list.c index a7fa4d9..c3f5759 100644 --- a/trust/list.c +++ b/trust/list.c @@ -44,6 +44,7 @@ #include "message.h" #include "pkcs11x.h" #include "tool.h" +#include "url.h" #include "p11-kit/iter.h" @@ -83,11 +84,13 @@ static bool list_iterate (p11_enumerate *ex, bool details) { + unsigned char *bytes; CK_OBJECT_HANDLE object; CK_ATTRIBUTE *attr; CK_ULONG klass; CK_ULONG category; CK_BBOOL val; + p11_buffer buf; CK_RV rv; const char *nick; char *string; @@ -142,6 +145,17 @@ list_iterate (p11_enumerate *ex, printf (" category: %s\n", nick); } + if (details) { + attr = p11_attrs_find_valid (ex->attrs, CKA_X_PUBLIC_KEY_INFO); + if (attr) { + p11_buffer_init (&buf, 1024); + bytes = attr->pValue; + p11_url_encode (bytes, bytes + attr->ulValueLen, "", &buf); + printf (" public-key-info: %.*s\n", (int)buf.len, (char *)buf.data); + p11_buffer_uninit (&buf); + } + } + printf ("\n"); } |