SASC-NG
DVBSoftCAM

cSmartCardDataViaccess Class Reference

Inheritance diagram for cSmartCardDataViaccess:

List of all members.

Public Member Functions

 cSmartCardDataViaccess (void)
 cSmartCardDataViaccess (eDataType Type, unsigned char *Id)
virtual bool Parse (const char *line)
virtual bool Matches (cSmartCardData *param)

Public Attributes

eDataType type
unsigned char id [5]
unsigned char pin [8]
unsigned char aes [16]

Detailed Description

Definition at line 116 of file sc-viaccess.c.


Constructor & Destructor Documentation

cSmartCardDataViaccess::cSmartCardDataViaccess ( void  )

Definition at line 129 of file sc-viaccess.c.

:cSmartCardData(SC_ID)
{
  memset(id,0,sizeof(id));
}
cSmartCardDataViaccess::cSmartCardDataViaccess ( eDataType  Type,
unsigned char *  Id 
)

Definition at line 135 of file sc-viaccess.c.

References type.

:cSmartCardData(SC_ID)
{
  type=Type;
  memset(id,0,sizeof(id));
  memcpy(id,Id,IdLen());
}

Member Function Documentation

bool cSmartCardDataViaccess::Matches ( cSmartCardData *  param) [virtual]

Implements cSmartCardData.

Definition at line 143 of file sc-viaccess.c.

References id, and type.

{
  cSmartCardDataViaccess *cd=(cSmartCardDataViaccess *)param;
  return cd->type==type && !memcmp(cd->id,id,IdLen());
}
bool cSmartCardDataViaccess::Parse ( const char *  line) [virtual]

Implements cSmartCardData.

Definition at line 149 of file sc-viaccess.c.

References aes, dtAES, dtPIN, GetHex(), i, L_CORE_LOAD, LDUMP, pin, PRINTF, skipspace(), and type.

{
  line=skipspace(line);
  if(!strncasecmp(line,"PIN",3))       { type=dtPIN; line+=3; }
  else if(!strncasecmp(line,"AES",3))  { type=dtAES; line+=3; }
  else {
    PRINTF(L_CORE_LOAD,"smartcarddataviaccess: format error: datatype");
    return false;
    }
  line=skipspace(line);
  if(GetHex(line,id,IdLen())!=IdLen()) {
    PRINTF(L_CORE_LOAD,"smartcarddataviaccess: format error: serial");
    return false;
    }
  line=skipspace(line);
  if(type==dtPIN) {
    memset(pin,0,sizeof(pin));
    int i, shift=4;
    for(i=0; i<16; i++) {
      if(!isdigit(*line)) {
        PRINTF(L_CORE_LOAD,"smartcarddataviaccess: format error: pin");
        return false;
        }
      pin[i]|=(*line++ - '0')<<shift;
      shift^=4;
      }
    i=(i+1)/2; // num bytes
    memmove(&pin[8-i],pin,i);
//XXX
LDUMP(L_CORE_LOAD,pin,sizeof(pin),"smartcarddataviaccess: pin ");
    }
  else {
    if(GetHex(line,aes,16)!=16) {
      PRINTF(L_CORE_LOAD,"smartcarddataviaccess: format error: aes");
      return false;
      }
    }
  return true;
}

Member Data Documentation

unsigned char cSmartCardDataViaccess::aes[16]

Definition at line 121 of file sc-viaccess.c.

Referenced by cSmartCardViaccess::Init(), and Parse().

unsigned char cSmartCardDataViaccess::id[5]

Definition at line 121 of file sc-viaccess.c.

Referenced by Matches().

unsigned char cSmartCardDataViaccess::pin[8]

Definition at line 121 of file sc-viaccess.c.

Referenced by cSmartCardViaccess::Init(), and Parse().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines