Mercurial > illumos > illumos-gate
changeset 4006:ae098b2a8faa
6541084 pktool list objtype=key displays incorrect information
6542216 pktool and mac/decrypt didn't use same 'enter pin' string.
author | hylee |
---|---|
date | Tue, 10 Apr 2007 16:14:57 -0700 |
parents | 7f159f75c1e1 |
children | c6f5c6753018 |
files | usr/src/cmd/cmd-crypto/pktool/common.h usr/src/cmd/cmd-crypto/pktool/list.c |
diffstat | 2 files changed, 6 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/cmd-crypto/pktool/common.h Tue Apr 10 13:53:12 2007 -0700 +++ b/usr/src/cmd/cmd-crypto/pktool/common.h Tue Apr 10 16:14:57 2007 -0700 @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -122,7 +122,7 @@ int get_token_password(KMF_KEYSTORE_TYPE, char *, KMF_CREDENTIAL *); void display_error(void *, KMF_RETURN, char *); #define DEFAULT_NSS_TOKEN "internal" -#define DEFAULT_TOKEN_PROMPT "Enter pin for %s: " +#define DEFAULT_TOKEN_PROMPT "Enter PIN for %s: " #define EMPTYSTRING(s) (s == NULL || !strlen((char *)s))
--- a/usr/src/cmd/cmd-crypto/pktool/list.c Tue Apr 10 13:53:12 2007 -0700 +++ b/usr/src/cmd/cmd-crypto/pktool/list.c Tue Apr 10 16:14:57 2007 -0700 @@ -132,28 +132,6 @@ } -static char * -keybitstr(KMF_KEY_HANDLE *key) -{ - KMF_RAW_SYM_KEY *rkey; - char keystr[256]; - char *p; - - if (key == NULL || (key->keyclass != KMF_SYMMETRIC)) - return (""); - - rkey = (KMF_RAW_SYM_KEY *)key->keyp; - (void) memset(keystr, 0, sizeof (keystr)); - if (rkey != NULL) { - (void) snprintf(keystr, sizeof (keystr), - " (%d bits)", rkey->keydata.len * 8); - p = keystr; - } else { - return (""); - } - - return (p); -} static void pk_show_keys(void *handle, KMF_KEY_HANDLE *keys, int numkeys) @@ -161,20 +139,19 @@ int i; for (i = 0; i < numkeys; i++) { - (void) fprintf(stdout, gettext("Key #%d - %s: %s%s"), + (void) fprintf(stdout, gettext("Key #%d - %s: %s"), i+1, describeKey(&keys[i]), keys[i].keylabel ? keys[i].keylabel : - gettext("No label"), - (keys[i].keyclass == KMF_SYMMETRIC ? - keybitstr(&keys[i]) : "")); + gettext("No label")); if (keys[i].keyclass == KMF_SYMMETRIC) { KMF_RETURN rv; KMF_RAW_SYM_KEY rkey; + rv = KMF_GetSymKeyValue(handle, &keys[i], &rkey); if (rv == KMF_OK) { - (void) fprintf(stdout, "\t %d bits", + (void) fprintf(stdout, " (%d bits)", rkey.keydata.len * 8); KMF_FreeRawSymKey(&rkey); }