/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* This file implements the token list operation for this tool.
* It loads the PKCS#11 modules, gets the list of slots with
* tokens in them, displays the list, and cleans up.
*/
#include <stdio.h>
#include <string.h>
#include <cryptoutil.h>
#include <security/cryptoki.h>
#include "common.h"
/*
* Lists all slots with tokens in them.
*/
int
{
int i;
/* Get rid of subcommand word "tokens". */
argc--;
argv++;
/* No additional args allowed. */
if (argc != 0)
return (PK_ERR_USAGE);
/* Done parsing command line options. */
/* Get the list of slots with tokens in them. */
gettext("Unable to get token slot list (%s)."),
return (PK_ERR_PK11);
}
/* Make sure we have something to display. */
if (slot_count == 0) {
return (0);
}
/* Display the list. */
for (i = 0; i < slot_count; i++) {
gettext("Unable to get slot %d token info (%s)."),
i, pkcs11_strerror(rv));
continue;
}
}
/* Clean up. */
(void) C_Finalize(NULL);
return (0);
}