SASC
DVBSoftCAM

cPlainKeySeca Class Reference

Inheritance diagram for cPlainKeySeca:

List of all members.

Public Member Functions

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

Protected Member Functions

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

Detailed Description

Definition at line 67 of file seca.c.


Constructor & Destructor Documentation

cPlainKeySeca::cPlainKeySeca ( bool  Super)

Definition at line 79 of file seca.c.

:cDualKey(Super,true)
{}
cPlainKeySeca::cPlainKeySeca ( bool  Super)

Member Function Documentation

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

Reimplemented from cPlainKey.

Definition at line 70 of file seca.c.

{ return 4; }
virtual int cPlainKeySeca::IdSize ( void  ) [inline, protected, virtual]

Reimplemented from cPlainKey.

Definition at line 70 of file seca.c.

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

Implements cDualKey.

Definition at line 83 of file seca.c.

References C2MASK, cPlainKey::keynr, and MBC.

Referenced by Parse(), and PrintKeyNr().

{
  switch(keynr&C2MASK) {
    case MBC('E','1'):
    case MBC('M','1'):
    case MBC('E','3'):
    case MBC('M','3'):
    case MBC('E','5'):
    case MBC('M','5'):
    case MBC('E','9'):
    case MBC('M','9'): return true;
    }
  return false;
}
virtual bool cPlainKeySeca::IsBNKey ( void  ) const [protected, virtual]

Implements cDualKey.

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

Implements cPlainKey.

Definition at line 98 of file seca.c.

References ADDC3, AUTOMEM, Bin2Int, C2, EMM_MAGIC, GetChar(), GetHex(), IsBNKey(), cPlainKey::keynr, N51_MAGIC, PLAINLEN_SECA_B, PLAINLEN_SECA_D, PLAINLEN_SECA_E, PLAINLEN_SECA_H, cMutableKey::SetBinKey(), skipspace(), and cPlainKey::type.

{
  unsigned char sid[2];
  int len;
  if(GetChar(line,&type,1) && (len=GetHex(line,sid,2,false))) {
    type=toupper(type); id=Bin2Int(sid,len);
    line=skipspace(line);
    int emmnr=0, keylen=PLAINLEN_SECA_B;
    if(!strncasecmp(line,"EMM",3)) { // EMM RSA key
      emmnr=EMM_MAGIC;
      line+=3;
      line=skipspace(line);
      }
    else if(!strncasecmp(line,"N51",3)) { // Nano 51 RSA key
      emmnr=N51_MAGIC;
      line+=3;
      line=skipspace(line);
      keylen=toupper(*line)=='E'?1:129;
      }
    bool ok;
    switch(toupper(*line)) {
      case 'E':
      case 'M': ok=GetChar(line,&keynr,2);
                keynr=ADDC3(keynr,emmnr);
                break;
      default:  ok=emmnr ? false : GetHex(line,sid,1);
                keynr=sid[0];
                break;
      }
    if(ok) {
      unsigned char *skey=AUTOMEM(keylen);
      len=GetHex(line,skey,keylen,false);
      if(IsBNKey()) {
        if(C2(keynr)=='E' && len==PLAINLEN_SECA_E) {
          // support short exponent keys
          keylen=len;
          }
        }
      else {
        if(len==PLAINLEN_SECA_H || len==PLAINLEN_SECA_D) {
          // support for 16 & 8 byte keys
          keylen=len;
          }
        }
      if(len==keylen) {
        SetBinKey(skey,keylen);
        return true;
        }
      }
    }
  return false;
}
virtual bool cPlainKeySeca::Parse ( const char *  line) [virtual]

Implements cPlainKey.

cString cPlainKeySeca::PrintKeyNr ( void  ) [protected, virtual]

Reimplemented from cPlainKey.

Definition at line 151 of file seca.c.

References C3, EMM_MAGIC, IsBNKey(), cPlainKey::keynr, and N51_MAGIC.

{
  char nr[32];
  int q=0;
  switch(C3(keynr)) {
    case EMM_MAGIC: q+=snprintf(nr+q,sizeof(nr)-q,"EMM "); break;
    case N51_MAGIC: q+=snprintf(nr+q,sizeof(nr)-q,"N51 "); break;
    }
  if(IsBNKey()) {
    nr[q  ]=(keynr>>8) & 0xff;
    nr[q+1]= keynr     & 0xff;
    nr[q+2]=0;
    q+=2;
    }
  else q+=snprintf(nr+q,sizeof(nr)-q,"%.2X",keynr);
  return nr;
}
virtual cString cPlainKeySeca::PrintKeyNr ( void  ) [protected, virtual]

Reimplemented from cPlainKey.


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