SASC
DVBSoftCAM

cSmartCardDataCryptoworks Class Reference

Inheritance diagram for cSmartCardDataCryptoworks:

List of all members.

Public Member Functions

 cSmartCardDataCryptoworks (void)
 cSmartCardDataCryptoworks (eDataType Type, unsigned char *Id)
virtual bool Parse (const char *line)
virtual bool Matches (cSmartCardData *param)
 cSmartCardDataCryptoworks (void)
 cSmartCardDataCryptoworks (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 [4]
cBN key

Detailed Description

Definition at line 109 of file sc-cryptoworks.c.


Constructor & Destructor Documentation

cSmartCardDataCryptoworks::cSmartCardDataCryptoworks ( void  )

Definition at line 123 of file sc-cryptoworks.c.

cSmartCardDataCryptoworks::cSmartCardDataCryptoworks ( eDataType  Type,
unsigned char *  Id 
)

Definition at line 127 of file sc-cryptoworks.c.

References type.

:cSmartCardData(SC_ID)
{
  type=Type;
  memset(id,0,sizeof(id));
  memcpy(id,Id,IdLen());
}
cSmartCardDataCryptoworks::cSmartCardDataCryptoworks ( void  )
cSmartCardDataCryptoworks::cSmartCardDataCryptoworks ( eDataType  Type,
unsigned char *  Id 
)

Member Function Documentation

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

Implements cSmartCardData.

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

References id, and type.

{
  cSmartCardDataCryptoworks *cd=(cSmartCardDataCryptoworks *)param;
  return cd->type==type && !memcmp(cd->id,id,IdLen());
}
virtual bool cSmartCardDataCryptoworks::Matches ( cSmartCardData *  param) [virtual]

Implements cSmartCardData.

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

Implements cSmartCardData.

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

Implements cSmartCardData.

Definition at line 141 of file sc-cryptoworks.c.

References dtIPK, dtPIN, dtUCPK, GetHex(), i, key, L_CORE_LOAD, pin, PRINTF, skipspace(), and type.

{
  line=skipspace(line);
  if(!strncasecmp(line,"IPK",3))       { type=dtIPK;  line+=3; }
  else if(!strncasecmp(line,"UCPK",4)) { type=dtUCPK; line+=4; }
  else if(!strncasecmp(line,"PIN",3))  { type=dtPIN;  line+=3; }
  else {
    PRINTF(L_CORE_LOAD,"smartcarddatacryptoworks: format error: datatype");
    return false;
    }
  line=skipspace(line);
  if(GetHex(line,id,IdLen())!=IdLen()) {
    PRINTF(L_CORE_LOAD,"smartcarddatacryptoworks: format error: caid/serial");
    return false;
    }
  line=skipspace(line);
  if(type==dtPIN) {
    for(int i=0; i<4; i++) {
      if(!isdigit(*line)) {
        PRINTF(L_CORE_LOAD,"smartcarddatacryptoworks: format error: pin");
        return false;
        }
      pin[i]=*line++;
      }
    }
  else {
    unsigned char buff[64];
    if(GetHex(line,buff,64,true)!=64) {
      PRINTF(L_CORE_LOAD,"smartcarddatacryptoworks: format error: ipk/ucpk");
      return false;
      }
    BN_bin2bn(buff,64,key);
    }
  return true;
}

Member Data Documentation

Definition at line 114 of file sc-cryptoworks.c.

Referenced by Matches().

Definition at line 114 of file sc-cryptoworks.c.

Referenced by cSmartCardCryptoworks::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