Back to index

lightning-sunbird  0.9+nobinonly
pkcs11n.h
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  *   Dr Stephen Henson <stephen.henson@gemplus.com>
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #ifndef _PKCS11N_H_
00039 #define _PKCS11N_H_
00040 
00041 #ifdef DEBUG
00042 static const char CKT_CVS_ID[] = "@(#) $RCSfile: pkcs11n.h,v $ $Revision: 1.15 $ $Date: 2005/09/28 17:12:17 $";
00043 #endif /* DEBUG */
00044 
00045 /*
00046  * pkcs11n.h
00047  *
00048  * This file contains the NSS-specific type definitions for Cryptoki
00049  * (PKCS#11).
00050  */
00051 
00052 /*
00053  * NSSCK_VENDOR_NETSCAPE
00054  *
00055  * Cryptoki reserves the high half of all the number spaces for
00056  * vendor-defined use.  I'd like to keep all of our Netscape-
00057  * specific values together, but not in the oh-so-obvious
00058  * 0x80000001, 0x80000002, etc. area.  So I've picked an offset,
00059  * and constructed values for the beginnings of our spaces.
00060  *
00061  * Note that some "historical" Netscape values don't fall within
00062  * this range.
00063  */
00064 #define NSSCK_VENDOR_NETSCAPE 0x4E534350 /* NSCP */
00065 
00066 /*
00067  * Netscape-defined object classes
00068  * 
00069  */
00070 #define CKO_NETSCAPE (CKO_VENDOR_DEFINED|NSSCK_VENDOR_NETSCAPE)
00071 
00072 #define CKO_NETSCAPE_CRL                (CKO_NETSCAPE + 1)
00073 #define CKO_NETSCAPE_SMIME              (CKO_NETSCAPE + 2)
00074 #define CKO_NETSCAPE_TRUST              (CKO_NETSCAPE + 3)
00075 #define CKO_NETSCAPE_BUILTIN_ROOT_LIST  (CKO_NETSCAPE + 4)
00076 #define CKO_NETSCAPE_NEWSLOT            (CKO_NETSCAPE + 5)
00077 #define CKO_NETSCAPE_DELSLOT            (CKO_NETSCAPE + 6)
00078 
00079 /*
00080  * Netscape-defined key types
00081  *
00082  */
00083 #define CKK_NETSCAPE (CKK_VENDOR_DEFINED|NSSCK_VENDOR_NETSCAPE)
00084 
00085 #define CKK_NETSCAPE_PKCS8              (CKK_NETSCAPE + 1)
00086 /*
00087  * Netscape-defined certificate types
00088  *
00089  */
00090 #define CKC_NETSCAPE (CKC_VENDOR_DEFINED|NSSCK_VENDOR_NETSCAPE)
00091 
00092 /*
00093  * Netscape-defined object attributes
00094  *
00095  */
00096 #define CKA_NETSCAPE (CKA_VENDOR_DEFINED|NSSCK_VENDOR_NETSCAPE)
00097 
00098 #define CKA_NETSCAPE_URL                (CKA_NETSCAPE +  1)
00099 #define CKA_NETSCAPE_EMAIL              (CKA_NETSCAPE +  2)
00100 #define CKA_NETSCAPE_SMIME_INFO         (CKA_NETSCAPE +  3)
00101 #define CKA_NETSCAPE_SMIME_TIMESTAMP    (CKA_NETSCAPE +  4)
00102 #define CKA_NETSCAPE_PKCS8_SALT         (CKA_NETSCAPE +  5)
00103 #define CKA_NETSCAPE_PASSWORD_CHECK     (CKA_NETSCAPE +  6)
00104 #define CKA_NETSCAPE_EXPIRES            (CKA_NETSCAPE +  7)
00105 #define CKA_NETSCAPE_KRL                (CKA_NETSCAPE +  8)
00106 
00107 #define CKA_NETSCAPE_PQG_COUNTER        (CKA_NETSCAPE +  20)
00108 #define CKA_NETSCAPE_PQG_SEED           (CKA_NETSCAPE +  21)
00109 #define CKA_NETSCAPE_PQG_H              (CKA_NETSCAPE +  22)
00110 #define CKA_NETSCAPE_PQG_SEED_BITS      (CKA_NETSCAPE +  23)
00111 #define CKA_NETSCAPE_MODULE_SPEC        (CKA_NETSCAPE +  24)
00112 
00113 /*
00114  * Trust attributes:
00115  *
00116  * If trust goes standard, these probably will too.  So I'll
00117  * put them all in one place.
00118  */
00119 
00120 #define CKA_TRUST (CKA_NETSCAPE + 0x2000)
00121 
00122 /* "Usage" key information */
00123 #define CKA_TRUST_DIGITAL_SIGNATURE     (CKA_TRUST +  1)
00124 #define CKA_TRUST_NON_REPUDIATION       (CKA_TRUST +  2)
00125 #define CKA_TRUST_KEY_ENCIPHERMENT      (CKA_TRUST +  3)
00126 #define CKA_TRUST_DATA_ENCIPHERMENT     (CKA_TRUST +  4)
00127 #define CKA_TRUST_KEY_AGREEMENT         (CKA_TRUST +  5)
00128 #define CKA_TRUST_KEY_CERT_SIGN         (CKA_TRUST +  6)
00129 #define CKA_TRUST_CRL_SIGN              (CKA_TRUST +  7)
00130 
00131 /* "Purpose" trust information */
00132 #define CKA_TRUST_SERVER_AUTH           (CKA_TRUST +  8)
00133 #define CKA_TRUST_CLIENT_AUTH           (CKA_TRUST +  9)
00134 #define CKA_TRUST_CODE_SIGNING          (CKA_TRUST + 10)
00135 #define CKA_TRUST_EMAIL_PROTECTION      (CKA_TRUST + 11)
00136 #define CKA_TRUST_IPSEC_END_SYSTEM      (CKA_TRUST + 12)
00137 #define CKA_TRUST_IPSEC_TUNNEL          (CKA_TRUST + 13)
00138 #define CKA_TRUST_IPSEC_USER            (CKA_TRUST + 14)
00139 #define CKA_TRUST_TIME_STAMPING         (CKA_TRUST + 15)
00140 #define CKA_TRUST_STEP_UP_APPROVED      (CKA_TRUST + 16)
00141 
00142 #define CKA_CERT_SHA1_HASH          (CKA_TRUST + 100)
00143 #define CKA_CERT_MD5_HASH          (CKA_TRUST + 101)
00144 
00145 /* Netscape trust stuff */
00146 /* XXX fgmr new ones here-- step-up, etc. */
00147 
00148 /* HISTORICAL: define used to pass in the database key for DSA private keys */
00149 #define CKA_NETSCAPE_DB                 0xD5A0DB00L
00150 #define CKA_NETSCAPE_TRUST              0x80000001L
00151 
00152 /*
00153  * Netscape-defined crypto mechanisms
00154  *
00155  */
00156 #define CKM_NETSCAPE (CKM_VENDOR_DEFINED|NSSCK_VENDOR_NETSCAPE)
00157 
00158 #define CKM_NETSCAPE_AES_KEY_WRAP      (CKM_NETSCAPE + 1)
00159 #define CKM_NETSCAPE_AES_KEY_WRAP_PAD  (CKM_NETSCAPE + 2)
00160 
00161 /*
00162  * HISTORICAL:
00163  * Do not attempt to use these. They are only used by NETSCAPE's internal
00164  * PKCS #11 interface. Most of these are place holders for other mechanism
00165  * and will change in the future.
00166  */
00167 #define CKM_NETSCAPE_PBE_SHA1_DES_CBC           0x80000002L
00168 #define CKM_NETSCAPE_PBE_SHA1_TRIPLE_DES_CBC    0x80000003L
00169 #define CKM_NETSCAPE_PBE_SHA1_40_BIT_RC2_CBC    0x80000004L
00170 #define CKM_NETSCAPE_PBE_SHA1_128_BIT_RC2_CBC   0x80000005L
00171 #define CKM_NETSCAPE_PBE_SHA1_40_BIT_RC4        0x80000006L
00172 #define CKM_NETSCAPE_PBE_SHA1_128_BIT_RC4       0x80000007L
00173 #define CKM_NETSCAPE_PBE_SHA1_FAULTY_3DES_CBC   0x80000008L
00174 #define CKM_NETSCAPE_PBE_SHA1_HMAC_KEY_GEN      0x80000009L
00175 #define CKM_NETSCAPE_PBE_MD5_HMAC_KEY_GEN       0x8000000aL
00176 #define CKM_NETSCAPE_PBE_MD2_HMAC_KEY_GEN       0x8000000bL
00177 
00178 #define CKM_TLS_PRF_GENERAL                     0x80000373L
00179 
00180 /*
00181  * Netscape-defined return values
00182  *
00183  */
00184 #define CKR_NETSCAPE (CKM_VENDOR_DEFINED|NSSCK_VENDOR_NETSCAPE)
00185 
00186 #define CKR_NETSCAPE_CERTDB_FAILED      (CKR_NETSCAPE + 1)
00187 #define CKR_NETSCAPE_KEYDB_FAILED       (CKR_NETSCAPE + 2)
00188 
00189 /*
00190  * Trust info
00191  *
00192  * This isn't part of the Cryptoki standard (yet), so I'm putting
00193  * all the definitions here.  Some of this would move to nssckt.h
00194  * if trust info were made part of the standard.  In view of this
00195  * possibility, I'm putting my (Netscape) values in the netscape
00196  * vendor space, like everything else.
00197  */
00198 
00199 typedef CK_ULONG          CK_TRUST;
00200 
00201 /* The following trust types are defined: */
00202 #define CKT_VENDOR_DEFINED     0x80000000
00203 
00204 #define CKT_NETSCAPE (CKT_VENDOR_DEFINED|NSSCK_VENDOR_NETSCAPE)
00205 
00206 /* If trust goes standard, these'll probably drop out of vendor space. */
00207 #define CKT_NETSCAPE_TRUSTED            (CKT_NETSCAPE + 1)
00208 #define CKT_NETSCAPE_TRUSTED_DELEGATOR  (CKT_NETSCAPE + 2)
00209 #define CKT_NETSCAPE_UNTRUSTED          (CKT_NETSCAPE + 3)
00210 #define CKT_NETSCAPE_MUST_VERIFY        (CKT_NETSCAPE + 4)
00211 #define CKT_NETSCAPE_TRUST_UNKNOWN      (CKT_NETSCAPE + 5) /* default */
00212 
00213 /* 
00214  * These may well remain Netscape-specific; I'm only using them
00215  * to cache resolution data.
00216  */
00217 #define CKT_NETSCAPE_VALID              (CKT_NETSCAPE + 10)
00218 #define CKT_NETSCAPE_VALID_DELEGATOR    (CKT_NETSCAPE + 11)
00219 
00220 
00221 /*
00222  * These are not really PKCS #11 values specifically. They are the 'loadable'
00223  * module spec NSS uses. The are available for others to use as well, but not
00224  * part of the formal PKCS #11 spec.
00225  *
00226  * The function 'FIND' returns an array of PKCS #11 initialization strings
00227  * The function 'ADD' takes a PKCS #11 initialization string and stores it.
00228  * The function 'DEL' takes a 'name= library=' value and deletes the associated
00229  *  string.
00230  * The function 'RELEASE' frees the array returned by 'FIND'
00231  */
00232 #define SECMOD_MODULE_DB_FUNCTION_FIND  0
00233 #define SECMOD_MODULE_DB_FUNCTION_ADD   1
00234 #define SECMOD_MODULE_DB_FUNCTION_DEL   2
00235 #define SECMOD_MODULE_DB_FUNCTION_RELEASE 3 
00236 typedef char ** (PR_CALLBACK *SECMODModuleDBFunc)(unsigned long function,
00237                                         char *parameters, void *moduleSpec);
00238 
00239 /* softoken slot ID's */
00240 #define SFTK_MIN_USER_SLOT_ID 4
00241 #define SFTK_MAX_USER_SLOT_ID 100
00242 #define SFTK_MIN_FIPS_USER_SLOT_ID 101
00243 #define SFTK_MAX_FIPS_USER_SLOT_ID 127
00244 
00245 
00246 #endif /* _PKCS11N_H_ */