Back to index

lightning-sunbird  0.9+nobinonly
pkcs11.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  *
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 #ifndef PKCS11_H
00037 #define PKCS11_H
00038 
00039 #define NULL_OP             0x00
00040 #define ENCRYPT_OP   0x01
00041 #define SIGN_OP             0x02
00042 #define KEYGEN_OP    0x04
00043 #define DIGEST_OP    0x08
00044 #define HMAC_OP             0x10
00045 
00046 typedef struct {
00047        CK_MECHANISM_TYPE    type;
00048        int                  op;
00049        CK_MECHANISM_TYPE    keygenMech;
00050 } MechInfo;
00051 
00052 static int numMechs=118;
00053 static MechInfo mechInfo[] = {
00054        {CKM_RSA_PKCS_KEY_PAIR_GEN,
00055                             KEYGEN_OP,    CKM_RSA_PKCS_KEY_PAIR_GEN},
00056        {CKM_RSA_PKCS,              ENCRYPT_OP | SIGN_OP,
00057                                           CKM_RSA_PKCS_KEY_PAIR_GEN},
00058        {CKM_RSA_9796,              SIGN_OP,      CKM_RSA_PKCS_KEY_PAIR_GEN},
00059        {CKM_RSA_X_509,             ENCRYPT_OP | SIGN_OP,
00060                                           CKM_RSA_PKCS_KEY_PAIR_GEN},
00061        {CKM_MD2_RSA_PKCS,   SIGN_OP,      CKM_RSA_PKCS_KEY_PAIR_GEN},
00062        {CKM_MD5_RSA_PKCS,   SIGN_OP,      CKM_RSA_PKCS_KEY_PAIR_GEN},
00063        {CKM_SHA1_RSA_PKCS,  SIGN_OP,      CKM_RSA_PKCS_KEY_PAIR_GEN},
00064        {CKM_DSA_KEY_PAIR_GEN,      KEYGEN_OP,    CKM_DSA_KEY_PAIR_GEN},
00065        {CKM_DSA,            SIGN_OP,      CKM_DSA_KEY_PAIR_GEN},
00066        {CKM_DSA_SHA1,              SIGN_OP,      CKM_DSA_KEY_PAIR_GEN},
00067        {CKM_DH_PKCS_KEY_PAIR_GEN,
00068                             KEYGEN_OP,    CKM_DH_PKCS_KEY_PAIR_GEN},
00069        {CKM_DH_PKCS_DERIVE, NULL_OP,      0},
00070        {CKM_RC2_KEY_GEN,    KEYGEN_OP,    CKM_RC2_KEY_GEN},
00071        {CKM_RC2_ECB,        ENCRYPT_OP,   CKM_RC2_KEY_GEN},
00072        {CKM_RC2_CBC,        ENCRYPT_OP,   CKM_RC2_KEY_GEN},
00073        {CKM_RC2_MAC,        NULL_OP,      CKM_RC2_KEY_GEN},
00074        {CKM_RC2_MAC_GENERAL,       NULL_OP,      CKM_RC2_KEY_GEN},
00075        {CKM_RC2_CBC_PAD,    NULL_OP,      CKM_RC2_KEY_GEN},
00076        {CKM_RC4_KEY_GEN,    KEYGEN_OP,    CKM_RC4_KEY_GEN},
00077        {CKM_RC4,            ENCRYPT_OP,   CKM_RC4_KEY_GEN},
00078        {CKM_DES_KEY_GEN,    KEYGEN_OP,    CKM_DES_KEY_GEN},
00079        {CKM_DES_ECB,        ENCRYPT_OP,   CKM_DES_KEY_GEN},
00080        {CKM_DES_CBC,        ENCRYPT_OP,   CKM_DES_KEY_GEN},
00081        {CKM_DES_MAC,        NULL_OP,      CKM_DES_KEY_GEN},
00082        {CKM_DES_MAC_GENERAL,       NULL_OP,      CKM_DES_KEY_GEN},
00083        {CKM_DES_CBC_PAD,    NULL_OP,      CKM_DES_KEY_GEN},
00084        {CKM_DES2_KEY_GEN,   KEYGEN_OP,    CKM_DES2_KEY_GEN},
00085        {CKM_DES3_KEY_GEN,   KEYGEN_OP,    CKM_DES3_KEY_GEN},
00086        {CKM_DES3_ECB,              ENCRYPT_OP,   CKM_DES3_KEY_GEN},
00087        {CKM_DES3_CBC,              ENCRYPT_OP,   CKM_DES3_KEY_GEN},
00088        {CKM_DES3_MAC,              NULL_OP,      CKM_DES3_KEY_GEN},
00089        {CKM_DES3_MAC_GENERAL,      NULL_OP,      CKM_DES3_KEY_GEN},
00090        {CKM_DES3_CBC_PAD,   NULL_OP,      CKM_DES3_KEY_GEN},
00091        {CKM_CDMF_KEY_GEN,   KEYGEN_OP,    CKM_CDMF_KEY_GEN},
00092        {CKM_CDMF_ECB,              ENCRYPT_OP,   CKM_CDMF_KEY_GEN},
00093        {CKM_CDMF_CBC,              ENCRYPT_OP,   CKM_CDMF_KEY_GEN},
00094        {CKM_CDMF_MAC,              NULL_OP,      CKM_CDMF_KEY_GEN},
00095        {CKM_CDMF_MAC_GENERAL,      NULL_OP,      CKM_CDMF_KEY_GEN},
00096        {CKM_CDMF_CBC_PAD,   NULL_OP,      CKM_CDMF_KEY_GEN},
00097        {CKM_MD2,            DIGEST_OP,    0},
00098        {CKM_MD2_HMAC,              HMAC_OP,      0},
00099        {CKM_MD2_HMAC_GENERAL,      HMAC_OP,      0},
00100        {CKM_MD5,            DIGEST_OP,    0},
00101        {CKM_MD5_HMAC,              HMAC_OP,      0},
00102        {CKM_MD5_HMAC_GENERAL,      HMAC_OP,      0},
00103        {CKM_SHA_1,          DIGEST_OP,    0},
00104        {CKM_SHA_1_HMAC,     HMAC_OP,      0},
00105        {CKM_SHA_1_HMAC_GENERAL,HMAC_OP,   0},
00106        {CKM_CAST_KEY_GEN,   KEYGEN_OP,    CKM_CAST_KEY_GEN},
00107        {CKM_CAST_ECB,              ENCRYPT_OP,   CKM_CAST_KEY_GEN},
00108        {CKM_CAST_CBC,              ENCRYPT_OP,   CKM_CAST_KEY_GEN},
00109        {CKM_CAST_MAC,              NULL_OP,      CKM_CAST_KEY_GEN},
00110        {CKM_CAST_MAC_GENERAL,      NULL_OP,      CKM_CAST_KEY_GEN},
00111        {CKM_CAST_CBC_PAD,   NULL_OP,      CKM_CAST_KEY_GEN},
00112        {CKM_CAST3_KEY_GEN,  KEYGEN_OP,    CKM_CAST3_KEY_GEN},
00113        {CKM_CAST3_ECB,             ENCRYPT_OP,   CKM_CAST3_KEY_GEN},
00114        {CKM_CAST3_CBC,             ENCRYPT_OP,   CKM_CAST3_KEY_GEN},
00115        {CKM_CAST3_MAC,             NULL_OP,      CKM_CAST3_KEY_GEN},
00116        {CKM_CAST3_MAC_GENERAL,     NULL_OP,      CKM_CAST3_KEY_GEN},
00117        {CKM_CAST3_CBC_PAD,  NULL_OP,      CKM_CAST3_KEY_GEN},
00118        {CKM_CAST5_KEY_GEN,  KEYGEN_OP,    CKM_CAST5_KEY_GEN},
00119        {CKM_CAST5_ECB,             ENCRYPT_OP,   CKM_CAST5_KEY_GEN},
00120        {CKM_CAST5_CBC,             ENCRYPT_OP,   CKM_CAST5_KEY_GEN},
00121        {CKM_CAST5_MAC,             NULL_OP,      CKM_CAST5_KEY_GEN},
00122        {CKM_CAST5_MAC_GENERAL,     NULL_OP,      CKM_CAST5_KEY_GEN},
00123        {CKM_CAST5_CBC_PAD,  NULL_OP,      CKM_CAST5_KEY_GEN},
00124        {CKM_RC5_KEY_GEN,    KEYGEN_OP,    CKM_RC5_KEY_GEN},
00125        {CKM_RC5_ECB,        ENCRYPT_OP,   CKM_RC5_KEY_GEN},
00126        {CKM_RC5_CBC,        ENCRYPT_OP,   CKM_RC5_KEY_GEN},
00127        {CKM_RC5_MAC,        NULL_OP,      CKM_RC5_KEY_GEN},
00128        {CKM_RC5_MAC_GENERAL,       NULL_OP,      CKM_RC5_KEY_GEN},
00129        {CKM_RC5_CBC_PAD,    NULL_OP,      CKM_RC5_KEY_GEN},
00130        {CKM_IDEA_KEY_GEN,   KEYGEN_OP,    CKM_IDEA_KEY_GEN},
00131        {CKM_IDEA_ECB,              ENCRYPT_OP,   CKM_IDEA_KEY_GEN},
00132        {CKM_IDEA_CBC,              ENCRYPT_OP,   CKM_IDEA_KEY_GEN},
00133        {CKM_IDEA_MAC,              NULL_OP,      CKM_IDEA_KEY_GEN},
00134        {CKM_IDEA_MAC_GENERAL,      NULL_OP,      CKM_IDEA_KEY_GEN},
00135        {CKM_IDEA_CBC_PAD,   NULL_OP,      CKM_IDEA_KEY_GEN},
00136        {CKM_GENERIC_SECRET_KEY_GEN,
00137                             KEYGEN_OP,    CKM_GENERIC_SECRET_KEY_GEN},
00138 /* SSL mechanisms?
00139        {CKM_SSL3_PRE_MASTER_KEY_GEN},
00140        {CKM_SSL3_MASTER_KEY_DERIVE},
00141        {CKM_SSL3_KEY_AND_MAC_DERIVE},
00142        {CKM_SSL3_MD5_MAC},
00143        {CKM_SSL3_SHA1_MAC},
00144 */
00145        {CKM_PBE_MD2_DES_CBC,       KEYGEN_OP,    0},
00146        {CKM_PBE_MD5_DES_CBC,       KEYGEN_OP,    0},
00147        {CKM_PBE_MD5_CAST_CBC,      KEYGEN_OP,    0},
00148        {CKM_PBE_MD5_CAST3_CBC,     KEYGEN_OP,    0},
00149        {CKM_PBE_MD5_CAST5_CBC,     KEYGEN_OP,    0},
00150        {CKM_PBE_MD5_CAST128_CBC,
00151                             KEYGEN_OP,    0},
00152        {CKM_PBE_SHA1_CAST5_CBC,KEYGEN_OP, 0},
00153        {CKM_PBE_SHA1_CAST128_CBC,
00154                             KEYGEN_OP,    0},
00155        {CKM_PBE_SHA1_RC4_128,      KEYGEN_OP,    0},
00156        {CKM_PBE_SHA1_RC4_40,       KEYGEN_OP,    0},
00157        {CKM_PBE_SHA1_DES3_EDE_CBC,
00158                             KEYGEN_OP,    0},
00159        {CKM_PBE_SHA1_DES2_EDE_CBC,
00160                             KEYGEN_OP,    0},
00161        {CKM_PBE_SHA1_RC2_128_CBC,
00162                             KEYGEN_OP,    0},
00163        {CKM_PBE_SHA1_RC2_40_CBC,
00164                             KEYGEN_OP,    0},
00165        {CKM_PBA_SHA1_WITH_SHA1_HMAC,
00166                             KEYGEN_OP,    0},
00167        {CKM_SKIPJACK_KEY_GEN,      KEYGEN_OP,    CKM_SKIPJACK_KEY_GEN},
00168        {CKM_SKIPJACK_ECB64, ENCRYPT_OP,   CKM_SKIPJACK_KEY_GEN},
00169        {CKM_SKIPJACK_CBC64, ENCRYPT_OP,   CKM_SKIPJACK_KEY_GEN},
00170        {CKM_SKIPJACK_OFB64, ENCRYPT_OP,   CKM_SKIPJACK_KEY_GEN},
00171        {CKM_SKIPJACK_CFB64, ENCRYPT_OP,   CKM_SKIPJACK_KEY_GEN},
00172        {CKM_SKIPJACK_CFB32, ENCRYPT_OP,   CKM_SKIPJACK_KEY_GEN},
00173        {CKM_SKIPJACK_CFB16, ENCRYPT_OP,   CKM_SKIPJACK_KEY_GEN},
00174        {CKM_SKIPJACK_CFB8,  ENCRYPT_OP,   CKM_SKIPJACK_KEY_GEN},
00175        {CKM_KEA_KEY_PAIR_GEN,      KEYGEN_OP,    0},
00176        {CKM_BATON_KEY_GEN,  KEYGEN_OP,    CKM_BATON_KEY_GEN},
00177        {CKM_BATON_ECB128,   ENCRYPT_OP,   CKM_BATON_KEY_GEN},
00178        {CKM_BATON_ECB96,    ENCRYPT_OP,   CKM_BATON_KEY_GEN},
00179        {CKM_BATON_CBC128,   ENCRYPT_OP,   CKM_BATON_KEY_GEN},
00180        {CKM_BATON_COUNTER,  ENCRYPT_OP,   CKM_BATON_KEY_GEN},
00181        {CKM_BATON_SHUFFLE,  ENCRYPT_OP,   CKM_BATON_KEY_GEN},
00182        {CKM_ECDSA_KEY_PAIR_GEN,KEYGEN_OP, CKM_ECDSA_KEY_PAIR_GEN},
00183        {CKM_ECDSA,          SIGN_OP,      CKM_ECDSA_KEY_PAIR_GEN},
00184        {CKM_ECDSA_SHA1,     SIGN_OP,      CKM_ECDSA_KEY_PAIR_GEN},
00185        {CKM_JUNIPER_KEY_GEN,       KEYGEN_OP,    CKM_JUNIPER_KEY_GEN},
00186        {CKM_JUNIPER_ECB128, ENCRYPT_OP,   CKM_JUNIPER_KEY_GEN},
00187        {CKM_JUNIPER_CBC128, ENCRYPT_OP,   CKM_JUNIPER_KEY_GEN},
00188        {CKM_JUNIPER_COUNTER,       ENCRYPT_OP,   CKM_JUNIPER_KEY_GEN},
00189        {CKM_JUNIPER_SHUFFLE,       ENCRYPT_OP,   CKM_JUNIPER_KEY_GEN},
00190        {CKM_FASTHASH,              DIGEST_OP,    0}
00191 };
00192 
00193 #endif