pkcs11.c

来自「支持SSL v2/v3, TLS, PKCS #5, PKCS #7, PKCS」· C语言 代码 · 共 1,963 行 · 第 1/5 页

C
1,963
字号
/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.mozilla.org/MPL/ *  * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. *  * The Original Code is the Netscape security libraries. *  * The Initial Developer of the Original Code is Netscape * Communications Corporation.  Portions created by Netscape are  * Copyright (C) 1994-2000 Netscape Communications Corporation.  All * Rights Reserved. *  * Contributor(s): *  * Alternatively, the contents of this file may be used under the * terms of the GNU General Public License Version 2 or later (the * "GPL"), in which case the provisions of the GPL are applicable  * instead of those above.  If you wish to allow use of your  * version of this file only under the terms of the GPL and not to * allow others to use your version of this file under the MPL, * indicate your decision by deleting the provisions above and * replace them with the notice and other provisions required by * the GPL.  If you do not delete the provisions above, a recipient * may use your version of this file under either the MPL or the * GPL. *//* * This file implements PKCS 11 on top of our existing security modules * * For more information about PKCS 11 See PKCS 11 Token Inteface Standard. *   This implementation has two slots: *	slot 1 is our generic crypto support. It does not require login. *   It supports Public Key ops, and all they bulk ciphers and hashes.  *   It can also support Private Key ops for imported Private keys. It does  *   not have any token storage. *	slot 2 is our private key support. It requires a login before use. It *   can store Private Keys and Certs as token objects. Currently only private *   keys and their associated Certificates are saved on the token. * *   In this implementation, session objects are only visible to the session *   that created or generated them. */#include "seccomon.h"#include "secitem.h"#include "pkcs11.h"#include "pkcs11i.h"#include "softoken.h"#include "cert.h"#include "keylow.h"#include "blapi.h"#include "secder.h"#include "secport.h"#include "certdb.h"#include "private.h" /* * ******************** Static data ******************************* *//* The next three strings must be exactly 32 characters long */static char *manufacturerID      = "Netscape Communications Corp    ";static char *libraryDescription  = "Communicator Internal Crypto Svc";static char *tokDescription      = "Communicator Generic Crypto Svcs";static char *privTokDescription  = "Communicator Certificate DB     ";/* The next two strings must be exactly 64 characters long, with the   first 32 characters meaningful  */static char *slotDescription     = 	"Communicator Internal Cryptographic Services Version 4.0        ";static char *privSlotDescription = 	"Communicator User Private Key and Certificate Services          ";static int minimumPinLen = 0;#define __PASTE(x,y)    x##y/* * we renamed all our internal functions, get the correct * definitions for them... */ #undef CK_PKCS11_FUNCTION_INFO#undef CK_NEED_ARG_LIST#define CK_EXTERN extern#define CK_PKCS11_FUNCTION_INFO(func) \		CK_RV __PASTE(NS,func)#define CK_NEED_ARG_LIST	1 #include "pkcs11f.h"   /* build the crypto module table */static CK_FUNCTION_LIST pk11_funcList = {    { 1, 10 }, #undef CK_PKCS11_FUNCTION_INFO#undef CK_NEED_ARG_LIST #define CK_PKCS11_FUNCTION_INFO(func) \				__PASTE(NS,func),#include "pkcs11f.h" }; #undef CK_PKCS11_FUNCTION_INFO#undef CK_NEED_ARG_LIST  #undef __PASTE/* List of DES Weak Keys */ typedef unsigned char desKey[8];static desKey  pk11_desWeakTable[] = {#ifdef noParity    /* weak */    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },    { 0x1e, 0x1e, 0x1e, 0x1e, 0x0e, 0x0e, 0x0e, 0x0e },    { 0xe0, 0xe0, 0xe0, 0xe0, 0xf0, 0xf0, 0xf0, 0xf0 },    { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },    /* semi-weak */    { 0x00, 0xfe, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0xfe },    { 0xfe, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0xfe },    { 0x1e, 0xe0, 0x1e, 0xe0, 0x0e, 0xf0, 0x0e, 0xf0 },    { 0xe0, 0x1e, 0xe0, 0x1e, 0xf0, 0x0e, 0xf0, 0x0e },    { 0x00, 0xe0, 0x00, 0xe0, 0x00, 0x0f, 0x00, 0x0f },    { 0xe0, 0x00, 0xe0, 0x00, 0xf0, 0x00, 0xf0, 0x00 },    { 0x1e, 0xfe, 0x1e, 0xfe, 0x0e, 0xfe, 0x0e, 0xfe },    { 0xfe, 0x1e, 0xfe, 0x1e, 0xfe, 0x0e, 0xfe, 0x0e },    { 0x00, 0x1e, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0x0e },    { 0x1e, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0x0e, 0x00 },    { 0xe0, 0xfe, 0xe0, 0xfe, 0xf0, 0xfe, 0xf0, 0xfe },    { 0xfe, 0xe0, 0xfe, 0xe0, 0xfe, 0xf0, 0xfe, 0xf0 },#else    /* weak */    { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 },    { 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e },    { 0xe0, 0xe0, 0xe0, 0xe0, 0xf1, 0xf1, 0xf1, 0xf1 },    { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },    /* semi-weak */    { 0x01, 0xfe, 0x01, 0xfe, 0x01, 0xfe, 0x01, 0xfe },    { 0xfe, 0x01, 0xfe, 0x01, 0xfe, 0x01, 0xfe, 0x01 },    { 0x1f, 0xe0, 0x1f, 0xe0, 0x0e, 0xf1, 0x0e, 0xf1 },    { 0xe0, 0x1f, 0xe0, 0x1f, 0xf1, 0x0e, 0xf1, 0x0e },    { 0x01, 0xe0, 0x01, 0xe0, 0x01, 0xf1, 0x01, 0xf1 },    { 0xe0, 0x01, 0xe0, 0x01, 0xf1, 0x01, 0xf1, 0x01 },    { 0x1f, 0xfe, 0x1f, 0xfe, 0x0e, 0xfe, 0x0e, 0xfe },    { 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x0e, 0xfe, 0x0e },    { 0x01, 0x1f, 0x01, 0x1f, 0x01, 0x0e, 0x01, 0x0e },    { 0x1f, 0x01, 0x1f, 0x01, 0x0e, 0x01, 0x0e, 0x01 },    { 0xe0, 0xfe, 0xe0, 0xfe, 0xf1, 0xfe, 0xf1, 0xfe },    { 0xfe, 0xe0, 0xfe, 0xe0, 0xfe, 0xf1, 0xfe, 0xf1 }#endif};    static int pk11_desWeakTableSize = sizeof(pk11_desWeakTable)/						sizeof(pk11_desWeakTable[0]);/* DES KEY Parity conversion table. Takes each byte/2 as an index, returns * that byte with the proper parity bit set */static unsigned char parityTable[256] = {/* Even...0x00,0x02,0x04,0x06,0x08,0x0a,0x0c,0x0e *//* E */   0x01,0x02,0x04,0x07,0x08,0x0b,0x0d,0x0e,/* Odd....0x10,0x12,0x14,0x16,0x18,0x1a,0x1c,0x1e *//* O */   0x10,0x13,0x15,0x16,0x19,0x1a,0x1c,0x1f,/* Odd....0x20,0x22,0x24,0x26,0x28,0x2a,0x2c,0x2e *//* O */   0x20,0x23,0x25,0x26,0x29,0x2a,0x2c,0x2f,/* Even...0x30,0x32,0x34,0x36,0x38,0x3a,0x3c,0x3e *//* E */   0x31,0x32,0x34,0x37,0x38,0x3b,0x3d,0x3e,/* Odd....0x40,0x42,0x44,0x46,0x48,0x4a,0x4c,0x4e *//* O */   0x40,0x43,0x45,0x46,0x49,0x4a,0x4c,0x4f,/* Even...0x50,0x52,0x54,0x56,0x58,0x5a,0x5c,0x5e *//* E */   0x51,0x52,0x54,0x57,0x58,0x5b,0x5d,0x5e,/* Even...0x60,0x62,0x64,0x66,0x68,0x6a,0x6c,0x6e *//* E */   0x61,0x62,0x64,0x67,0x68,0x6b,0x6d,0x6e,/* Odd....0x70,0x72,0x74,0x76,0x78,0x7a,0x7c,0x7e *//* O */   0x70,0x73,0x75,0x76,0x79,0x7a,0x7c,0x7f,/* Odd....0x80,0x82,0x84,0x86,0x88,0x8a,0x8c,0x8e *//* O */   0x80,0x83,0x85,0x86,0x89,0x8a,0x8c,0x8f,/* Even...0x90,0x92,0x94,0x96,0x98,0x9a,0x9c,0x9e *//* E */   0x91,0x92,0x94,0x97,0x98,0x9b,0x9d,0x9e,/* Even...0xa0,0xa2,0xa4,0xa6,0xa8,0xaa,0xac,0xae *//* E */   0xa1,0xa2,0xa4,0xa7,0xa8,0xab,0xad,0xae,/* Odd....0xb0,0xb2,0xb4,0xb6,0xb8,0xba,0xbc,0xbe *//* O */   0xb0,0xb3,0xb5,0xb6,0xb9,0xba,0xbc,0xbf,/* Even...0xc0,0xc2,0xc4,0xc6,0xc8,0xca,0xcc,0xce *//* E */   0xc1,0xc2,0xc4,0xc7,0xc8,0xcb,0xcd,0xce,/* Odd....0xd0,0xd2,0xd4,0xd6,0xd8,0xda,0xdc,0xde *//* O */   0xd0,0xd3,0xd5,0xd6,0xd9,0xda,0xdc,0xdf,/* Odd....0xe0,0xe2,0xe4,0xe6,0xe8,0xea,0xec,0xee *//* O */   0xe0,0xe3,0xe5,0xe6,0xe9,0xea,0xec,0xef,/* Even...0xf0,0xf2,0xf4,0xf6,0xf8,0xfa,0xfc,0xfe *//* E */   0xf1,0xf2,0xf4,0xf7,0xf8,0xfb,0xfd,0xfe,};/* Mechanisms */struct mechanismList {    CK_MECHANISM_TYPE	type;    CK_MECHANISM_INFO	domestic;    PRBool		privkey;};/* * the following table includes a complete list of mechanism defined by * PKCS #11 version 2.01. Those Mechanisms not supported by this PKCS #11 * module are ifdef'ed out. */#define CKF_EN_DE		CKF_ENCRYPT      | CKF_DECRYPT#define CKF_WR_UN		CKF_WRAP         | CKF_UNWRAP#define CKF_SN_VR		CKF_SIGN         | CKF_VERIFY#define CKF_SN_RE		CKF_SIGN_RECOVER | CKF_VERIFY_RECOVER#define CKF_EN_DE_WR_UN 	CKF_EN_DE       | CKF_WR_UN#define CKF_SN_VR_RE		CKF_SN_VR       | CKF_SN_RE#define CKF_DUZ_IT_ALL		CKF_EN_DE_WR_UN | CKF_SN_VR_REstatic struct mechanismList mechanisms[] = {     /* ------------------------- RSA Operations ---------------------------*/     {CKM_RSA_PKCS_KEY_PAIR_GEN,{128, 2048, CKF_GENERATE_KEY_PAIR}, PR_TRUE},     {CKM_RSA_PKCS,		{ 16,  256, CKF_DUZ_IT_ALL},	PR_TRUE},#ifdef PK11_RSA9796_SUPPORTED     {CKM_RSA_9796,		{ 16,  256, CKF_DUZ_IT_ALL},	PR_TRUE}, #endif     {CKM_RSA_X_509,		{ 16,  256, CKF_DUZ_IT_ALL},	PR_TRUE},      /* -------------- RSA Multipart Signing Operations -------------------- */     {CKM_MD2_RSA_PKCS,		{16, 256, CKF_SN_VR}, 		PR_TRUE},     {CKM_MD5_RSA_PKCS,		{16, 256, CKF_SN_VR}, 		PR_TRUE},     {CKM_SHA1_RSA_PKCS,	{16, 256, CKF_SN_VR}, 		PR_TRUE},     /* ------------------------- DSA Operations --------------------------- */     {CKM_DSA_KEY_PAIR_GEN,	{64, 128, CKF_GENERATE_KEY_PAIR}, PR_TRUE},     {CKM_DSA,			{64, 128, CKF_SN_VR}, 		PR_TRUE},     {CKM_DSA_SHA1,		{64, 128, CKF_SN_VR}, 		PR_TRUE},     /* -------------------- Diffie Hellman Operations --------------------- */     /* no diffie hellman yet */     {CKM_DH_PKCS_KEY_PAIR_GEN,	{16, 128, CKF_GENERATE_KEY_PAIR}, PR_TRUE},      {CKM_DH_PKCS_DERIVE,	{16, 128, CKF_DERIVE}, 		PR_TRUE},      /* ------------------------- RC2 Operations --------------------------- */     {CKM_RC2_KEY_GEN,		{1, 128, CKF_GENERATE},		PR_FALSE},     {CKM_RC2_ECB,		{1, 128, CKF_EN_DE_WR_UN},	PR_FALSE},     {CKM_RC2_CBC,		{1, 128, CKF_EN_DE_WR_UN},	PR_FALSE},     {CKM_RC2_MAC,		{1, 128, CKF_SN_VR},		PR_FALSE},     {CKM_RC2_MAC_GENERAL,	{1, 128, CKF_SN_VR},		PR_FALSE},     {CKM_RC2_CBC_PAD,		{1, 128, CKF_EN_DE_WR_UN},	PR_FALSE},     /* ------------------------- RC4 Operations --------------------------- */     {CKM_RC4_KEY_GEN,		{1, 256, CKF_GENERATE},		PR_FALSE},     {CKM_RC4,			{1, 256, CKF_EN_DE_WR_UN},	PR_FALSE},     /* ------------------------- DES Operations --------------------------- */     {CKM_DES_KEY_GEN,		{ 8,  8, CKF_GENERATE},		PR_FALSE},     {CKM_DES_ECB,		{ 8,  8, CKF_EN_DE_WR_UN},	PR_FALSE},     {CKM_DES_CBC,		{ 8,  8, CKF_EN_DE_WR_UN},	PR_FALSE},     {CKM_DES_MAC,		{ 8,  8, CKF_SN_VR},		PR_FALSE},     {CKM_DES_MAC_GENERAL,	{ 8,  8, CKF_SN_VR},		PR_FALSE},     {CKM_DES_CBC_PAD,		{ 8,  8, CKF_EN_DE_WR_UN},	PR_FALSE},     {CKM_DES2_KEY_GEN,		{24, 24, CKF_GENERATE},		PR_FALSE},     {CKM_DES3_KEY_GEN,		{24, 24, CKF_GENERATE},		PR_TRUE },     {CKM_DES3_ECB,		{24, 24, CKF_EN_DE_WR_UN},	PR_TRUE },     {CKM_DES3_CBC,		{24, 24, CKF_EN_DE_WR_UN},	PR_TRUE },     {CKM_DES3_MAC,		{24, 24, CKF_SN_VR},		PR_TRUE },     {CKM_DES3_MAC_GENERAL,	{24, 24, CKF_SN_VR},		PR_TRUE },     {CKM_DES3_CBC_PAD,		{24, 24, CKF_EN_DE_WR_UN},	PR_TRUE },     /* ------------------------- CDMF Operations --------------------------- */     {CKM_CDMF_KEY_GEN,		{8,  8, CKF_GENERATE},		PR_FALSE},     {CKM_CDMF_ECB,		{8,  8, CKF_EN_DE_WR_UN},	PR_FALSE},     {CKM_CDMF_CBC,		{8,  8, CKF_EN_DE_WR_UN},	PR_FALSE},     {CKM_CDMF_MAC,		{8,  8, CKF_SN_VR},		PR_FALSE},     {CKM_CDMF_MAC_GENERAL,	{8,  8, CKF_SN_VR},		PR_FALSE},     {CKM_CDMF_CBC_PAD,		{8,  8, CKF_EN_DE_WR_UN},	PR_FALSE},     /* ------------------------- Hashing Operations ----------------------- */     {CKM_MD2,			{0,   0, CKF_DIGEST},		PR_FALSE},     {CKM_MD2_HMAC,		{1, 128, CKF_SN_VR},		PR_FALSE},     {CKM_MD2_HMAC_GENERAL,	{1, 128, CKF_SN_VR},		PR_FALSE},     {CKM_MD5,			{0,   0, CKF_DIGEST},		PR_FALSE},     {CKM_MD5_HMAC,		{1, 128, CKF_SN_VR},		PR_FALSE},     {CKM_MD5_HMAC_GENERAL,	{1, 128, CKF_SN_VR},		PR_FALSE},     {CKM_SHA_1,		{0,   0, CKF_DIGEST},		PR_FALSE},     {CKM_SHA_1_HMAC,		{1, 128, CKF_SN_VR},		PR_FALSE},     {CKM_SHA_1_HMAC_GENERAL,	{1, 128, CKF_SN_VR},		PR_FALSE},     {CKM_TLS_PRF_GENERAL,	{0, 512, CKF_SN_VR},		PR_FALSE},     /* ------------------------- CAST Operations --------------------------- */#ifdef PK11_CAST_SUPPORTED     /* Cast operations are not supported ( yet? ) */     {CKM_CAST_KEY_GEN,		{1,  8, CKF_GENERATE},		PR_FALSE},      {CKM_CAST_ECB,		{1,  8, CKF_EN_DE_WR_UN},	PR_FALSE},      {CKM_CAST_CBC,		{1,  8, CKF_EN_DE_WR_UN},	PR_FALSE},      {CKM_CAST_MAC,		{1,  8, CKF_SN_VR},		PR_FALSE},      {CKM_CAST_MAC_GENERAL,	{1,  8, CKF_SN_VR},		PR_FALSE},      {CKM_CAST_CBC_PAD,		{1,  8, CKF_EN_DE_WR_UN},	PR_FALSE},      {CKM_CAST3_KEY_GEN,	{1, 16, CKF_GENERATE},		PR_FALSE},      {CKM_CAST3_ECB,		{1, 16, CKF_EN_DE_WR_UN},	PR_FALSE},      {CKM_CAST3_CBC,		{1, 16, CKF_EN_DE_WR_UN},	PR_FALSE},      {CKM_CAST3_MAC,		{1, 16, CKF_SN_VR},		PR_FALSE},      {CKM_CAST3_MAC_GENERAL,	{1, 16, CKF_SN_VR},		PR_FALSE},      {CKM_CAST3_CBC_PAD,	{1, 16, CKF_EN_DE_WR_UN},	PR_FALSE},      {CKM_CAST5_KEY_GEN,	{1, 16, CKF_GENERATE},		PR_FALSE},      {CKM_CAST5_ECB,		{1, 16, CKF_EN_DE_WR_UN},	PR_FALSE},      {CKM_CAST5_CBC,		{1, 16, CKF_EN_DE_WR_UN},	PR_FALSE},      {CKM_CAST5_MAC,		{1, 16, CKF_SN_VR},		PR_FALSE},      {CKM_CAST5_MAC_GENERAL,	{1, 16, CKF_SN_VR},		PR_FALSE},      {CKM_CAST5_CBC_PAD,	{1, 16, CKF_EN_DE_WR_UN},	PR_FALSE}, #endif#if NSS_SOFTOKEN_DOES_RC5     /* ------------------------- RC5 Operations --------------------------- */     {CKM_RC5_KEY_GEN,		{1, 255, CKF_GENERATE}, 	PR_FALSE},     {CKM_RC5_ECB,		{1, 255, CKF_EN_DE_WR_UN},	PR_FALSE},     {CKM_RC5_CBC,		{1, 255, CKF_EN_DE_WR_UN},	PR_FALSE},     {CKM_RC5_MAC,		{1, 255, CKF_SN_VR},  		PR_FALSE},     {CKM_RC5_MAC_GENERAL,	{1, 255, CKF_SN_VR},  		PR_FALSE},     {CKM_RC5_CBC_PAD,		{1, 255, CKF_EN_DE_WR_UN}, 	PR_FALSE},#endif#ifdef PK11_IDEA_SUPPORTED     /* ------------------------- IDEA Operations -------------------------- */     {CKM_IDEA_KEY_GEN,		{16, 16, CKF_GENERATE}, 	PR_FALSE},      {CKM_IDEA_ECB,		{16, 16, CKF_EN_DE_WR_UN},	PR_FALSE},      {CKM_IDEA_CBC,		{16, 16, CKF_EN_DE_WR_UN},	PR_FALSE},      {CKM_IDEA_MAC,		{16, 16, CKF_SN_VR},		PR_FALSE},      {CKM_IDEA_MAC_GENERAL,	{16, 16, CKF_SN_VR},		PR_FALSE},      {CKM_IDEA_CBC_PAD,		{16, 16, CKF_EN_DE_WR_UN}, 	PR_FALSE}, #endif     /* --------------------- Secret Key Operations ------------------------ */     {CKM_GENERIC_SECRET_KEY_GEN,	{1, 256, CKF_GENERATE}, PR_FALSE},      {CKM_CONCATENATE_BASE_AND_KEY,	{1, 256, CKF_GENERATE}, PR_FALSE},      {CKM_CONCATENATE_BASE_AND_DATA,	{1, 256, CKF_GENERATE}, PR_FALSE},      {CKM_CONCATENATE_DATA_AND_BASE,	{1, 256, CKF_GENERATE}, PR_FALSE},      {CKM_XOR_BASE_AND_DATA,		{1, 256, CKF_GENERATE}, PR_FALSE},      {CKM_EXTRACT_KEY_FROM_KEY,		{1, 256, CKF_DERIVE},   PR_FALSE},      /* ---------------------- SSL Key Derivations ------------------------- */     {CKM_SSL3_PRE_MASTER_KEY_GEN,	{48, 48, CKF_GENERATE}, PR_FALSE},      {CKM_SSL3_MASTER_KEY_DERIVE,	{48, 48, CKF_DERIVE},   PR_FALSE},      {CKM_SSL3_KEY_AND_MAC_DERIVE,	{48, 48, CKF_DERIVE},   PR_FALSE},      {CKM_SSL3_MD5_MAC,			{ 0, 16, CKF_DERIVE},   PR_FALSE},      {CKM_SSL3_SHA1_MAC,		{ 0, 20, CKF_DERIVE},   PR_FALSE},      {CKM_MD5_KEY_DERIVATION,		{ 0, 16, CKF_DERIVE},   PR_FALSE},      {CKM_MD2_KEY_DERIVATION,		{ 0, 16, CKF_DERIVE},   PR_FALSE},      {CKM_SHA1_KEY_DERIVATION,		{ 0, 20, CKF_DERIVE},   PR_FALSE},      {CKM_TLS_MASTER_KEY_DERIVE,	{48, 48, CKF_DERIVE},   PR_FALSE},      {CKM_TLS_KEY_AND_MAC_DERIVE,	{48, 48, CKF_DERIVE},   PR_FALSE},      /* ---------------------- PBE Key Derivations  ------------------------ */     {CKM_PBE_MD2_DES_CBC,		{64, 64, CKF_DERIVE},   PR_TRUE},     {CKM_PBE_MD5_DES_CBC,		{64, 64, CKF_DERIVE},   PR_TRUE},     /* ------------------ NETSCAPE PBE Key Derivations  ------------------- */     {CKM_NETSCAPE_PBE_SHA1_DES_CBC,	     { 64,  64, CKF_GENERATE}, PR_TRUE},     {CKM_NETSCAPE_PBE_SHA1_TRIPLE_DES_CBC,  {192, 192, CKF_GENERATE}, PR_TRUE},     {CKM_NETSCAPE_PBE_SHA1_FAULTY_3DES_CBC, {192, 192, CKF_GENERATE}, PR_TRUE},     {CKM_NETSCAPE_PBE_SHA1_40_BIT_RC2_CBC,  { 40,  40, CKF_GENERATE}, PR_TRUE},     {CKM_NETSCAPE_PBE_SHA1_128_BIT_RC2_CBC, {128, 128, CKF_GENERATE}, PR_TRUE},     {CKM_NETSCAPE_PBE_SHA1_40_BIT_RC4,	     { 40,  40, CKF_GENERATE}, PR_TRUE},     {CKM_NETSCAPE_PBE_SHA1_128_BIT_RC4,     {128, 128, CKF_GENERATE}, PR_TRUE},     {CKM_PBE_SHA1_DES3_EDE_CBC,	     {192, 192, CKF_GENERATE}, PR_TRUE},     {CKM_PBE_SHA1_DES2_EDE_CBC,	     {192, 192, CKF_GENERATE}, PR_TRUE},     {CKM_PBE_SHA1_RC2_40_CBC,		     { 40,  40, CKF_GENERATE}, PR_TRUE},     {CKM_PBE_SHA1_RC2_128_CBC,		     {128, 128, CKF_GENERATE}, PR_TRUE},     {CKM_PBE_SHA1_RC4_40,		     { 40,  40, CKF_GENERATE}, PR_TRUE},     {CKM_PBE_SHA1_RC4_128,		     {128, 128, CKF_GENERATE}, PR_TRUE},};static CK_ULONG mechanismCount = sizeof(mechanisms)/sizeof(mechanisms[0]);/* load up our token database */static CK_RV pk11_importKeyDB(PK11Slot *slot);/* * Configuration utils */voidPK11_ConfigurePKCS11(char *man, char *libdes, char *tokdes, char *ptokdes,	char *slotdes, char *pslotdes, char *fslotdes, char *fpslotdes,	int minPwd, int pwRequired) {    /* make sure the internationalization was done correctly... */    if (man && (PORT_Strlen(man) == 33)) {	manufacturerID = man;    }    if (libdes && (PORT_Strlen(libdes) == 33)) {	libraryDescription = libdes;    }    if (tokdes && (PORT_Strlen(tokdes) == 33)) {

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?