/usr/include/cky_factory.h is in libckyapplet1-dev 1.1.0-13+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | /* ***** BEGIN COPYRIGHT BLOCK *****
* Copyright (C) 2005 Red Hat, Inc.
* All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version
* 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* ***** END COPYRIGHT BLOCK ***** */
#ifndef CKY_FACTORY_H
#define CKY_FACTORY_H 1
#include "cky_base.h"
/*
* Various Class bytes
*/
#define CKY_CLASS_ISO7816 0x00
#define CKY_CLASS_GLOBAL_PLATFORM 0x80
#define CKY_CLASS_SECURE 0x84
#define CKY_CLASS_COOLKEY 0xb0
/*
* Applet Instruction Bytes
*/
/* Card Manager */
#define CKY_INS_SELECT_FILE 0xa4
#define CKY_INS_GET_DATA 0xca
/* deprecated */
#define CKY_INS_SETUP 0x2A
#define CKY_INS_GEN_KEYPAIR 0x30
#define CKY_INS_EXPORT_KEY 0x34
#define CKY_INS_UNBLOCK_PIN 0x46
#define CKY_INS_GET_CHALLENGE 0x62
#define CKY_INS_CAC_EXT_AUTH 0x38
#define CKY_INS_LOGOUT_ALL 0x60
/* public */
#define CKY_INS_VERIFY_PIN 0x42
#define CKY_INS_LIST_OBJECTS 0x58
#define CKY_INS_LIST_KEYS 0x3A
#define CKY_INS_LIST_PINS 0x48
#define CKY_INS_GET_STATUS 0x3C
#define CKY_INS_GET_LIFECYCLE 0xF2
#define CKY_INS_GET_ISSUER_INFO 0xF6
#define CKY_INS_GET_BUILTIN_ACL 0xFA
#define CKY_INS_GET_BUILDID 0x70
#define CKY_INS_GET_RANDOM 0x72
#define CKY_INS_SEED_RANDOM 0x73
#define CKY_INS_NOP 0x71
/* nonce validated only */
#define CKY_INS_LOGOUT 0x61
/* nonce validated & Secure Channel */
#define CKY_INS_IMPORT_KEY 0x32
#define CKY_INS_COMPUTE_CRYPT 0x36
#define CKY_INS_CREATE_PIN 0x40
#define CKY_INS_CHANGE_PIN 0x44
#define CKY_INS_CREATE_OBJ 0x5A
#define CKY_INS_DELETE_OBJ 0x52
#define CKY_INS_READ_OBJ 0x56
#define CKY_INS_WRITE_OBJ 0x54
/* Secure channel only */
#define CKY_INS_INIT_UPDATE 0x50
#define CKY_INS_SEC_EXT_AUTH 0x82
#define CKY_INS_SEC_SET_LIFECYCLE 0xF0
#define CKY_INS_SEC_SET_PIN 0x04
#define CKY_INS_SEC_READ_IOBUF 0x08
#define CKY_INS_SEC_START_ENROLLMENT 0x0C
/* CAC */
#define CAC_INS_GET_CERTIFICATE 0x36
#define CAC_INS_SIGN_DECRYPT 0x42
#define CAC_INS_VERIFY_PIN 0x20
#define CAC_INS_GET_PROPERTIES 0x56
#define CAC_INS_READ_FILE 0x52
#define CAC_SIZE_GET_PROPERTIES 48
#define CAC_P1_STEP 0x80
#define CAC_P1_FINAL 0x00
/*
* Fixed return sized from various commands
*/
#define CKY_SIZE_GET_CPLCDATA 45
#define CKY_SIZE_LIST_KEYS 11
#define CKY_SIZE_LIST_PINS 2
#define CKY_SIZE_LIST_OBJECTS 14
#define CKY_SIZE_GET_STATUS 16
#define CKY_SIZE_GET_LIFE_CYCLE 1
#define CKY_SIZE_GET_LIFE_CYCLE_V2 4
#define CKY_SIZE_GET_BUILDID 4
#define CKY_SIZE_GET_ISSUER_INFO 0xe0
#define CKY_SIZE_GET_BUILTIN_ACL 7
/*
* Crypt functions
*/
/* functions */
#define CKY_CIPHER_INIT 1
#define CKY_CIPHER_PROCESS 2
#define CKY_CIPHER_FINAL 3
#define CKY_CIPHER_ONE_STEP 4 /* init and final in one APDU */
/* modes */
#define CKY_RSA_NO_PAD 0x00
#define CKY_RSA_PAD_PKCS1 0x01
#define CKY_DSA_SHA 0x10
#define CKY_DES_CBC_NOPAD 0x20
#define CKY_DES_ECB_NOPAD 0x21
/* operations (Cipher Direction) */
#define CKY_DIR_SIGN 0x01
#define CKY_DIR_VERIFY 0x02
#define CKY_DIR_ENCRYPT 0x03
#define CKY_DIR_DECRYPT 0x04
/* Data Location */
#define CKY_DL_APDU 0x01
#define CKY_DL_OBJECT 0x02
/* Key Types */
#define CKY_KEY_RSA_PUBLIC 0x01
#define CKY_KEY_RSA_PRIVATE 0x02
#define CKY_KEY_RSA_PRIVATE_CRT 0x03
#define CKY_KEY_DSA_PUBLIC 0x04
#define CKY_KEY_DSA_PRIVATE 0x05
#define CKY_KEY_DES 0x06
#define CKY_KEY_3DES 0x07
#define CKY_KEY_3DES3 0x08
/* List Operators */
#define CKY_LIST_RESET 0x00
#define CKY_LIST_NEXT 0x01
/* Max Size for a read block */
#define CKY_MAX_READ_CHUNK_SIZE 255
#define CKY_MAX_WRITE_CHUNK_SIZE 240
/* Life Cycle State */
#define CKY_APPLICATION_LOGICALLY_DELETED 0x00
#define CKY_APPLICATION_INSTALLED 0x03
#define CKY_APPLICATION_SELECTABLE 0x07
#define CKY_APPLICATION_PERSONALIZED 0x0f
#define CKY_APPLICATION_BLOCKED 0x7f
#define CKY_APPLICATION_LOCKED 0xff
#define CKY_CARDM_MANAGER_OP_READER 0x01
#define CKY_CARDM_MANAGER_INITIALIZED 0x03
#define CKY_CARDM_MANAGER_SECURED 0x0f
#define CKY_CARDM_MANAGER_LOCKED 0x7f
#define CKY_CARDM_MANAGER_TERMINATED 0xff
/*
* The following factories 'Fill in' APDUs for each of the
* functions described below. Nonces are not automatically added.
* APDU's are for COOLKEY version 1.0 protocol. Callers should pass
* in Already inited apdu's . Callers are responsible for freeing.
* the APDU data, even in event of failure.
*/
CKY_BEGIN_PROTOS
/* function based factorys */
CKYStatus CKYAPDUFactory_SelectFile(CKYAPDU *apdu, CKYByte p1, CKYByte p2,
const CKYBuffer *AID);
CKYStatus CKYAPDUFactory_SelectCardManager(CKYAPDU *apdu);
CKYStatus CKYAPDUFactory_GetCPLCData(CKYAPDU *apdu);
CKYStatus CKYAPDUFactory_ListKeys(CKYAPDU *apdu, CKYByte sequence);
CKYStatus CKYAPDUFactory_ComputeCryptInit(CKYAPDU *apdu, CKYByte keyNumber,
CKYByte mode, CKYByte direction, CKYByte location);
CKYStatus CKYAPDUFactory_ComputeCryptProcess(CKYAPDU *apdu, CKYByte keyNumber,
CKYByte location, const CKYBuffer *data);
CKYStatus CKYAPDUFactory_ComputeCryptFinal(CKYAPDU *apdu, CKYByte keyNumber,
CKYByte location, const CKYBuffer *data, const CKYBuffer *sig);
CKYStatus CKYAPDUFactory_ComputeCryptOneStep(CKYAPDU *apdu, CKYByte keyNumber,
CKYByte mode, CKYByte direction, CKYByte location,
const CKYBuffer *data, const CKYBuffer *sig);
CKYStatus CKYAPDUFactory_CreatePIN(CKYAPDU *apdu, CKYByte pinNumber,
CKYByte maxAttempts, const char *pinValue);
CKYStatus CKYAPDUFactory_VerifyPIN(CKYAPDU *apdu, CKYByte pinNumber,
const char *pinValue);
CKYStatus CKYAPDUFactory_ChangePIN(CKYAPDU *apdu, CKYByte pinNUmber,
const char *oldPin, const char *newPin);
CKYStatus CKYAPDUFactory_ListPINs(CKYAPDU *apdu);
CKYStatus CKYAPDUFactory_Logout(CKYAPDU *apdu, CKYByte pinNumber);
CKYStatus CKYAPDUFactory_WriteObject(CKYAPDU *apdu, unsigned long objectID,
CKYOffset offset,CKYSize size,CKYBuffer *data);
/* Future add WriteObject */
CKYStatus CKYAPDUFactory_CreateObject(CKYAPDU *apdu, unsigned long objectID,
CKYSize size, unsigned short readACL, unsigned short writeACL,
unsigned short deleteACL);
CKYStatus CKYAPDUFactory_DeleteObject(CKYAPDU *apdu, unsigned long objectID,
CKYByte zero);
CKYStatus CKYAPDUFactory_ReadObject(CKYAPDU *apdu, unsigned long objectID,
CKYOffset offset, CKYByte size);
CKYStatus CKYAPDUFactory_ListObjects(CKYAPDU *apdu, CKYByte sequence);
CKYStatus CKYAPDUFactory_GetStatus(CKYAPDU *apdu);
CKYStatus CKYAPDUFactory_Noop(CKYAPDU *apdu);
CKYStatus CKYAPDUFactory_GetBuildID(CKYAPDU *apdu);
CKYStatus CKYAPDUFactory_GetLifeCycle(CKYAPDU *apdu);
CKYStatus CKYAPDUFactory_GetLifeCycleV2(CKYAPDU *apdu);
CKYStatus CKYAPDUFactory_GetRandom(CKYAPDU *apdu, CKYByte len);
CKYStatus CKYAPDUFactory_SeedRandom(CKYAPDU *apdu, const CKYBuffer *data);
CKYStatus CKYAPDUFactory_GetIssuerInfo(CKYAPDU *apdu);
CKYStatus CKYAPDUFactory_GetBuiltinACL(CKYAPDU *apdu);
CKYStatus CACAPDUFactory_SignDecrypt(CKYAPDU *apdu, CKYByte type,
const CKYBuffer *data);
CKYStatus CACAPDUFactory_VerifyPIN(CKYAPDU *apdu, const char *pin);
CKYStatus CACAPDUFactory_GetCertificate(CKYAPDU *apdu, CKYSize size);
CKYStatus CACAPDUFactory_ReadFile(CKYAPDU *apdu, unsigned short offset,
CKYByte type, CKYByte count);
CKYStatus CACAPDUFactory_GetProperties(CKYAPDU *apdu);
CKY_END_PROTOS
#endif /* CKY_FACTORY_H */
|