pcsc_funcs.h
Go to the documentation of this file.00001
00016 #ifndef PCSC_FUNCS_H
00017 #define PCSC_FUNCS_H
00018
00019
00020
00021
00022
00023
00024
00025
00026 #define SCARD_FILE_MF 0x3F00
00027 #define SCARD_FILE_GSM_DF 0x7F20
00028 #define SCARD_FILE_UMTS_DF 0x7F50
00029 #define SCARD_FILE_GSM_EF_IMSI 0x6F07
00030 #define SCARD_FILE_EF_DIR 0x2F00
00031 #define SCARD_FILE_EF_ICCID 0x2FE2
00032 #define SCARD_FILE_EF_CK 0x6FE1
00033 #define SCARD_FILE_EF_IK 0x6FE2
00034
00035 #define SCARD_CHV1_OFFSET 13
00036 #define SCARD_CHV1_FLAG 0x80
00037
00038 typedef enum {
00039 SCARD_GSM_SIM_ONLY,
00040 SCARD_USIM_ONLY,
00041 SCARD_TRY_BOTH
00042 } scard_sim_type;
00043
00044
00045 #ifdef PCSC_FUNCS
00046 struct scard_data * scard_init(scard_sim_type sim_type);
00047 void scard_deinit(struct scard_data *scard);
00048
00049 int scard_set_pin(struct scard_data *scard, const char *pin);
00050 int scard_get_imsi(struct scard_data *scard, char *imsi, size_t *len);
00051 int scard_gsm_auth(struct scard_data *scard, const unsigned char *_rand,
00052 unsigned char *sres, unsigned char *kc);
00053 int scard_umts_auth(struct scard_data *scard, const unsigned char *_rand,
00054 const unsigned char *autn,
00055 unsigned char *res, size_t *res_len,
00056 unsigned char *ik, unsigned char *ck, unsigned char *auts);
00057
00058 #else
00059
00060 #define scard_init(s) NULL
00061 #define scard_deinit(s) do { } while (0)
00062 #define scard_set_pin(s, p) -1
00063 #define scard_get_imsi(s, i, l) -1
00064 #define scard_gsm_auth(s, r, s2, k) -1
00065 #define scard_umts_auth(s, r, a, r2, rl, i, c, a2) -1
00066
00067 #endif
00068
00069 #endif
00070