SASC
DVBSoftCAM

cSmartCardDataNagra Class Reference

Inheritance diagram for cSmartCardDataNagra:

List of all members.

Public Member Functions

 cSmartCardDataNagra (void)
 cSmartCardDataNagra (unsigned int id, bool irdmod)
virtual bool Parse (const char *line)
virtual bool Matches (cSmartCardData *param)
 cSmartCardDataNagra (void)
 cSmartCardDataNagra (unsigned int id, bool irdmod)
virtual bool Parse (const char *line)
virtual bool Matches (cSmartCardData *param)

Public Attributes

unsigned int cardid
unsigned char bk [8]
cBN exp
cBN mod
bool isIrdMod

Detailed Description

Definition at line 253 of file sc-nagra.c.


Constructor & Destructor Documentation

cSmartCardDataNagra::cSmartCardDataNagra ( void  )

Definition at line 268 of file sc-nagra.c.

cSmartCardDataNagra::cSmartCardDataNagra ( unsigned int  id,
bool  irdmod 
)

Definition at line 271 of file sc-nagra.c.

References cardid, id, and isIrdMod.

cSmartCardDataNagra::cSmartCardDataNagra ( void  )
cSmartCardDataNagra::cSmartCardDataNagra ( unsigned int  id,
bool  irdmod 
)

Member Function Documentation

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

Implements cSmartCardData.

Definition at line 278 of file sc-nagra.c.

References cardid, and isIrdMod.

{
  cSmartCardDataNagra *cd=(cSmartCardDataNagra *)param;
  return cd->cardid==cardid && cd->isIrdMod==isIrdMod;
}
virtual bool cSmartCardDataNagra::Matches ( cSmartCardData *  param) [virtual]

Implements cSmartCardData.

virtual bool cSmartCardDataNagra::Parse ( const char *  line) [virtual]

Implements cSmartCardData.

bool cSmartCardDataNagra::Parse ( const char *  line) [virtual]

Implements cSmartCardData.

Definition at line 284 of file sc-nagra.c.

References AUTOMEM, bk, cardid, SecondaryKey::cs, SecondaryKey::exp, exp, cBN::Get(), GetHex(), isIrdMod, L_CORE_LOAD, SecondaryKey::mod, mod, PRINTF, skipspace(), UINT16_BE, UINT32_BE, xxor, SecondaryKey::y1, and SecondaryKey::y2.

{
  bool isSK=false;
  int dlen=64;
  BN_set_word(exp,3);
  line=skipspace(line);
  unsigned char id[4];
  if(GetHex(line,id,sizeof(id))!=sizeof(id)) {
    PRINTF(L_CORE_LOAD,"smartcarddatanagra: format error: card id");
    return false;
    }
  cardid=UINT32_BE(id);
  line=skipspace(line);
  if(!strncasecmp(line,"SK",2)) { isSK=true; dlen=96; line+=2; }
  else {
    if(GetHex(line,bk,sizeof(bk))!=sizeof(bk)) {
      PRINTF(L_CORE_LOAD,"smartcarddatanagra: format error: boxkey");
      return false;
      }
    line=skipspace(line);
    if(!strncasecmp(line,"IRDMOD",6)) { isIrdMod=true; line+=6; }
    else if(!strncasecmp(line,"CARDMOD",7)) { isIrdMod=false; line+=7; }
    else {
      PRINTF(L_CORE_LOAD,"smartcarddatanagra: format error: IRDMOD/CARDMOD");
      return false;
      }
    }
  line=skipspace(line);

  unsigned char *buff=AUTOMEM(dlen);
  if(GetHex(line,buff,dlen)!=dlen) {
    PRINTF(L_CORE_LOAD,"smartcarddatanagra: format error: data block");
    return false;
    }
  if(!isSK) {
    mod.Get(buff,64);
    }
  else {
    struct SecondaryKey *sk=(struct SecondaryKey *)buff;
    if(UINT16_BE(sk->cs)!=CRC16(buff,sizeof(*sk)-sizeof(sk->cs),false)) {
      PRINTF(L_CORE_LOAD,"smartcarddatanagra: secondary key CRC failed");
      return false;
      }
    unsigned short e=UINT16_BE(sk->exp);
    if(e!=0x0003 && e!=CRC16(buff,12,false)) BN_set_word(exp,e);
    xxor(bk,sizeof(bk),sk->y1,sk->y2);
    mod.Get(sk->mod,sizeof(sk->mod));
    }
  return true;
}

Member Data Documentation

unsigned char cSmartCardDataNagra::bk

Definition at line 258 of file sc-nagra.c.

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

Definition at line 257 of file sc-nagra.c.

Referenced by cSmartCardDataNagra(), Matches(), and Parse().

Definition at line 259 of file sc-nagra.c.

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

Definition at line 260 of file sc-nagra.c.

Referenced by cSmartCardDataNagra(), Matches(), and Parse().

Definition at line 259 of file sc-nagra.c.

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


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