1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _PKTOOL_COMMON_H 28 #define _PKTOOL_COMMON_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 /* 33 * This file contains data and functions shared between all the 34 * modules that comprise this tool. 35 */ 36 37 #ifdef __cplusplus 38 extern "C" { 39 #endif 40 41 #include <cryptoutil.h> 42 43 /* I18N helpers. */ 44 #include <libintl.h> 45 #include <locale.h> 46 47 /* Error codes */ 48 #define PK_ERR_NONE 0 49 #define PK_ERR_USAGE 1 50 #define PK_ERR_QUIT 2 51 #define PK_ERR_PK11INIT 3 52 #define PK_ERR_PK11SLOTS 4 53 #define PK_ERR_PK11SESSION 5 54 #define PK_ERR_PK11LOGIN 6 55 #define PK_ERR_PK11SETPIN 7 56 #define PK_ERR_NOSLOTS 8 57 #define PK_ERR_NOMEMORY 9 58 #define PK_ERR_NOTFOUND 10 59 #define PK_ERR_PASSPHRASE 11 60 #define PK_ERR_NEWPIN 12 61 #define PK_ERR_PINCONFIRM 13 62 #define PK_ERR_PINMATCH 14 63 #define PK_ERR_CHANGEPIN 15 64 65 extern int pk11_errno; 66 67 extern int get_password(char *prompt, char **password); 68 extern int init_pk11(void); 69 extern int find_token_slot(char *token_name, char *manuf_id, 70 char *serial_no, CK_SLOT_ID *slot_id, CK_FLAGS *pin_state); 71 extern int login_token(CK_SLOT_ID slot_id, CK_UTF8CHAR_PTR pin, 72 CK_ULONG pinlen, CK_SESSION_HANDLE_PTR hdl); 73 extern void logout_token(CK_SESSION_HANDLE hdl); 74 75 #ifdef __cplusplus 76 } 77 #endif 78 79 #endif /* _PKTOOL_COMMON_H */ 80