diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2017-10-21 15:01:53 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2017-10-21 15:02:00 +0200 |
commit | 7fc2d925824b23451c99986364e67a703a9eb0aa (patch) | |
tree | 538b4592ab46b80641f29ec6b6369c4bab26148d /src | |
parent | 1b98c73104364c6b57d56b76b9faa01148deaaf1 (diff) | |
download | gnutls-7fc2d925824b23451c99986364e67a703a9eb0aa.tar.gz |
p11tool: print PKCS#11 token flags in --list-tokens
Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/pkcs11.c | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/src/pkcs11.c b/src/pkcs11.c index cb90b876a7..9a84982494 100644 --- a/src/pkcs11.c +++ b/src/pkcs11.c @@ -676,6 +676,94 @@ void print_type(FILE *outfile, unsigned flags) if (print == 0) fputs("Generic token", outfile); fputc('\n', outfile); + + print = 0; + fputs("\tFlags: ", outfile); + if (flags & GNUTLS_PKCS11_TOKEN_RNG) { + fputs("RNG", outfile); + print++; + } + + if (flags & GNUTLS_PKCS11_TOKEN_LOGIN_REQUIRED) { + if (print != 0) + fputs(", ", outfile); + fputs("Requires login", outfile); + print++; + } + + if (flags & GNUTLS_PKCS11_TOKEN_PROTECTED_AUTHENTICATION_PATH) { + if (print != 0) + fputs(", ", outfile); + fputs("External PIN", outfile); + print++; + } + + if (!(flags & GNUTLS_PKCS11_TOKEN_INITIALIZED)) { + if (print != 0) + fputs(", ", outfile); + fputs("Uninitialized", outfile); + print++; + } + + if (flags & GNUTLS_PKCS11_TOKEN_USER_PIN_COUNT_LOW) { + if (print != 0) + fputs(", ", outfile); + fputs("uPIN low count", outfile); + print++; + } + + if (flags & GNUTLS_PKCS11_TOKEN_USER_PIN_FINAL_TRY) { + if (print != 0) + fputs(", ", outfile); + fputs("Final uPIN attempt", outfile); + print++; + } + + if (flags & GNUTLS_PKCS11_TOKEN_USER_PIN_FINAL_TRY) { + if (print != 0) + fputs(", ", outfile); + fputs("uPIN locked", outfile); + print++; + } + + if (flags & GNUTLS_PKCS11_TOKEN_SO_PIN_COUNT_LOW) { + if (print != 0) + fputs(", ", outfile); + fputs("SO-PIN low count", outfile); + print++; + } + + if (flags & GNUTLS_PKCS11_TOKEN_SO_PIN_FINAL_TRY) { + if (print != 0) + fputs(", ", outfile); + fputs("Final SO-PIN attempt", outfile); + print++; + } + + if (flags & GNUTLS_PKCS11_TOKEN_SO_PIN_FINAL_TRY) { + if (print != 0) + fputs(", ", outfile); + fputs("SO-PIN locked", outfile); + print++; + } + + if (!(flags & GNUTLS_PKCS11_TOKEN_USER_PIN_INITIALIZED)) { + if (print != 0) + fputs(", ", outfile); + fputs("uPIN uninitialized", outfile); + print++; + } + + if (flags & GNUTLS_PKCS11_TOKEN_ERROR_STATE) { + if (print != 0) + fputs(", ", outfile); + fputs("Error state", outfile); + print++; + } + + if (print == 0) + fputs("Generic token", outfile); + fputc('\n', outfile); } void |