SASC-NG
DVBSoftCAM

cPlainKeyCryptoworks Class Reference

Inheritance diagram for cPlainKeyCryptoworks:

List of all members.

Public Member Functions

 cPlainKeyCryptoworks (bool Super)
virtual bool Parse (const char *line)

Protected Member Functions

virtual bool IsBNKey (void) const
virtual int IdSize (void)
virtual cString PrintKeyNr (void)

Detailed Description

Definition at line 342 of file cryptoworks.c.


Constructor & Destructor Documentation

cPlainKeyCryptoworks::cPlainKeyCryptoworks ( bool  Super)

Definition at line 354 of file cryptoworks.c.

:cDualKey(Super,true)
{}

Member Function Documentation

virtual int cPlainKeyCryptoworks::IdSize ( void  ) [inline, protected, virtual]

Reimplemented from cPlainKey.

Definition at line 345 of file cryptoworks.c.

{ return 4; }
bool cPlainKeyCryptoworks::IsBNKey ( void  ) const [protected, virtual]

Implements cDualKey.

Definition at line 358 of file cryptoworks.c.

References cPlainKey::keynr, and TYPE.

Referenced by Parse().

{
  return TYPE(keynr)==0x10;
}
bool cPlainKeyCryptoworks::Parse ( const char *  line) [virtual]

Implements cPlainKey.

Definition at line 363 of file cryptoworks.c.

References AUTOMEM, Bin2Int, CCID, CCTYP, GetChar(), GetHex(), IsBNKey(), cPlainKey::keynr, KEYSET, PLAINLEN_CW_CC, PLAINLEN_CW_D, PLAINLEN_CW_R, prov, cMutableKey::SetBinKey(), sid, skipspace(), and cPlainKey::type.

{
  unsigned char sid[2], sprov;
  if(GetChar(line,&type,1) && GetHex(line,sid,2) && GetHex(line,&sprov,1)) {
    int keylen, prov;
    type=toupper(type); id=Bin2Int(sid,2); prov=sprov;
    line=skipspace(line);
    bool ok;
    if(!strncasecmp(line,"CC",2)) { // cardkey
      keynr=KEYSET(prov,CCTYP,CCID);
      keylen=PLAINLEN_CW_CC;
      line+=2;
      ok=true;
      }
    else {
      unsigned char sid, styp;
      ok=GetHex(line,&styp,1) && GetHex(line,&sid,1);
      keynr=KEYSET(prov,styp,sid);
      keylen=IsBNKey() ? PLAINLEN_CW_R : PLAINLEN_CW_D;
      }
    if(ok) {
      unsigned char *skey=AUTOMEM(keylen);
      if(GetHex(line,skey,keylen)) {
        SetBinKey(skey,keylen);
        return true;
        }
      }
    }
  return false;
}
cString cPlainKeyCryptoworks::PrintKeyNr ( void  ) [protected, virtual]

Reimplemented from cPlainKey.

Definition at line 394 of file cryptoworks.c.

References CCID, CCTYP, ID, cPlainKey::keynr, PROV, prov, cString::sprintf(), and TYPE.

{
  int prov=PROV(keynr);
  int keytyp=TYPE(keynr);
  int keyid=ID(keynr);
  return cString::sprintf(keytyp==CCTYP && keyid==CCID ? "%02X CC":"%02X %02X %02X",prov,keytyp,keyid);
}

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