Back to index

lightning-sunbird  0.9+nobinonly
pk11table.c
Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Mozilla Public License Version
00005  * 1.1 (the "License"); you may not use this file except in compliance with
00006  * the License. You may obtain a copy of the License at
00007  * http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS" basis,
00010  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00011  * for the specific language governing rights and limitations under the
00012  * License.
00013  *
00014  * The Original Code is the Netscape security libraries.
00015  *
00016  * The Initial Developer of the Original Code is
00017  * Netscape Communications Corporation.
00018  * Portions created by the Initial Developer are Copyright (C) 1994-2000
00019  * the Initial Developer. All Rights Reserved.
00020  *
00021  * Contributor(s):
00022  *
00023  * Alternatively, the contents of this file may be used under the terms of
00024  * either the GNU General Public License Version 2 or later (the "GPL"), or
00025  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00026  * in which case the provisions of the GPL or the LGPL are applicable instead
00027  * of those above. If you wish to allow use of your version of this file only
00028  * under the terms of either the GPL or the LGPL, and not to allow others to
00029  * use your version of this file under the terms of the MPL, indicate your
00030  * decision by deleting the provisions above and replace them with the notice
00031  * and other provisions required by the GPL or the LGPL. If you do not delete
00032  * the provisions above, a recipient may use your version of this file under
00033  * the terms of any one of the MPL, the GPL or the LGPL.
00034  *
00035  * ***** END LICENSE BLOCK ***** */
00036 
00037 #include <pkcs11.h>
00038 #include "pk11util.h"
00039 
00040 const char *_valueString[] = {
00041     "None",
00042     "Variable",
00043     "CK_ULONG",
00044     "Data",
00045     "UTF8",
00046     "CK_INFO",
00047     "CK_SLOT_INFO",
00048     "CK_TOKEN_INFO",
00049     "CK_SESSION_INFO",
00050     "CK_ATTRIBUTE",
00051     "CK_MECHANISM",
00052     "CK_MECHANISM_INFO",
00053     "CK_C_INITIALIZE_ARGS",
00054     "CK_FUNCTION_LIST"
00055 };
00056 
00057 const char **valueString = &_valueString[0];
00058 const int valueCount = sizeof(_valueString)/sizeof(_valueString[0]);
00059 
00060 const char *_constTypeString[] = {
00061     "None",
00062     "Bool",
00063     "InfoFlags",
00064     "SlotFlags",
00065     "TokenFlags",
00066     "SessionFlags",
00067     "MechanismFlags",
00068     "InitializeFlags",
00069     "Users",
00070     "SessionState",
00071     "Object",
00072     "Hardware",
00073     "KeyType",
00074     "CertificateType",
00075     "Attribute",
00076     "Mechanism",
00077     "Result",
00078     "Trust",
00079     "AvailableSizes",
00080     "CurrentSize"
00081 };
00082 
00083 const char **constTypeString = &_constTypeString[0];
00084 const int constTypeCount = sizeof(_constTypeString)/sizeof(_constTypeString[0]);
00085 
00086 #define mkEntry(x,t) { #x, x, Const##t, ConstNone }
00087 #define mkEntry2(x,t,t2) { #x, x, Const##t, Const##t2 }
00088 
00089 const Constant _consts[] = {
00090        mkEntry(CK_FALSE, Bool),
00091        mkEntry(CK_TRUE, Bool),
00092 
00093        mkEntry(CKF_TOKEN_PRESENT, SlotFlags),
00094        mkEntry(CKF_REMOVABLE_DEVICE, SlotFlags),
00095        mkEntry(CKF_HW_SLOT, SlotFlags),
00096 
00097        mkEntry(CKF_RNG, TokenFlags),
00098        mkEntry(CKF_WRITE_PROTECTED, TokenFlags),
00099        mkEntry(CKF_LOGIN_REQUIRED, TokenFlags),
00100        mkEntry(CKF_USER_PIN_INITIALIZED, TokenFlags),
00101        mkEntry(CKF_RESTORE_KEY_NOT_NEEDED, TokenFlags),
00102        mkEntry(CKF_CLOCK_ON_TOKEN, TokenFlags),
00103        mkEntry(CKF_PROTECTED_AUTHENTICATION_PATH, TokenFlags),
00104        mkEntry(CKF_DUAL_CRYPTO_OPERATIONS, TokenFlags),
00105        mkEntry(CKF_TOKEN_INITIALIZED, TokenFlags),
00106        mkEntry(CKF_SECONDARY_AUTHENTICATION, TokenFlags),
00107        mkEntry(CKF_USER_PIN_COUNT_LOW, TokenFlags),
00108        mkEntry(CKF_USER_PIN_FINAL_TRY, TokenFlags),
00109        mkEntry(CKF_USER_PIN_LOCKED, TokenFlags),
00110        mkEntry(CKF_USER_PIN_TO_BE_CHANGED, TokenFlags),
00111        mkEntry(CKF_SO_PIN_COUNT_LOW, TokenFlags),
00112        mkEntry(CKF_SO_PIN_FINAL_TRY, TokenFlags),
00113        mkEntry(CKF_SO_PIN_LOCKED, TokenFlags),
00114        mkEntry(CKF_SO_PIN_TO_BE_CHANGED, TokenFlags),
00115 
00116        mkEntry(CKF_RW_SESSION, SessionFlags),
00117        mkEntry(CKF_SERIAL_SESSION, SessionFlags),
00118 
00119        mkEntry(CKF_HW, MechanismFlags),
00120        mkEntry(CKF_ENCRYPT, MechanismFlags),
00121        mkEntry(CKF_DECRYPT, MechanismFlags),
00122        mkEntry(CKF_DIGEST, MechanismFlags),
00123        mkEntry(CKF_SIGN, MechanismFlags),
00124        mkEntry(CKF_SIGN_RECOVER, MechanismFlags),
00125        mkEntry(CKF_VERIFY, MechanismFlags),
00126        mkEntry(CKF_VERIFY_RECOVER, MechanismFlags),
00127        mkEntry(CKF_GENERATE, MechanismFlags),
00128        mkEntry(CKF_GENERATE_KEY_PAIR, MechanismFlags),
00129        mkEntry(CKF_WRAP, MechanismFlags),
00130        mkEntry(CKF_UNWRAP, MechanismFlags),
00131        mkEntry(CKF_DERIVE, MechanismFlags),
00132        mkEntry(CKF_EC_FP, MechanismFlags),
00133        mkEntry(CKF_EC_F_2M, MechanismFlags),
00134        mkEntry(CKF_EC_ECPARAMETERS, MechanismFlags),
00135        mkEntry(CKF_EC_NAMEDCURVE, MechanismFlags),
00136        mkEntry(CKF_EC_UNCOMPRESS, MechanismFlags),
00137        mkEntry(CKF_EC_COMPRESS, MechanismFlags),
00138 
00139        mkEntry(CKF_LIBRARY_CANT_CREATE_OS_THREADS, InitializeFlags),
00140        mkEntry(CKF_OS_LOCKING_OK, InitializeFlags),
00141 
00142        mkEntry(CKU_SO, Users),
00143        mkEntry(CKU_USER, Users),
00144 
00145        mkEntry(CKS_RO_PUBLIC_SESSION, SessionState),
00146        mkEntry(CKS_RO_USER_FUNCTIONS, SessionState),
00147        mkEntry(CKS_RW_PUBLIC_SESSION, SessionState),
00148        mkEntry(CKS_RW_USER_FUNCTIONS, SessionState),
00149        mkEntry(CKS_RW_SO_FUNCTIONS, SessionState),
00150 
00151        mkEntry(CKO_DATA, Object),
00152        mkEntry(CKO_CERTIFICATE, Object),
00153        mkEntry(CKO_PUBLIC_KEY, Object),
00154        mkEntry(CKO_PRIVATE_KEY, Object),
00155        mkEntry(CKO_SECRET_KEY, Object),
00156        mkEntry(CKO_HW_FEATURE, Object),
00157        mkEntry(CKO_DOMAIN_PARAMETERS, Object),
00158        mkEntry(CKO_KG_PARAMETERS, Object),
00159        mkEntry(CKO_NETSCAPE_CRL, Object),
00160        mkEntry(CKO_NETSCAPE_SMIME, Object),
00161        mkEntry(CKO_NETSCAPE_TRUST, Object),
00162        mkEntry(CKO_NETSCAPE_BUILTIN_ROOT_LIST, Object),
00163 
00164        mkEntry(CKH_MONOTONIC_COUNTER, Hardware),
00165        mkEntry(CKH_CLOCK, Hardware),
00166 
00167        mkEntry(CKK_RSA, KeyType),
00168        mkEntry(CKK_DSA, KeyType),
00169        mkEntry(CKK_DH, KeyType),
00170        mkEntry(CKK_ECDSA, KeyType),
00171        mkEntry(CKK_EC, KeyType),
00172        mkEntry(CKK_X9_42_DH, KeyType),
00173        mkEntry(CKK_KEA, KeyType),
00174        mkEntry(CKK_GENERIC_SECRET, KeyType),
00175        mkEntry(CKK_RC2, KeyType),
00176        mkEntry(CKK_RC4, KeyType),
00177        mkEntry(CKK_DES, KeyType),
00178        mkEntry(CKK_DES2, KeyType),
00179        mkEntry(CKK_DES3, KeyType),
00180        mkEntry(CKK_CAST, KeyType),
00181        mkEntry(CKK_CAST3, KeyType),
00182        mkEntry(CKK_CAST5, KeyType),
00183        mkEntry(CKK_CAST128, KeyType),
00184        mkEntry(CKK_RC5, KeyType),
00185        mkEntry(CKK_IDEA, KeyType),
00186        mkEntry(CKK_SKIPJACK, KeyType),
00187        mkEntry(CKK_BATON, KeyType),
00188        mkEntry(CKK_JUNIPER, KeyType),
00189        mkEntry(CKK_CDMF, KeyType),
00190        mkEntry(CKK_AES, KeyType),
00191        mkEntry(CKK_NETSCAPE_PKCS8, KeyType),
00192 
00193        mkEntry(CKC_X_509, CertType),
00194        mkEntry(CKC_X_509_ATTR_CERT, CertType),
00195 
00196        mkEntry2(CKA_CLASS, Attribute, Object),
00197        mkEntry2(CKA_TOKEN, Attribute, Bool),
00198        mkEntry2(CKA_PRIVATE, Attribute, Bool),
00199        mkEntry2(CKA_LABEL, Attribute, None),
00200        mkEntry2(CKA_APPLICATION, Attribute, None),
00201        mkEntry2(CKA_VALUE, Attribute, None),
00202        mkEntry2(CKA_OBJECT_ID, Attribute, None),
00203        mkEntry2(CKA_CERTIFICATE_TYPE, Attribute, CertType),
00204        mkEntry2(CKA_ISSUER, Attribute, None),
00205        mkEntry2(CKA_SERIAL_NUMBER, Attribute, None),
00206        mkEntry2(CKA_AC_ISSUER, Attribute, None),
00207        mkEntry2(CKA_OWNER, Attribute, None),
00208        mkEntry2(CKA_ATTR_TYPES, Attribute, None),
00209        mkEntry2(CKA_TRUSTED, Attribute, Bool),
00210        mkEntry2(CKA_KEY_TYPE, Attribute, KeyType),
00211        mkEntry2(CKA_SUBJECT, Attribute, None),
00212        mkEntry2(CKA_ID, Attribute, None),
00213        mkEntry2(CKA_SENSITIVE, Attribute, Bool),
00214        mkEntry2(CKA_ENCRYPT, Attribute, Bool),
00215        mkEntry2(CKA_DECRYPT, Attribute, Bool),
00216        mkEntry2(CKA_WRAP, Attribute, Bool),
00217        mkEntry2(CKA_UNWRAP, Attribute, Bool),
00218        mkEntry2(CKA_SIGN, Attribute, Bool),
00219        mkEntry2(CKA_SIGN_RECOVER, Attribute, Bool),
00220        mkEntry2(CKA_VERIFY, Attribute, Bool),
00221        mkEntry2(CKA_VERIFY_RECOVER, Attribute, Bool),
00222        mkEntry2(CKA_DERIVE, Attribute, Bool),
00223        mkEntry2(CKA_START_DATE, Attribute, None),
00224        mkEntry2(CKA_END_DATE, Attribute, None),
00225        mkEntry2(CKA_MODULUS, Attribute, None),
00226        mkEntry2(CKA_MODULUS_BITS, Attribute, None),
00227        mkEntry2(CKA_PUBLIC_EXPONENT, Attribute, None),
00228        mkEntry2(CKA_PRIVATE_EXPONENT, Attribute, None),
00229        mkEntry2(CKA_PRIME_1, Attribute, None),
00230        mkEntry2(CKA_PRIME_2, Attribute, None),
00231        mkEntry2(CKA_EXPONENT_1, Attribute, None),
00232        mkEntry2(CKA_EXPONENT_2, Attribute, None),
00233        mkEntry2(CKA_COEFFICIENT, Attribute, None),
00234        mkEntry2(CKA_PRIME, Attribute, None),
00235        mkEntry2(CKA_SUBPRIME, Attribute, None),
00236        mkEntry2(CKA_BASE, Attribute, None),
00237        mkEntry2(CKA_PRIME_BITS, Attribute, None),
00238        mkEntry2(CKA_SUB_PRIME_BITS, Attribute, None),
00239        mkEntry2(CKA_VALUE_BITS, Attribute, None),
00240        mkEntry2(CKA_VALUE_LEN, Attribute, None),
00241        mkEntry2(CKA_EXTRACTABLE, Attribute, Bool),
00242        mkEntry2(CKA_LOCAL, Attribute, Bool),
00243        mkEntry2(CKA_NEVER_EXTRACTABLE, Attribute, Bool),
00244        mkEntry2(CKA_ALWAYS_SENSITIVE, Attribute, Bool),
00245        mkEntry2(CKA_KEY_GEN_MECHANISM, Attribute, Mechanism),
00246        mkEntry2(CKA_MODIFIABLE, Attribute, Bool),
00247        mkEntry2(CKA_ECDSA_PARAMS, Attribute, None),
00248        mkEntry2(CKA_EC_PARAMS, Attribute, None),
00249        mkEntry2(CKA_EC_POINT, Attribute, None),
00250        mkEntry2(CKA_SECONDARY_AUTH, Attribute, None),
00251        mkEntry2(CKA_AUTH_PIN_FLAGS, Attribute, None),
00252        mkEntry2(CKA_HW_FEATURE_TYPE, Attribute, Hardware),
00253        mkEntry2(CKA_RESET_ON_INIT, Attribute, Bool),
00254        mkEntry2(CKA_HAS_RESET, Attribute, Bool),
00255        mkEntry2(CKA_NETSCAPE_URL, Attribute, None),
00256        mkEntry2(CKA_NETSCAPE_EMAIL, Attribute, None),
00257        mkEntry2(CKA_NETSCAPE_SMIME_INFO, Attribute, None),
00258        mkEntry2(CKA_NETSCAPE_SMIME_TIMESTAMP, Attribute, None),
00259        mkEntry2(CKA_NETSCAPE_PKCS8_SALT, Attribute, None),
00260        mkEntry2(CKA_NETSCAPE_PASSWORD_CHECK, Attribute, None),
00261        mkEntry2(CKA_NETSCAPE_EXPIRES, Attribute, None),
00262        mkEntry2(CKA_NETSCAPE_KRL, Attribute, None),
00263        mkEntry2(CKA_NETSCAPE_PQG_COUNTER, Attribute, None),
00264        mkEntry2(CKA_NETSCAPE_PQG_SEED, Attribute, None),
00265        mkEntry2(CKA_NETSCAPE_PQG_H, Attribute, None),
00266        mkEntry2(CKA_NETSCAPE_PQG_SEED_BITS, Attribute, None),
00267        mkEntry2(CKA_TRUST_DIGITAL_SIGNATURE, Attribute, Trust),
00268        mkEntry2(CKA_TRUST_NON_REPUDIATION, Attribute, Trust),
00269        mkEntry2(CKA_TRUST_KEY_ENCIPHERMENT, Attribute, Trust),
00270        mkEntry2(CKA_TRUST_DATA_ENCIPHERMENT, Attribute, Trust),
00271        mkEntry2(CKA_TRUST_KEY_AGREEMENT, Attribute, Trust),
00272        mkEntry2(CKA_TRUST_KEY_CERT_SIGN, Attribute, Trust),
00273        mkEntry2(CKA_TRUST_CRL_SIGN, Attribute, Trust),
00274        mkEntry2(CKA_TRUST_SERVER_AUTH, Attribute, Trust),
00275        mkEntry2(CKA_TRUST_CLIENT_AUTH, Attribute, Trust),
00276        mkEntry2(CKA_TRUST_CODE_SIGNING, Attribute, Trust),
00277        mkEntry2(CKA_TRUST_EMAIL_PROTECTION, Attribute, Trust),
00278        mkEntry2(CKA_TRUST_IPSEC_END_SYSTEM, Attribute, Trust),
00279        mkEntry2(CKA_TRUST_IPSEC_TUNNEL, Attribute, Trust),
00280        mkEntry2(CKA_TRUST_IPSEC_USER, Attribute, Trust),
00281        mkEntry2(CKA_TRUST_TIME_STAMPING, Attribute, Trust),
00282        mkEntry2(CKA_CERT_SHA1_HASH, Attribute, None),
00283        mkEntry2(CKA_CERT_MD5_HASH, Attribute, None),
00284        mkEntry2(CKA_NETSCAPE_DB, Attribute, None),
00285        mkEntry2(CKA_NETSCAPE_TRUST, Attribute, Trust),
00286 
00287        mkEntry(CKM_RSA_PKCS, Mechanism),
00288        mkEntry(CKM_RSA_9796, Mechanism),
00289        mkEntry(CKM_RSA_X_509, Mechanism),
00290        mkEntry(CKM_RSA_PKCS_KEY_PAIR_GEN, Mechanism),
00291        mkEntry(CKM_MD2_RSA_PKCS, Mechanism),
00292        mkEntry(CKM_MD5_RSA_PKCS, Mechanism),
00293        mkEntry(CKM_SHA1_RSA_PKCS, Mechanism),
00294        mkEntry(CKM_RIPEMD128_RSA_PKCS, Mechanism),
00295        mkEntry(CKM_RIPEMD160_RSA_PKCS, Mechanism),
00296        mkEntry(CKM_RSA_PKCS_OAEP, Mechanism),
00297        mkEntry(CKM_RSA_X9_31_KEY_PAIR_GEN, Mechanism),
00298        mkEntry(CKM_RSA_X9_31, Mechanism),
00299        mkEntry(CKM_SHA1_RSA_X9_31, Mechanism),
00300        mkEntry(CKM_DSA_KEY_PAIR_GEN, Mechanism),
00301        mkEntry(CKM_DSA, Mechanism),
00302        mkEntry(CKM_DSA_SHA1, Mechanism),
00303        mkEntry(CKM_DH_PKCS_KEY_PAIR_GEN, Mechanism),
00304        mkEntry(CKM_DH_PKCS_DERIVE, Mechanism),
00305        mkEntry(CKM_X9_42_DH_DERIVE, Mechanism),
00306        mkEntry(CKM_X9_42_DH_HYBRID_DERIVE, Mechanism),
00307        mkEntry(CKM_X9_42_MQV_DERIVE, Mechanism),
00308        mkEntry(CKM_SHA256_RSA_PKCS, Mechanism),
00309        mkEntry(CKM_SHA384_RSA_PKCS, Mechanism),
00310        mkEntry(CKM_SHA512_RSA_PKCS, Mechanism),
00311        mkEntry(CKM_RC2_KEY_GEN, Mechanism),
00312        mkEntry(CKM_RC2_ECB, Mechanism),
00313        mkEntry(CKM_RC2_CBC, Mechanism),
00314        mkEntry(CKM_RC2_MAC, Mechanism),
00315        mkEntry(CKM_RC2_MAC_GENERAL, Mechanism),
00316        mkEntry(CKM_RC2_CBC_PAD, Mechanism),
00317        mkEntry(CKM_RC4_KEY_GEN, Mechanism),
00318        mkEntry(CKM_RC4, Mechanism),
00319        mkEntry(CKM_DES_KEY_GEN, Mechanism),
00320        mkEntry(CKM_DES_ECB, Mechanism),
00321        mkEntry(CKM_DES_CBC, Mechanism),
00322        mkEntry(CKM_DES_MAC, Mechanism),
00323        mkEntry(CKM_DES_MAC_GENERAL, Mechanism),
00324        mkEntry(CKM_DES_CBC_PAD, Mechanism),
00325        mkEntry(CKM_DES2_KEY_GEN, Mechanism),
00326        mkEntry(CKM_DES3_KEY_GEN, Mechanism),
00327        mkEntry(CKM_DES3_ECB, Mechanism),
00328        mkEntry(CKM_DES3_CBC, Mechanism),
00329        mkEntry(CKM_DES3_MAC, Mechanism),
00330        mkEntry(CKM_DES3_MAC_GENERAL, Mechanism),
00331        mkEntry(CKM_DES3_CBC_PAD, Mechanism),
00332        mkEntry(CKM_CDMF_KEY_GEN, Mechanism),
00333        mkEntry(CKM_CDMF_ECB, Mechanism),
00334        mkEntry(CKM_CDMF_CBC, Mechanism),
00335        mkEntry(CKM_CDMF_MAC, Mechanism),
00336        mkEntry(CKM_CDMF_MAC_GENERAL, Mechanism),
00337        mkEntry(CKM_CDMF_CBC_PAD, Mechanism),
00338        mkEntry(CKM_MD2, Mechanism),
00339        mkEntry(CKM_MD2_HMAC, Mechanism),
00340        mkEntry(CKM_MD2_HMAC_GENERAL, Mechanism),
00341        mkEntry(CKM_MD5, Mechanism),
00342        mkEntry(CKM_MD5_HMAC, Mechanism),
00343        mkEntry(CKM_MD5_HMAC_GENERAL, Mechanism),
00344        mkEntry(CKM_SHA_1, Mechanism),
00345        mkEntry(CKM_SHA_1_HMAC, Mechanism),
00346        mkEntry(CKM_SHA_1_HMAC_GENERAL, Mechanism),
00347        mkEntry(CKM_RIPEMD128, Mechanism),
00348        mkEntry(CKM_RIPEMD128_HMAC, Mechanism),
00349        mkEntry(CKM_RIPEMD128_HMAC_GENERAL, Mechanism),
00350        mkEntry(CKM_RIPEMD160, Mechanism),
00351        mkEntry(CKM_RIPEMD160_HMAC, Mechanism),
00352        mkEntry(CKM_RIPEMD160_HMAC_GENERAL, Mechanism),
00353        mkEntry(CKM_SHA256, Mechanism),
00354        mkEntry(CKM_SHA256_HMAC_GENERAL, Mechanism),
00355        mkEntry(CKM_SHA256_HMAC, Mechanism),
00356        mkEntry(CKM_SHA384, Mechanism),
00357        mkEntry(CKM_SHA384_HMAC_GENERAL, Mechanism),
00358        mkEntry(CKM_SHA384_HMAC, Mechanism),
00359        mkEntry(CKM_SHA512, Mechanism),
00360        mkEntry(CKM_SHA512_HMAC_GENERAL, Mechanism),
00361        mkEntry(CKM_SHA512_HMAC, Mechanism),
00362        mkEntry(CKM_CAST_KEY_GEN, Mechanism),
00363        mkEntry(CKM_CAST_ECB, Mechanism),
00364        mkEntry(CKM_CAST_CBC, Mechanism),
00365        mkEntry(CKM_CAST_MAC, Mechanism),
00366        mkEntry(CKM_CAST_MAC_GENERAL, Mechanism),
00367        mkEntry(CKM_CAST_CBC_PAD, Mechanism),
00368        mkEntry(CKM_CAST3_KEY_GEN, Mechanism),
00369        mkEntry(CKM_CAST3_ECB, Mechanism),
00370        mkEntry(CKM_CAST3_CBC, Mechanism),
00371        mkEntry(CKM_CAST3_MAC, Mechanism),
00372        mkEntry(CKM_CAST3_MAC_GENERAL, Mechanism),
00373        mkEntry(CKM_CAST3_CBC_PAD, Mechanism),
00374        mkEntry(CKM_CAST5_KEY_GEN, Mechanism),
00375        mkEntry(CKM_CAST128_KEY_GEN, Mechanism),
00376        mkEntry(CKM_CAST5_ECB, Mechanism),
00377        mkEntry(CKM_CAST128_ECB, Mechanism),
00378        mkEntry(CKM_CAST5_CBC, Mechanism),
00379        mkEntry(CKM_CAST128_CBC, Mechanism),
00380        mkEntry(CKM_CAST5_MAC, Mechanism),
00381        mkEntry(CKM_CAST128_MAC, Mechanism),
00382        mkEntry(CKM_CAST5_MAC_GENERAL, Mechanism),
00383        mkEntry(CKM_CAST128_MAC_GENERAL, Mechanism),
00384        mkEntry(CKM_CAST5_CBC_PAD, Mechanism),
00385        mkEntry(CKM_CAST128_CBC_PAD, Mechanism),
00386        mkEntry(CKM_RC5_KEY_GEN, Mechanism),
00387        mkEntry(CKM_RC5_ECB, Mechanism),
00388        mkEntry(CKM_RC5_CBC, Mechanism),
00389        mkEntry(CKM_RC5_MAC, Mechanism),
00390        mkEntry(CKM_RC5_MAC_GENERAL, Mechanism),
00391        mkEntry(CKM_RC5_CBC_PAD, Mechanism),
00392        mkEntry(CKM_IDEA_KEY_GEN, Mechanism),
00393        mkEntry(CKM_IDEA_ECB, Mechanism),
00394        mkEntry(CKM_IDEA_CBC, Mechanism),
00395        mkEntry(CKM_IDEA_MAC, Mechanism),
00396        mkEntry(CKM_IDEA_MAC_GENERAL, Mechanism),
00397        mkEntry(CKM_IDEA_CBC_PAD, Mechanism),
00398        mkEntry(CKM_GENERIC_SECRET_KEY_GEN, Mechanism),
00399        mkEntry(CKM_CONCATENATE_BASE_AND_KEY, Mechanism),
00400        mkEntry(CKM_CONCATENATE_BASE_AND_DATA, Mechanism),
00401        mkEntry(CKM_CONCATENATE_DATA_AND_BASE, Mechanism),
00402        mkEntry(CKM_XOR_BASE_AND_DATA, Mechanism),
00403        mkEntry(CKM_EXTRACT_KEY_FROM_KEY, Mechanism),
00404        mkEntry(CKM_SSL3_PRE_MASTER_KEY_GEN, Mechanism),
00405        mkEntry(CKM_SSL3_MASTER_KEY_DERIVE, Mechanism),
00406        mkEntry(CKM_SSL3_KEY_AND_MAC_DERIVE, Mechanism),
00407        mkEntry(CKM_SSL3_MASTER_KEY_DERIVE_DH, Mechanism),
00408        mkEntry(CKM_TLS_PRE_MASTER_KEY_GEN, Mechanism),
00409        mkEntry(CKM_TLS_MASTER_KEY_DERIVE, Mechanism),
00410        mkEntry(CKM_TLS_KEY_AND_MAC_DERIVE, Mechanism),
00411        mkEntry(CKM_TLS_MASTER_KEY_DERIVE_DH, Mechanism),
00412        mkEntry(CKM_SSL3_MD5_MAC, Mechanism),
00413        mkEntry(CKM_SSL3_SHA1_MAC, Mechanism),
00414        mkEntry(CKM_MD5_KEY_DERIVATION, Mechanism),
00415        mkEntry(CKM_MD2_KEY_DERIVATION, Mechanism),
00416        mkEntry(CKM_SHA1_KEY_DERIVATION, Mechanism),
00417        mkEntry(CKM_SHA256_KEY_DERIVATION, Mechanism),
00418        mkEntry(CKM_SHA384_KEY_DERIVATION, Mechanism),
00419        mkEntry(CKM_SHA512_KEY_DERIVATION, Mechanism),
00420        mkEntry(CKM_PBE_MD2_DES_CBC, Mechanism),
00421        mkEntry(CKM_PBE_MD5_DES_CBC, Mechanism),
00422        mkEntry(CKM_PBE_MD5_CAST_CBC, Mechanism),
00423        mkEntry(CKM_PBE_MD5_CAST3_CBC, Mechanism),
00424        mkEntry(CKM_PBE_MD5_CAST5_CBC, Mechanism),
00425        mkEntry(CKM_PBE_MD5_CAST128_CBC, Mechanism),
00426        mkEntry(CKM_PBE_SHA1_CAST5_CBC, Mechanism),
00427        mkEntry(CKM_PBE_SHA1_CAST128_CBC, Mechanism),
00428        mkEntry(CKM_PBE_SHA1_RC4_128, Mechanism),
00429        mkEntry(CKM_PBE_SHA1_RC4_40, Mechanism),
00430        mkEntry(CKM_PBE_SHA1_DES3_EDE_CBC, Mechanism),
00431        mkEntry(CKM_PBE_SHA1_DES2_EDE_CBC, Mechanism),
00432        mkEntry(CKM_PBE_SHA1_RC2_128_CBC, Mechanism),
00433        mkEntry(CKM_PBE_SHA1_RC2_40_CBC, Mechanism),
00434        mkEntry(CKM_PKCS5_PBKD2, Mechanism),
00435        mkEntry(CKM_PBA_SHA1_WITH_SHA1_HMAC, Mechanism),
00436        mkEntry(CKM_KEY_WRAP_LYNKS, Mechanism),
00437        mkEntry(CKM_KEY_WRAP_SET_OAEP, Mechanism),
00438        mkEntry(CKM_SKIPJACK_KEY_GEN, Mechanism),
00439        mkEntry(CKM_SKIPJACK_ECB64, Mechanism),
00440        mkEntry(CKM_SKIPJACK_CBC64, Mechanism),
00441        mkEntry(CKM_SKIPJACK_OFB64, Mechanism),
00442        mkEntry(CKM_SKIPJACK_CFB64, Mechanism),
00443        mkEntry(CKM_SKIPJACK_CFB32, Mechanism),
00444        mkEntry(CKM_SKIPJACK_CFB16, Mechanism),
00445        mkEntry(CKM_SKIPJACK_CFB8, Mechanism),
00446        mkEntry(CKM_SKIPJACK_WRAP, Mechanism),
00447        mkEntry(CKM_SKIPJACK_PRIVATE_WRAP, Mechanism),
00448        mkEntry(CKM_SKIPJACK_RELAYX, Mechanism),
00449        mkEntry(CKM_KEA_KEY_PAIR_GEN, Mechanism),
00450        mkEntry(CKM_KEA_KEY_DERIVE, Mechanism),
00451        mkEntry(CKM_FORTEZZA_TIMESTAMP, Mechanism),
00452        mkEntry(CKM_BATON_KEY_GEN, Mechanism),
00453        mkEntry(CKM_BATON_ECB128, Mechanism),
00454        mkEntry(CKM_BATON_ECB96, Mechanism),
00455        mkEntry(CKM_BATON_CBC128, Mechanism),
00456        mkEntry(CKM_BATON_COUNTER, Mechanism),
00457        mkEntry(CKM_BATON_SHUFFLE, Mechanism),
00458        mkEntry(CKM_BATON_WRAP, Mechanism),
00459        mkEntry(CKM_ECDSA_KEY_PAIR_GEN, Mechanism),
00460        mkEntry(CKM_EC_KEY_PAIR_GEN, Mechanism),
00461        mkEntry(CKM_ECDSA, Mechanism),
00462        mkEntry(CKM_ECDSA_SHA1, Mechanism),
00463        mkEntry(CKM_ECDH1_DERIVE, Mechanism),
00464        mkEntry(CKM_ECDH1_COFACTOR_DERIVE, Mechanism),
00465        mkEntry(CKM_ECMQV_DERIVE, Mechanism),
00466        mkEntry(CKM_JUNIPER_KEY_GEN, Mechanism),
00467        mkEntry(CKM_JUNIPER_ECB128, Mechanism),
00468        mkEntry(CKM_JUNIPER_CBC128, Mechanism),
00469        mkEntry(CKM_JUNIPER_COUNTER, Mechanism),
00470        mkEntry(CKM_JUNIPER_SHUFFLE, Mechanism),
00471        mkEntry(CKM_JUNIPER_WRAP, Mechanism),
00472        mkEntry(CKM_FASTHASH, Mechanism),
00473        mkEntry(CKM_AES_KEY_GEN, Mechanism),
00474        mkEntry(CKM_AES_ECB, Mechanism),
00475        mkEntry(CKM_AES_CBC, Mechanism),
00476        mkEntry(CKM_AES_MAC, Mechanism),
00477        mkEntry(CKM_AES_MAC_GENERAL, Mechanism),
00478        mkEntry(CKM_AES_CBC_PAD, Mechanism),
00479        mkEntry(CKM_DSA_PARAMETER_GEN, Mechanism),
00480        mkEntry(CKM_DH_PKCS_PARAMETER_GEN, Mechanism),
00481        mkEntry(CKM_NETSCAPE_AES_KEY_WRAP, Mechanism),
00482        mkEntry(CKM_NETSCAPE_AES_KEY_WRAP_PAD, Mechanism),
00483        mkEntry(CKM_NETSCAPE_PBE_SHA1_DES_CBC, Mechanism),
00484        mkEntry(CKM_NETSCAPE_PBE_SHA1_TRIPLE_DES_CBC, Mechanism),
00485        mkEntry(CKM_NETSCAPE_PBE_SHA1_40_BIT_RC2_CBC, Mechanism),
00486        mkEntry(CKM_NETSCAPE_PBE_SHA1_128_BIT_RC2_CBC, Mechanism),
00487        mkEntry(CKM_NETSCAPE_PBE_SHA1_40_BIT_RC4, Mechanism),
00488        mkEntry(CKM_NETSCAPE_PBE_SHA1_128_BIT_RC4, Mechanism),
00489        mkEntry(CKM_NETSCAPE_PBE_SHA1_FAULTY_3DES_CBC, Mechanism),
00490        mkEntry(CKM_NETSCAPE_PBE_SHA1_HMAC_KEY_GEN, Mechanism),
00491        mkEntry(CKM_NETSCAPE_PBE_MD5_HMAC_KEY_GEN, Mechanism),
00492        mkEntry(CKM_NETSCAPE_PBE_MD2_HMAC_KEY_GEN, Mechanism),
00493        mkEntry(CKM_TLS_PRF_GENERAL, Mechanism),
00494 
00495        mkEntry(CKR_OK, Result),
00496        mkEntry(CKR_CANCEL, Result),
00497        mkEntry(CKR_HOST_MEMORY, Result),
00498        mkEntry(CKR_SLOT_ID_INVALID, Result),
00499        mkEntry(CKR_GENERAL_ERROR, Result),
00500        mkEntry(CKR_FUNCTION_FAILED, Result),
00501        mkEntry(CKR_ARGUMENTS_BAD, Result),
00502        mkEntry(CKR_NO_EVENT, Result),
00503        mkEntry(CKR_NEED_TO_CREATE_THREADS, Result),
00504        mkEntry(CKR_CANT_LOCK, Result),
00505        mkEntry(CKR_ATTRIBUTE_READ_ONLY, Result),
00506        mkEntry(CKR_ATTRIBUTE_SENSITIVE, Result),
00507        mkEntry(CKR_ATTRIBUTE_TYPE_INVALID, Result),
00508        mkEntry(CKR_ATTRIBUTE_VALUE_INVALID, Result),
00509        mkEntry(CKR_DATA_INVALID, Result),
00510        mkEntry(CKR_DATA_LEN_RANGE, Result),
00511        mkEntry(CKR_DEVICE_ERROR, Result),
00512        mkEntry(CKR_DEVICE_MEMORY, Result),
00513        mkEntry(CKR_DEVICE_REMOVED, Result),
00514        mkEntry(CKR_ENCRYPTED_DATA_INVALID, Result),
00515        mkEntry(CKR_ENCRYPTED_DATA_LEN_RANGE, Result),
00516        mkEntry(CKR_FUNCTION_CANCELED, Result),
00517        mkEntry(CKR_FUNCTION_NOT_PARALLEL, Result),
00518        mkEntry(CKR_FUNCTION_NOT_SUPPORTED, Result),
00519        mkEntry(CKR_KEY_HANDLE_INVALID, Result),
00520        mkEntry(CKR_KEY_SIZE_RANGE, Result),
00521        mkEntry(CKR_KEY_TYPE_INCONSISTENT, Result),
00522        mkEntry(CKR_KEY_NOT_NEEDED, Result),
00523        mkEntry(CKR_KEY_CHANGED, Result),
00524        mkEntry(CKR_KEY_NEEDED, Result),
00525        mkEntry(CKR_KEY_INDIGESTIBLE, Result),
00526        mkEntry(CKR_KEY_FUNCTION_NOT_PERMITTED, Result),
00527        mkEntry(CKR_KEY_NOT_WRAPPABLE, Result),
00528        mkEntry(CKR_KEY_UNEXTRACTABLE, Result),
00529        mkEntry(CKR_KEY_PARAMS_INVALID, Result),
00530        mkEntry(CKR_MECHANISM_INVALID, Result),
00531        mkEntry(CKR_MECHANISM_PARAM_INVALID, Result),
00532        mkEntry(CKR_OBJECT_HANDLE_INVALID, Result),
00533        mkEntry(CKR_OPERATION_ACTIVE, Result),
00534        mkEntry(CKR_OPERATION_NOT_INITIALIZED, Result),
00535        mkEntry(CKR_PIN_INCORRECT, Result),
00536        mkEntry(CKR_PIN_INVALID, Result),
00537        mkEntry(CKR_PIN_LEN_RANGE, Result),
00538        mkEntry(CKR_PIN_EXPIRED, Result),
00539        mkEntry(CKR_PIN_LOCKED, Result),
00540        mkEntry(CKR_SESSION_CLOSED, Result),
00541        mkEntry(CKR_SESSION_COUNT, Result),
00542        mkEntry(CKR_SESSION_HANDLE_INVALID, Result),
00543        mkEntry(CKR_SESSION_PARALLEL_NOT_SUPPORTED, Result),
00544        mkEntry(CKR_SESSION_READ_ONLY, Result),
00545        mkEntry(CKR_SESSION_EXISTS, Result),
00546        mkEntry(CKR_SESSION_READ_ONLY_EXISTS, Result),
00547        mkEntry(CKR_SESSION_READ_WRITE_SO_EXISTS, Result),
00548        mkEntry(CKR_SIGNATURE_INVALID, Result),
00549        mkEntry(CKR_SIGNATURE_LEN_RANGE, Result),
00550        mkEntry(CKR_TEMPLATE_INCOMPLETE, Result),
00551        mkEntry(CKR_TEMPLATE_INCONSISTENT, Result),
00552        mkEntry(CKR_TOKEN_NOT_PRESENT, Result),
00553        mkEntry(CKR_TOKEN_NOT_RECOGNIZED, Result),
00554        mkEntry(CKR_TOKEN_WRITE_PROTECTED, Result),
00555        mkEntry(CKR_UNWRAPPING_KEY_HANDLE_INVALID, Result),
00556        mkEntry(CKR_UNWRAPPING_KEY_SIZE_RANGE, Result),
00557        mkEntry(CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT, Result),
00558        mkEntry(CKR_USER_ALREADY_LOGGED_IN, Result),
00559        mkEntry(CKR_USER_NOT_LOGGED_IN, Result),
00560        mkEntry(CKR_USER_PIN_NOT_INITIALIZED, Result),
00561        mkEntry(CKR_USER_TYPE_INVALID, Result),
00562        mkEntry(CKR_USER_ANOTHER_ALREADY_LOGGED_IN, Result),
00563        mkEntry(CKR_USER_TOO_MANY_TYPES, Result),
00564        mkEntry(CKR_WRAPPED_KEY_INVALID, Result),
00565        mkEntry(CKR_WRAPPED_KEY_LEN_RANGE, Result),
00566        mkEntry(CKR_WRAPPING_KEY_HANDLE_INVALID, Result),
00567        mkEntry(CKR_WRAPPING_KEY_SIZE_RANGE, Result),
00568        mkEntry(CKR_WRAPPING_KEY_TYPE_INCONSISTENT, Result),
00569        mkEntry(CKR_RANDOM_SEED_NOT_SUPPORTED, Result),
00570        mkEntry(CKR_RANDOM_NO_RNG, Result),
00571        mkEntry(CKR_DOMAIN_PARAMS_INVALID, Result),
00572        mkEntry(CKR_BUFFER_TOO_SMALL, Result),
00573        mkEntry(CKR_SAVED_STATE_INVALID, Result),
00574        mkEntry(CKR_INFORMATION_SENSITIVE, Result),
00575        mkEntry(CKR_STATE_UNSAVEABLE, Result),
00576        mkEntry(CKR_CRYPTOKI_NOT_INITIALIZED, Result),
00577        mkEntry(CKR_CRYPTOKI_ALREADY_INITIALIZED, Result),
00578        mkEntry(CKR_MUTEX_BAD, Result),
00579        mkEntry(CKR_MUTEX_NOT_LOCKED, Result),
00580        mkEntry(CKR_VENDOR_DEFINED, Result),
00581 
00582        mkEntry(CKT_NETSCAPE_TRUSTED, Trust),
00583        mkEntry(CKT_NETSCAPE_TRUSTED_DELEGATOR, Trust),
00584        mkEntry(CKT_NETSCAPE_UNTRUSTED, Trust),
00585        mkEntry(CKT_NETSCAPE_MUST_VERIFY, Trust),
00586        mkEntry(CKT_NETSCAPE_TRUST_UNKNOWN, Trust),
00587        mkEntry(CKT_NETSCAPE_VALID, Trust),
00588        mkEntry(CKT_NETSCAPE_VALID_DELEGATOR, Trust),
00589 
00590        mkEntry(CK_EFFECTIVELY_INFINITE, AvailableSizes),
00591        mkEntry(CK_UNAVAILABLE_INFORMATION, CurrentSize),
00592 };
00593 
00594 const Constant *consts = &_consts[0];
00595 const int constCount = sizeof(_consts)/sizeof(_consts[0]);
00596 
00597 const Commands _commands[] = {
00598     {"C_Initialize", F_C_Initialize,
00599 "C_Initialize pInitArgs\n\n"
00600 "C_Initialize initializes the PKCS #11 library.\n"
00601 "  pInitArgs  if this is not NULL_PTR it gets cast to and dereferenced\n",
00602        {ArgInitializeArgs, ArgNone, ArgNone, ArgNone, ArgNone,
00603         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00604     {"C_Finalize", F_C_Finalize,
00605 "C_Finalize pReserved\n\n"
00606 "C_Finalize indicates that an application is done with the PKCS #11 library.\n"
00607 " pReserved  reserved. Should be NULL_PTR\n",
00608        {ArgInitializeArgs, ArgNone, ArgNone, ArgNone, ArgNone,
00609         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00610     {"C_GetInfo", F_C_GetInfo,
00611 "C_GetInfo pInfo\n\n"
00612 "C_GetInfo returns general information about PKCS #11.\n"
00613 " pInfo   location that receives information\n",
00614        {ArgInfo|ArgOut,   ArgNone, ArgNone, ArgNone, ArgNone,
00615         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00616     {"C_GetFunctionList", F_C_GetFunctionList,
00617 "C_GetFunctionList ppFunctionList\n\n"
00618 "C_GetFunctionList returns the function list.\n"
00619 " ppFunctionList   receives pointer to function list\n",
00620        {ArgFunctionList|ArgOut,   ArgNone, ArgNone, ArgNone, ArgNone,
00621         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00622     {"C_GetSlotList", F_C_GetSlotList,
00623 "C_GetSlotList tokenPresent pSlotList pulCount\n\n"
00624 "C_GetSlotList obtains a list of slots in the system.\n"
00625 " tokenPresent    only slots with tokens?\n"
00626 " pSlotList       receives array of slot IDs\n"
00627 " pulCount        receives number of slots\n",
00628        {ArgULong, ArgULong|ArgArray|ArgOut, ArgULong|ArgOut, ArgNone, ArgNone,
00629         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00630     {"C_GetSlotInfo", F_C_GetSlotInfo,
00631 "C_GetSlotInfo slotID pInfo\n\n"
00632 "C_GetSlotInfo obtains information about a particular slot in the system.\n"
00633 " slotID    the ID of the slot\n"
00634 " pInfo     receives the slot information\n",
00635        {ArgULong, ArgSlotInfo|ArgOut, ArgNone, ArgNone, ArgNone,
00636         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00637     {"C_GetTokenInfo", F_C_GetTokenInfo,
00638 "C_GetTokenInfo slotID pInfo\n\n"
00639 "C_GetTokenInfo obtains information about a particular token in the system.\n"
00640 " slotID    ID of the token's slot\n"
00641 " pInfo     receives the token information\n",
00642        {ArgULong, ArgTokenInfo|ArgOut, ArgNone, ArgNone, ArgNone,
00643         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00644     {"C_GetMechanismList", F_C_GetMechanismList,
00645 "C_GetMechanismList slotID pMechanismList pulCount\n\n"
00646 "C_GetMechanismList obtains a list of mechanism types supported by a token.\n"
00647 " slotID            ID of token's slot\n"
00648 " pMechanismList    gets mech. array\n"
00649 " pulCount          gets # of mechs.\n",
00650        {ArgULong, ArgULong|ArgArray|ArgOut, ArgULong|ArgOut, ArgNone, ArgNone,
00651         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00652     {"C_GetMechanismInfo", F_C_GetMechanismInfo,
00653 "C_GetMechanismInfo slotID type pInfo\n\n"
00654 "C_GetMechanismInfo obtains information about a particular mechanism possibly\n"
00655 "supported by a token.\n"
00656 " slotID    ID of the token's slot\n"
00657 " type      type of mechanism\n"
00658 " pInfo     receives mechanism info\n",
00659        {ArgULong, ArgULong, ArgMechanismInfo|ArgOut, ArgNone, ArgNone,
00660         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00661     {"C_InitToken", F_C_InitToken,
00662 "C_InitToken slotID pPin ulPinLen pLabel\n\n"
00663 "C_InitToken initializes a token.\n"
00664 " slotID      ID of the token's slot\n"
00665 " pPin        the SO's initial PIN\n"
00666 " ulPinLen    length in bytes of the PIN\n"
00667 " pLabel      32-byte token label (blank padded)\n",
00668        {ArgULong, ArgUTF8, ArgULong, ArgUTF8, ArgNone,
00669         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00670     {"C_InitPIN", F_C_InitPIN,
00671 "C_InitPIN hSession pPin ulPinLen\n\n"
00672 "C_InitPIN initializes the normal user's PIN.\n"
00673 " hSession    the session's handle\n"
00674 " pPin        the normal user's PIN\n"
00675 " ulPinLen    length in bytes of the PIN\n",
00676        {ArgULong, ArgUTF8, ArgULong, ArgNone, ArgNone,
00677         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00678     {"C_SetPIN", F_C_SetPIN,
00679 "C_SetPIN hSession pOldPin ulOldLen pNewPin ulNewLen\n\n"
00680 "C_SetPIN modifies the PIN of the user who is logged in.\n"
00681 " hSession    the session's handle\n"
00682 " pOldPin     the old PIN\n"
00683 " ulOldLen    length of the old PIN\n"
00684 " pNewPin     the new PIN\n"
00685 " ulNewLen    length of the new PIN\n",
00686        {ArgULong, ArgUTF8, ArgULong, ArgUTF8, ArgULong,
00687         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00688     {"C_OpenSession", F_C_OpenSession,
00689 "C_OpenSession slotID flags phSession\n\n"
00690 "C_OpenSession opens a session between an application and a token.\n"
00691 " slotID          the slot's ID\n"
00692 " flags           from\n"
00693 " phSession       gets session handle\n",
00694        {ArgULong, ArgULong, ArgULong|ArgOut, ArgNone, ArgNone,
00695         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00696     {"C_CloseSession", F_C_CloseSession,
00697 "C_CloseSession hSession\n\n"
00698 "C_CloseSession closes a session between an application and a token.\n"
00699 " hSession   the session's handle\n",
00700        {ArgULong, ArgNone, ArgNone, ArgNone, ArgNone,
00701         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00702     {"C_CloseAllSessions", F_C_CloseAllSessions,
00703 "C_CloseAllSessions slotID\n\n"
00704 "C_CloseAllSessions closes all sessions with a token.\n"
00705 " slotID   the token's slot\n",
00706        {ArgULong, ArgNone, ArgNone, ArgNone, ArgNone,
00707         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00708     {"C_GetSessionInfo", F_C_GetSessionInfo,
00709 "C_GetSessionInfo hSession pInfo\n\n"
00710 "C_GetSessionInfo obtains information about the session.\n"
00711 " hSession    the session's handle\n"
00712 " pInfo       receives session info\n",
00713        {ArgULong, ArgSessionInfo|ArgOut, ArgNone, ArgNone, ArgNone,
00714         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00715     {"C_GetOperationState", F_C_GetOperationState,
00716 "C_GetOperationState hSession pOpState pulOpStateLen\n\n"
00717 "C_GetOperationState obtains the state of the cryptographic operation in a\n"
00718 "session.\n"
00719 " hSession        session's handle\n"
00720 " pOpState        gets state\n"
00721 " pulOpStateLen   gets state length\n",
00722        {ArgULong, ArgChar|ArgOut, ArgULong|ArgOut, ArgNone, ArgNone,
00723         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00724     {"C_SetOperationState", F_C_SetOperationState,
00725 "C_SetOperationState hSession pOpState ulOpStateLen hEncKey hAuthKey\n\n"
00726 "C_SetOperationState restores the state of the cryptographic operation in a\n"
00727 "session.\n"
00728 " hSession        session's handle\n"
00729 " pOpState        holds state\n"
00730 " ulOpStateLen    holds state length\n"
00731 " hEncKey         en/decryption key\n"
00732 " hAuthnKey       sign/verify key\n",
00733        {ArgULong, ArgChar|ArgOut, ArgULong, ArgULong, ArgULong,
00734         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00735     {"C_Login", F_C_Login,
00736 "C_Login hSession userType pPin ulPinLen\n\n"
00737 "C_Login logs a user into a token.\n"
00738 " hSession    the session's handle\n"
00739 " userType    the user type\n"
00740 " pPin        the user's PIN\n"
00741 " ulPinLen    the length of the PIN\n",
00742        {ArgULong, ArgULong, ArgVar, ArgULong, ArgNone,
00743         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00744     {"C_Logout", F_C_Logout,
00745 "C_Logout hSession\n\n"
00746 "C_Logout logs a user out from a token.\n"
00747 " hSession   the session's handle\n",
00748        {ArgULong, ArgNone, ArgNone, ArgNone, ArgNone,
00749         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00750     {"C_CreateObject", F_C_CreateObject,
00751 "C_CreateObject hSession pTemplate ulCount phObject\n\n"
00752 "C_CreateObject creates a new object.\n"
00753 " hSession      the session's handle\n"
00754 " pTemplate     the object's template\n"
00755 " ulCount       attributes in template\n"
00756 " phObject   gets new object's handle.\n",
00757        {ArgULong, ArgAttribute|ArgArray, ArgULong, ArgULong|ArgOut, ArgNone,
00758         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00759     {"C_CopyObject", F_C_CopyObject,
00760 "C_CopyObject hSession hObject pTemplate ulCount phNewObject\n\n"
00761 "C_CopyObject copies an object creating a new object for the copy.\n"
00762 " hSession      the session's handle\n"
00763 " hObject       the object's handle\n"
00764 " pTemplate     template for new object\n"
00765 " ulCount       attributes in template\n"
00766 " phNewObject   receives handle of copy\n",
00767        {ArgULong, ArgULong, ArgAttribute|ArgArray, ArgULong, ArgULong|ArgOut,
00768         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00769     {"C_DestroyObject", F_C_DestroyObject,
00770 "C_DestroyObject hSession hObject\n\n"
00771 "C_DestroyObject destroys an object.\n"
00772 " hSession    the session's handle\n"
00773 " hObject     the object's handle\n",
00774        {ArgULong, ArgULong, ArgNone, ArgNone, ArgNone,
00775         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00776     {"C_GetObjectSize", F_C_GetObjectSize,
00777 "C_GetObjectSize hSession hObject pulSize\n\n"
00778 "C_GetObjectSize gets the size of an object in bytes.\n"
00779 " hSession    the session's handle\n"
00780 " hObject     the object's handle\n"
00781 " pulSize     receives size of object\n",
00782        {ArgULong, ArgULong, ArgULong|ArgOut, ArgNone, ArgNone,
00783         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00784     {"C_GetAttributeValue", F_C_GetAttributeValue,
00785 "C_GetAttributeValue hSession hObject pTemplate ulCount\n\n"
00786 "C_GetAttributeValue obtains the value of one or more object attributes.\n"
00787 " hSession     the session's handle\n"
00788 " hObject      the object's handle\n"
00789 " pTemplate    specifies attrs; gets vals\n"
00790 " ulCount      attributes in template\n",
00791        {ArgULong, ArgULong, ArgAttribute|ArgArray, ArgULong, ArgNone,
00792         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00793     {"C_SetAttributeValue", F_C_SetAttributeValue,
00794 "C_SetAttributeValue hSession hObject pTemplate ulCount\n\n"
00795 "C_SetAttributeValue modifies the value of one or more object attributes\n"
00796 " hSession     the session's handle\n"
00797 " hObject      the object's handle\n"
00798 " pTemplate    specifies attrs and values\n"
00799 " ulCount      attributes in template\n",
00800        {ArgULong, ArgULong, ArgAttribute|ArgArray, ArgULong, ArgNone,
00801         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00802     {"C_FindObjectsInit", F_C_FindObjectsInit,
00803 "C_FindObjectsInit hSession pTemplate ulCount\n\n"
00804 "C_FindObjectsInit initializes a search for token and session objects that\n"
00805 "match a template.\n"
00806 " hSession     the session's handle\n"
00807 " pTemplate    attribute values to match\n"
00808 " ulCount      attrs in search template\n",
00809        {ArgULong, ArgAttribute|ArgArray, ArgULong, ArgNone, ArgNone,
00810         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00811     {"C_FindObjectsFinal", F_C_FindObjectsFinal,
00812 "C_FindObjectsFinal hSession\n\n"
00813 "C_FindObjectsFinal finishes a search for token and session objects.\n"
00814 " hSession   the session's handle\n",
00815        {ArgULong, ArgNone, ArgNone, ArgNone, ArgNone,
00816         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00817     {"C_FindObjects", F_C_FindObjects,
00818 "C_FindObjects hSession phObject ulMaxObjectCount pulObjectCount\n\n"
00819 "C_FindObjects continues a search for token and session objects that match\n"
00820 "a template obtaining additional object handles.\n"
00821 " hSession            session's handle\n"
00822 " phObject            gets obj. handles\n"
00823 " ulMaxObjectCount    max handles to get\n"
00824 " pulObjectCount      actual # returned\n",
00825        {ArgULong, ArgULong|ArgOut, ArgULong, ArgULong|ArgOut, ArgNone,
00826         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00827     {"C_EncryptInit", F_C_EncryptInit,
00828 "C_EncryptInit hSession pMechanism hKey\n\n"
00829 "C_EncryptInit initializes an encryption operation.\n"
00830 " hSession      the session's handle\n"
00831 " pMechanism    the encryption mechanism\n"
00832 " hKey          handle of encryption key\n",
00833        {ArgULong, ArgMechanism, ArgULong, ArgNone, ArgNone,
00834         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00835     {"C_EncryptUpdate", F_C_EncryptUpdate,
00836 "C_EncryptUpdate hSession pPart ulPartLen pEncryptedPart pulEncryptedPartLen\n"
00837 "\n"
00838 "C_EncryptUpdate continues a multiple-part encryption operation.\n"
00839 " hSession             session's handle\n"
00840 " pPart                the plaintext data\n"
00841 " ulPartLen            plaintext data len\n"
00842 " pEncryptedPart       gets ciphertext\n"
00843 " pulEncryptedPartLen  gets c-text size\n",
00844        {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
00845         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00846     {"C_EncryptFinal", F_C_EncryptFinal,
00847 "C_EncryptFinal hSession pLastEncryptedPart pulLastEncryptedPartLen\n\n"
00848 "C_EncryptFinal finishes a multiple-part encryption operation.\n"
00849 " hSession                  session handle\n"
00850 " pLastEncryptedPart        last c-text\n"
00851 " pulLastEncryptedPartLen   gets last size\n",
00852        {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
00853         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00854     {"C_Encrypt", F_C_Encrypt,
00855 "C_Encrypt hSession pData ulDataLen pEncryptedData pulEncryptedDataLen\n\n"
00856 "C_Encrypt encrypts single-part data.\n"
00857 " hSession              session's handle\n"
00858 " pData                 the plaintext data\n"
00859 " ulDataLen             bytes of plaintext\n"
00860 " pEncryptedData        gets ciphertext\n"
00861 " pulEncryptedDataLen   gets c-text size\n",
00862        {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
00863         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00864     {"C_DecryptInit", F_C_DecryptInit,
00865 "C_DecryptInit hSession pMechanism hKey\n\n"
00866 "C_DecryptInit initializes a decryption operation.\n"
00867 " hSession      the session's handle\n"
00868 " pMechanism    the decryption mechanism\n"
00869 " hKey          handle of decryption key\n",
00870        {ArgULong, ArgMechanism, ArgULong, ArgNone, ArgNone,
00871         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00872     {"C_DecryptUpdate", F_C_DecryptUpdate,
00873 "C_DecryptUpdate hSession pEncryptedPart ulEncryptedPartLen pPart pulPartLen\n"
00874 "\n"
00875 "C_DecryptUpdate continues a multiple-part decryption operation.\n"
00876 " hSession              session's handle\n"
00877 " pEncryptedPart        encrypted data\n"
00878 " ulEncryptedPartLen    input length\n"
00879 " pPart                 gets plaintext\n"
00880 " pulPartLen            p-text size\n",
00881        {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
00882         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00883     {"C_DecryptFinal", F_C_DecryptFinal,
00884 "C_DecryptFinal hSession pLastPart pulLastPartLen\n\n"
00885 "C_DecryptFinal finishes a multiple-part decryption operation.\n"
00886 " hSession         the session's handle\n"
00887 " pLastPart        gets plaintext\n"
00888 " pulLastPartLen   p-text size\n",
00889        {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
00890         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00891     {"C_Decrypt", F_C_Decrypt,
00892 "C_Decrypt hSession pEncryptedData ulEncryptedDataLen pData pulDataLen\n\n"
00893 "C_Decrypt decrypts encrypted data in a single part.\n"
00894 " hSession             session's handle\n"
00895 " pEncryptedData       ciphertext\n"
00896 " ulEncryptedDataLen   ciphertext length\n"
00897 " pData                gets plaintext\n"
00898 " pulDataLen           gets p-text size\n",
00899        {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
00900         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00901     {"C_DigestInit", F_C_DigestInit,
00902 "C_DigestInit hSession pMechanism\n\n"
00903 "C_DigestInit initializes a message-digesting operation.\n"
00904 " hSession     the session's handle\n"
00905 " pMechanism   the digesting mechanism\n",
00906        {ArgULong, ArgMechanism, ArgNone, ArgNone, ArgNone,
00907         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00908     {"C_DigestUpdate", F_C_DigestUpdate,
00909 "C_DigestUpdate hSession pPart ulPartLen\n\n"
00910 "C_DigestUpdate continues a multiple-part message-digesting operation.\n"
00911 " hSession    the session's handle\n"
00912 " pPart       data to be digested\n"
00913 " ulPartLen   bytes of data to be digested\n",
00914        {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
00915         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00916     {"C_DigestKey", F_C_DigestKey,
00917 "C_DigestKey hSession hKey\n\n"
00918 "C_DigestKey continues a multi-part message-digesting operation by digesting\n"
00919 "the value of a secret key as part of the data already digested.\n"
00920 " hSession    the session's handle\n"
00921 " hKey        secret key to digest\n",
00922        {ArgULong, ArgULong, ArgNone, ArgNone, ArgNone,
00923         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00924     {"C_DigestFinal", F_C_DigestFinal,
00925 "C_DigestFinal hSession pDigest pulDigestLen\n\n"
00926 "C_DigestFinal finishes a multiple-part message-digesting operation.\n"
00927 " hSession       the session's handle\n"
00928 " pDigest        gets the message digest\n"
00929 " pulDigestLen   gets byte count of digest\n",
00930        {ArgULong, ArgChar|ArgOut, ArgULong|ArgOut, ArgNone, ArgNone,
00931         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00932     {"C_Digest", F_C_Digest,
00933 "C_Digest hSession pData ulDataLen pDigest pulDigestLen\n\n"
00934 "C_Digest digests data in a single part.\n"
00935 " hSession       the session's handle\n"
00936 " pData          data to be digested\n"
00937 " ulDataLen      bytes of data to digest\n"
00938 " pDigest        gets the message digest\n"
00939 " pulDigestLen   gets digest length\n",
00940        {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
00941         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00942     {"C_SignInit", F_C_SignInit,
00943 "C_SignInit hSession pMechanism hKey\n\n"
00944 "C_SignInit initializes a signature (private key encryption operation where\n"
00945 "the signature is (will be) an appendix to the data and plaintext cannot be\n"
00946 "recovered from the signature.\n"
00947 " hSession      the session's handle\n"
00948 " pMechanism    the signature mechanism\n"
00949 " hKey          handle of signature key\n",
00950        {ArgULong, ArgMechanism, ArgULong, ArgNone, ArgNone,
00951         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00952     {"C_SignUpdate", F_C_SignUpdate,
00953 "C_SignUpdate hSession pPart ulPartLen\n\n"
00954 "C_SignUpdate continues a multiple-part signature operation where the\n"
00955 "signature is (will be) an appendix to the data and plaintext cannot be\n"
00956 "recovered from the signature.\n"
00957 " hSession    the session's handle\n"
00958 " pPart       the data to sign\n"
00959 " ulPartLen   count of bytes to sign\n",
00960        {ArgULong, ArgChar|ArgOut, ArgULong|ArgOut, ArgNone, ArgNone,
00961         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00962     {"C_SignFinal", F_C_SignFinal,
00963 "C_SignFinal hSession pSignature pulSignatureLen\n\n"
00964 "C_SignFinal finishes a multiple-part signature operation returning the\n"
00965 "signature.\n"
00966 " hSession          the session's handle\n"
00967 " pSignature        gets the signature\n"
00968 " pulSignatureLen   gets signature length\n",
00969        {ArgULong, ArgChar|ArgOut, ArgULong|ArgOut, ArgNone, ArgNone,
00970         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00971     {"C_SignRecoverInit", F_C_SignRecoverInit,
00972 "C_SignRecoverInit hSession pMechanism hKey\n\n"
00973 "C_SignRecoverInit initializes a signature operation where the data can be\n"
00974 "recovered from the signature.\n"
00975 " hSession     the session's handle\n"
00976 " pMechanism   the signature mechanism\n"
00977 " hKey         handle of the signature key\n",
00978        {ArgULong, ArgMechanism, ArgULong, ArgNone, ArgNone,
00979         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00980     {"C_SignRecover", F_C_SignRecover,
00981 "C_SignRecover hSession pData ulDataLen pSignature pulSignatureLen\n\n"
00982 "C_SignRecover signs data in a single operation where the data can be\n"
00983 "recovered from the signature.\n"
00984 " hSession          the session's handle\n"
00985 " pData             the data to sign\n"
00986 " ulDataLen         count of bytes to sign\n"
00987 " pSignature        gets the signature\n"
00988 " pulSignatureLen   gets signature length\n",
00989        {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
00990         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
00991     {"C_Sign", F_C_Sign,
00992 "C_Sign hSession pData ulDataLen pSignature pulSignatureLen\n\n"
00993 "C_Sign signs (encrypts with private key) data in a single part where the\n"
00994 "signature is (will be) an appendix to the data and plaintext cannot be\n"
00995 "recovered from the signature.\n"
00996 " hSession          the session's handle\n"
00997 " pData             the data to sign\n"
00998 " ulDataLen         count of bytes to sign\n"
00999 " pSignature        gets the signature\n"
01000 " pulSignatureLen   gets signature length\n",
01001        {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
01002         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01003     {"C_VerifyInit", F_C_VerifyInit,
01004 "C_VerifyInit hSession pMechanism hKey\n\n"
01005 "C_VerifyInit initializes a verification operation where the signature is an\n"
01006 "appendix to the data and plaintext cannot cannot be recovered from the\n"
01007 "signature (e.g. DSA).\n"
01008 " hSession      the session's handle\n"
01009 " pMechanism    the verification mechanism\n"
01010 " hKey          verification key\n",
01011        {ArgULong, ArgMechanism, ArgULong, ArgNone, ArgNone,
01012         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01013     {"C_VerifyUpdate", F_C_VerifyUpdate,
01014 "C_VerifyUpdate hSession pPart ulPartLen\n\n"
01015 "C_VerifyUpdate continues a multiple-part verification operation where the\n"
01016 "signature is an appendix to the data and plaintext cannot be recovered from\n"
01017 "the signature.\n"
01018 " hSession    the session's handle\n"
01019 " pPart       signed data\n"
01020 " ulPartLen   length of signed data\n",
01021        {ArgULong, ArgChar|ArgOut, ArgULong|ArgOut, ArgNone, ArgNone,
01022         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01023     {"C_VerifyFinal", F_C_VerifyFinal,
01024 "C_VerifyFinal hSession pSignature ulSignatureLen\n\n"
01025 "C_VerifyFinal finishes a multiple-part verification operation checking the\n"
01026 "signature.\n"
01027 " hSession         the session's handle\n"
01028 " pSignature       signature to verify\n"
01029 " ulSignatureLen   signature length\n",
01030        {ArgULong, ArgChar|ArgOut, ArgULong|ArgOut, ArgNone, ArgNone,
01031         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01032     {"C_VerifyRecoverInit", F_C_VerifyRecoverInit,
01033 "C_VerifyRecoverInit hSession pMechanism hKey\n\n"
01034 "C_VerifyRecoverInit initializes a signature verification operation where the\n"
01035 "data is recovered from the signature.\n"
01036 " hSession      the session's handle\n"
01037 " pMechanism    the verification mechanism\n"
01038 " hKey          verification key\n",
01039        {ArgULong, ArgMechanism, ArgULong, ArgNone, ArgNone,
01040         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01041     {"C_VerifyRecover", F_C_VerifyRecover,
01042 "C_VerifyRecover hSession pSignature ulSignatureLen pData pulDataLen\n\n"
01043 "C_VerifyRecover verifies a signature in a single-part operation where the\n"
01044 "data is recovered from the signature.\n"
01045 " hSession          the session's handle\n"
01046 " pSignature        signature to verify\n"
01047 " ulSignatureLen    signature length\n"
01048 " pData             gets signed data\n"
01049 " pulDataLen        gets signed data len\n",
01050        {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
01051         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01052     {"C_Verify", F_C_Verify,
01053 "C_Verify hSession pData ulDataLen pSignature ulSignatureLen\n\n"
01054 "C_Verify verifies a signature in a single-part operation where the signature\n"
01055 "is an appendix to the data and plaintext cannot be recovered from the\n"
01056 "signature.\n"
01057 " hSession         the session's handle\n"
01058 " pData            signed data\n"
01059 " ulDataLen        length of signed data\n"
01060 " pSignature       signature\n"
01061 " ulSignatureLen   signature length*/\n",
01062        {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
01063         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01064     {"C_DigestEncryptUpdate", F_C_DigestEncryptUpdate,
01065 "C_DigestEncryptUpdate hSession pPart ulPartLen pEncryptedPart \\\n"
01066 "    pulEncryptedPartLen\n\n"
01067 "C_DigestEncryptUpdate continues a multiple-part digesting and encryption\n"
01068 "operation.\n"
01069 " hSession              session's handle\n"
01070 " pPart                 the plaintext data\n"
01071 " ulPartLen             plaintext length\n"
01072 " pEncryptedPart        gets ciphertext\n"
01073 " pulEncryptedPartLen   gets c-text length\n",
01074        {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
01075         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01076     {"C_DecryptDigestUpdate", F_C_DecryptDigestUpdate,
01077 "C_DecryptDigestUpdate hSession pEncryptedPart ulEncryptedPartLen pPart \\\n"
01078 "    pulPartLen\n\n"
01079 "C_DecryptDigestUpdate continues a multiple-part decryption and digesting\n"
01080 "operation.\n"
01081 " hSession              session's handle\n"
01082 " pEncryptedPart        ciphertext\n"
01083 " ulEncryptedPartLen    ciphertext length\n"
01084 " pPart                 gets plaintext\n"
01085 " pulPartLen            gets plaintext len\n",
01086        {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
01087         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01088     {"C_SignEncryptUpdate", F_C_SignEncryptUpdate,
01089 "C_SignEncryptUpdate hSession pPart ulPartLen pEncryptedPart \\\n"
01090 "    pulEncryptedPartLen\n\n"
01091 "C_SignEncryptUpdate continues a multiple-part signing and encryption\n"
01092 "operation.\n"
01093 " hSession              session's handle\n"
01094 " pPart                 the plaintext data\n"
01095 " ulPartLen             plaintext length\n"
01096 " pEncryptedPart        gets ciphertext\n"
01097 " pulEncryptedPartLen   gets c-text length\n",
01098        {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
01099         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01100     {"C_DecryptVerifyUpdate", F_C_DecryptVerifyUpdate,
01101 "C_DecryptVerifyUpdate hSession pEncryptedPart ulEncryptedPartLen pPart \\\n"
01102 "    pulPartLen\n\n"
01103 "C_DecryptVerifyUpdate continues a multiple-part decryption and verify\n"
01104 "operation.\n"
01105 " hSession              session's handle\n"
01106 " pEncryptedPart        ciphertext\n"
01107 " ulEncryptedPartLen    ciphertext length\n"
01108 " pPart                 gets plaintext\n"
01109 " pulPartLen            gets p-text length\n",
01110        {ArgULong, ArgChar, ArgULong, ArgChar|ArgOut, ArgULong|ArgOut,
01111         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01112     {"C_GenerateKeyPair", F_C_GenerateKeyPair,
01113 "C_GenerateKeyPair hSession pMechanism pPublicKeyTemplate \\\n"
01114 "    ulPublicKeyAttributeCount pPrivateKeyTemplate ulPrivateKeyAttributeCount \\\n"
01115 "    phPublicKey phPrivateKey\n\n"
01116 "C_GenerateKeyPair generates a public-key/private-key pair creating new key\n"
01117 "objects.\n"
01118 " hSession                      sessionhandle\n"
01119 " pMechanism                    key-genmech.\n"
01120 " pPublicKeyTemplate            templatefor pub. key\n"
01121 " ulPublicKeyAttributeCount     # pub. attrs.\n"
01122 " pPrivateKeyTemplate           templatefor priv. key\n"
01123 " ulPrivateKeyAttributeCount    # priv. attrs.\n"
01124 " phPublicKey                   gets pub. keyhandle\n"
01125 " phPrivateKey                  getspriv. keyhandle\n",
01126        {ArgULong, ArgMechanism, ArgAttribute|ArgArray, ArgULong, 
01127                                           ArgAttribute|ArgArray,
01128         ArgULong, ArgULong|ArgOut, ArgULong|ArgOut, ArgNone, ArgNone }},
01129     {"C_GenerateKey", F_C_GenerateKey,
01130 "C_GenerateKey hSession pMechanism pTemplate ulCount phKey\n\n"
01131 "C_GenerateKey generates a secret key creating a new key object.\n"
01132 " hSession      the session's handle\n"
01133 " pMechanism    key generation mech.\n"
01134 " pTemplate     template for new key\n"
01135 " ulCount       # of attrs in template\n"
01136 " phKey         gets handle of new key\n",
01137        {ArgULong, ArgMechanism, ArgAttribute|ArgArray, ArgULong, 
01138                                           ArgULong|ArgOut,
01139         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01140     {"C_WrapKey", F_C_WrapKey,
01141 "C_WrapKey hSession pMechanism hWrappingKey hKey pWrappedKey pulWrappedKeyLen\n\n"
01142 "C_WrapKey wraps (i.e. encrypts) a key.\n"
01143 " hSession          the session's handle\n"
01144 " pMechanism        the wrapping mechanism\n"
01145 " hWrappingKey      wrapping key\n"
01146 " hKey              key to be wrapped\n"
01147 " pWrappedKey       gets wrapped key\n"
01148 " pulWrappedKeyLen  gets wrapped key size\n",
01149        {ArgULong, ArgMechanism, ArgULong, ArgULong, ArgULong,
01150         ArgChar|ArgOut, ArgULong|ArgOut, ArgNone, ArgNone, ArgNone }},
01151     {"C_UnwrapKey", F_C_UnwrapKey,
01152 "C_UnwrapKey hSession pMechanism hUnwrappingKey pWrappedKey ulWrappedKeyLen \\\n"
01153 "    pTemplate ulAttributeCount phKey\n\n"
01154 "C_UnwrapKey unwraps (decrypts) a wrapped key creating a new key object.\n"
01155 " hSession            session's handle\n"
01156 " pMechanism          unwrapping mech.\n"
01157 " hUnwrappingKey      unwrapping key\n"
01158 " pWrappedKey         the wrapped key\n"
01159 " ulWrappedKeyLen     wrapped key len\n"
01160 " pTemplate           new key template\n"
01161 " ulAttributeCount    template length\n"
01162 " phKey               gets new handle\n",
01163        {ArgULong, ArgMechanism, ArgULong, ArgChar, ArgULong,
01164         ArgAttribute|ArgArray, ArgULong, ArgULong|ArgOut, ArgNone, ArgNone }},
01165     {"C_DeriveKey", F_C_DeriveKey,
01166 "C_DeriveKey hSession pMechanism hBaseKey pTemplate ulAttributeCount phKey\n\n"
01167 "C_DeriveKey derives a key from a base key creating a new key object.\n"
01168 " hSession            session's handle\n"
01169 " pMechanism          key deriv. mech.\n"
01170 " hBaseKey            base key\n"
01171 " pTemplate           new key template\n"
01172 " ulAttributeCount    template length\n"
01173 " phKey               gets new handle\n",
01174        {ArgULong, ArgMechanism, ArgULong, ArgAttribute|ArgArray,  ArgULong,
01175         ArgULong|ArgOut, ArgNone, ArgNone, ArgNone, ArgNone }},
01176     {"C_SeedRandom", F_C_SeedRandom,
01177 "C_SeedRandom hSession pSeed ulSeedLen\n\n"
01178 "C_SeedRandom mixes additional seed material into the token's random number\n"
01179 "generator.\n"
01180 " hSession    the session's handle\n"
01181 " pSeed       the seed material\n"
01182 " ulSeedLen   length of seed material\n",
01183        {ArgULong, ArgChar, ArgULong, ArgNone, ArgNone,
01184         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01185     {"C_GenerateRandom", F_C_GenerateRandom,
01186 "C_GenerateRandom hSession RandomData ulRandomLen\n\n"
01187 "C_GenerateRandom generates random data.\n"
01188 " hSession      the session's handle\n"
01189 " RandomData    receives the random data\n"
01190 " ulRandomLen   # of bytes to generate\n",
01191        {ArgULong, ArgChar, ArgULong, ArgNone, ArgNone,
01192         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01193     {"C_GetFunctionStatus", F_C_GetFunctionStatus,
01194 "C_GetFunctionStatus hSession\n\n"
01195 "C_GetFunctionStatus is a legacy function; it obtains an updated status of\n"
01196 "a function running in parallel with an application.\n"
01197 " hSession   the session's handle\n",
01198        {ArgULong, ArgNone, ArgNone, ArgNone, ArgNone,
01199         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01200     {"C_CancelFunction", F_C_CancelFunction,
01201 "C_CancelFunction hSession\n\n"
01202 "C_CancelFunction is a legacy function; it cancels a function running in\n"
01203 "parallel.\n"
01204 " hSession   the session's handle\n",
01205        {ArgULong, ArgNone, ArgNone, ArgNone, ArgNone,
01206         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01207     {"C_WaitForSlotEvent", F_C_WaitForSlotEvent,
01208 "C_WaitForSlotEvent flags pSlot pRserved\n\n"
01209 "C_WaitForSlotEvent waits for a slot event (token insertion removal etc.)\n"
01210 "to occur.\n"
01211 " flags          blocking/nonblocking flag\n"
01212 " pSlot    location that receives the slot ID\n"
01213 " pRserved    reserved.  Should be NULL_PTR\n",
01214        {ArgULong, ArgULong|ArgArray, ArgVar, ArgNone, ArgNone,
01215         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01216     {"NewArray", F_NewArray,
01217 "NewArray varName varType array size\n\n"
01218 "Creates a new array variable.\n"
01219 " varName     variable name of the new array\n"
01220 " varType     data type of the new array\n"
01221 " size        number of elements in the array\n",
01222        {ArgVar|ArgNew, ArgVar, ArgULong, ArgNone, ArgNone, 
01223         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01224     {"NewInitArg", F_NewInitializeArgs,
01225 "NewInitArg varName string\n\n"
01226 "Creates a new init variable.\n"
01227 " varName     variable name of the new initArg\n"
01228 " string      string parameter for init arg\n",
01229        {ArgVar|ArgNew, ArgULong, ArgVar|ArgNew, ArgNone, ArgNone, 
01230         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01231     {"NewTemplate", F_NewTemplate,
01232 "NewTemplate varName attributeList\n\n"
01233 "Create a new empty template and populate the attribute list\n"
01234 " varName        variable name of the new template\n"
01235 " attributeList  comma separated list of CKA_ATTRIBUTE types\n",
01236        {ArgVar|ArgNew, ArgVar, ArgNone, ArgNone, ArgNone, 
01237         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01238     {"NewMechanism", F_NewMechanism,
01239 "NewMechanism varName mechanismType\n\n"
01240 "Create a new CK_MECHANISM object with type NULL paramters and specified type\n"
01241 " varName        variable name of the new mechansim\n"
01242 " mechanismType  CKM_ mechanism type value to set int the type field\n",
01243        {ArgVar|ArgNew, ArgULong, ArgNone, ArgNone, ArgNone, 
01244         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01245     {"BuildTemplate", F_BuildTemplate,
01246 "BuildTemplate template\n\n"
01247 "Allocates space for the value in a template which has the sizes filled in,\n"
01248 "but no values allocated yet.\n"
01249 " template        variable name of the template\n",
01250        {ArgAttribute, ArgNone, ArgNone, ArgNone, ArgNone, 
01251         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01252     {"SetTemplate", F_SetTemplate,
01253 "SetTemplate template index value\n\n"
01254 "Sets a particular element of a template to a CK_ULONG\n"
01255 " template        variable name of the template\n"
01256 " index           index into the template to the element to change\n"
01257 " value           32 bit value to set in the template\n",
01258        {ArgAttribute, ArgULong, ArgULong, ArgNone, ArgNone, 
01259         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01260     {"SetString", F_SetStringVar,
01261 "SetString varName string\n\n"
01262 "Sets a particular variable to a string value\n"
01263 " variable        variable name of new string\n"
01264 " string               String to set the variable to\n",
01265        {ArgVar|ArgNew, ArgVar, ArgNone, ArgNone, ArgNone, 
01266         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01267     {"Set", F_SetVar,
01268 "Set varName value\n\n"
01269 "Sets a particular variable to CK_ULONG\n"
01270 " variable        name of the new variable\n"
01271 " value           32 bit value to set variable to\n",
01272        {ArgVar|ArgNew, ArgULong, ArgNone, ArgNone, ArgNone, 
01273         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01274     {"Print", F_Print,
01275 "Print varName\n\n"
01276 "prints a variable\n"
01277 " variable        name of the variable to print\n",
01278        {ArgVar, ArgNone, ArgNone, ArgNone, ArgNone,
01279         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01280     {"Delete", F_Delete,
01281 "Delete varName\n\n"
01282 "delete a variable\n"
01283 " variable        name of the variable to delete\n",
01284        {ArgVar|ArgNew, ArgNone, ArgNone, ArgNone, ArgNone,
01285         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01286     {"Load", F_Load,
01287 "load libraryName\n\n"
01288 "load a pkcs #11 module\n"
01289 " libraryName        Name of a shared library\n",
01290        {ArgVar, ArgNone, ArgNone, ArgNone, ArgNone,
01291         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01292     {"Save", F_SaveVar,
01293 "Save filename variable\n\n"
01294 "Saves the binary value of 'variable' in file 'filename'\n"
01295 " fileName        target file to save the variable in\n"
01296 " variable        variable to save\n",
01297        {ArgVar|ArgNew, ArgVar, ArgNone, ArgNone, ArgNone,
01298         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01299     {"Restore", F_RestoreVar,
01300 "Restore filename variable\n\n"
01301 "Restores a variable from a file\n"
01302 " fileName        target file to restore the variable from\n"
01303 " variable        variable to restore\n",
01304        {ArgVar|ArgNew, ArgVar, ArgNone, ArgNone, ArgNone,
01305         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01306     {"Increment", F_Increment,
01307 "Increment variable value\n\n"
01308 "Increment a variable by value\n",
01309        {ArgVar, ArgULong, ArgNone, ArgNone, ArgNone,
01310         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01311     {"Decrement", F_Decrement,
01312 "Decrement variable value\n\n"
01313 "Decrement a variable by value\n",
01314        {ArgVar, ArgULong, ArgNone, ArgNone, ArgNone,
01315         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01316     {"List", F_List,
01317 "List all the variables\n",
01318        {ArgNone, ArgNone, ArgNone, ArgNone, ArgNone,
01319         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01320     {"Unload", F_Unload,
01321 "Unload the currrently loaded PKCS #11 library\n",
01322        {ArgNone, ArgNone, ArgNone, ArgNone, ArgNone,
01323         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01324     {"Run", F_Run,
01325 "Run filename\n\n"
01326 "reads filename as script of commands to execute\n",
01327        {ArgVar|ArgNew, ArgNone, ArgNone, ArgNone, ArgNone,
01328         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01329     {"Time", F_Time,
01330 "Time pkcs11 command\n\n"
01331 "Execute a pkcs #11 command and time the results\n",
01332        {ArgVar|ArgFull, ArgNone, ArgNone, ArgNone, ArgNone,
01333         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01334     {"System", F_System,
01335        "Set System Flag",
01336        {ArgULong, ArgNone, ArgNone, ArgNone, ArgNone,
01337         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01338     {"LoopRun", F_Loop,
01339 "LoopRun filename var start end step\n\n"
01340 "Run in a loop. Loop exit if scrip does and explicit quit (Quit QuitIf etc.)",
01341        {ArgVar|ArgNew, ArgVar|ArgNew, ArgULong, ArgULong, ArgULong,
01342         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01343     {"Help", F_Help,
01344 "Help [command]\n\n"
01345 "print general help, or help for a specific command\n",
01346        {ArgVar|ArgOpt, ArgNone, ArgNone, ArgNone, ArgNone,
01347         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01348     {"QuitIf", F_QuitIf,
01349 "QuitIf arg1 comparator arg2\n\n"
01350 "Exit from this program if Condition is valid, valid comparators:\n"
01351 "  < > <= >= = !=\n",
01352        {ArgULong, ArgVar|ArgNew, ArgULong, ArgNone, ArgNone,
01353         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01354     {"QuitIfString", F_QuitIfString,
01355 "QuitIfString arg1 comparator arg2\n\n"
01356 "Exit from this program if Condition is valid, valid comparators:\n"
01357 "  = !=\n",
01358        {ArgVar|ArgNew, ArgVar|ArgNew, ArgVar|ArgNew, ArgNone, ArgNone,
01359         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01360     {"Quit", F_Quit,
01361 "Exit from this program",
01362        {ArgNone, ArgNone, ArgNone, ArgNone, ArgNone,
01363         ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
01364 };
01365 
01366 const Commands  *commands= &_commands[0];
01367 const int commandCount = sizeof(_commands) / sizeof(_commands[0]);
01368 
01369 const Topics _topics[] = {
01370    { "variables", 
01371 "Variables are random strings of characters. These should begin with alpha\n"
01372 " characters, and should not contain any spaces, nor should they match any\n"
01373 " built-in constants. There is some checking in the code for these things,\n"
01374 " but it's not 100% and using invalid variable names can cause problems.\n"
01375 " Variables are created by any 'OUT' parameter. If the variable does not\n"
01376 " exist, it will be created. For in parameters variables must already exist.\n"
01377    },
01378    { "constants",
01379 "pk11util recognizes *lots* of constants. All CKA_, CKF_, CKO_, CKU_, CKS_,\n"
01380 " CKC_, CKK_, CKH_, CKM_, CKT_ values from the PKCS #11 spec are recognized.\n"
01381 " Constants can be specified with their fully qualified CK?_ value, or the\n"
01382 " prefix can be dropped. Constants are matched case insensitve.\n" 
01383    },
01384    { "arrays",
01385 "Arrays are special variables which represent 'C' arrays. Each array \n"
01386 " variable can be referenced as a group (using just the name), or as \n"
01387 " individual elements (with the [int] operator). Example:\n"
01388 "      print myArray    # prints the full array.\n"
01389 "      print myArray[3] # prints the 3rd elemement of the array \n"
01390    },
01391    { "sizes",
01392 "Size operaters returns the size in bytes of a variable, or the number of\n"
01393 " elements in an array.\n"
01394 "    size(var) and sizeof(var) return the size of var in bytes.\n"
01395 "    sizea(var) and sizeofarray(var) return the number of elements in var.\n"
01396 "       If var is not an array, sizea(var) returns 1.\n"
01397    },
01398 };
01399 
01400 const Topics *topics=&_topics[0];
01401 const int topicCount = sizeof(_topics)/sizeof(_topics[0]);
01402 
01403