|
SASC-NG
DVBSoftCAM
|
Inheritance diagram for cPlainKeyIrd:Public Member Functions | |
| cPlainKeyIrd (bool Super) | |
| virtual bool | Parse (const char *line) |
| virtual bool | SetKey (void *Key, int Keylen) |
| virtual bool | SetBinKey (unsigned char *Mem, int Keylen) |
Protected Member Functions | |
| virtual int | IdSize (void) |
| virtual cString | PrintKeyNr (void) |
| int cPlainKeyIrd::IdSize | ( | void | ) | [protected, virtual] |
| bool cPlainKeyIrd::Parse | ( | const char * | line | ) | [virtual] |
Reimplemented from cHexKey.
Definition at line 86 of file irdeto.c.
References Bin2Int, GetChar(), GetHex(), I1_KEYLEN, I2_KEYLEN, cPlainKey::id, cPlainKey::keynr, KEYSET, prov, SetBinKey(), skipspace(), cPlainKey::type, TYPE_I1, TYPE_IV, TYPE_OP, TYPE_PMK, and TYPE_SEED.
{
unsigned char sid[2], skey[I2_KEYLEN];
int klen;
if(GetChar(line,&type,1) && (klen=GetHex(line,sid,2,false))) {
type=toupper(type); id=Bin2Int(sid,klen);
line=skipspace(line);
bool ok=false;
if(klen==2) {
klen=I2_KEYLEN;
unsigned char prov;
if(GetHex(line,&prov,1)) {
line=skipspace(line);
int typ, id;
if(!strncasecmp(line,"IV",2)) { typ=TYPE_IV; id=0; line+=2; ok=true; }
else if(!strncasecmp(line,"ECM",3)) { typ=TYPE_SEED; id=0; line+=3; ok=true; }
else if(!strncasecmp(line,"EMM",3)) { typ=TYPE_SEED; id=1; line+=3; ok=true; }
else if(!strncasecmp(line,"MK",2)) { typ=TYPE_PMK; id=line[2]-'0'; line+=3; ok=true; }
else { typ=TYPE_OP; ok=GetHex(line,sid,1); id=sid[0]; }
keynr=KEYSET(prov,typ,id);
}
}
else {
klen=I1_KEYLEN;
ok=GetHex(line,sid,1);
keynr=KEYSET(0,TYPE_I1,sid[0]);
}
line=skipspace(line);
if(ok && GetHex(line,skey,klen)) {
SetBinKey(skey,klen);
return true;
}
}
return false;
}
| cString cPlainKeyIrd::PrintKeyNr | ( | void | ) | [protected, virtual] |
Reimplemented from cPlainKey.
Definition at line 122 of file irdeto.c.
References ID, cPlainKey::keynr, PROV, TYPE, TYPE_IV, TYPE_OP, TYPE_PMK, and TYPE_SEED.
{
char tmp[16];
if(IsI2Key()) {
snprintf(tmp,sizeof(tmp),"%02X ",PROV(keynr));
switch(TYPE(keynr)) {
case TYPE_OP: snprintf(tmp+3,sizeof(tmp)-3,"%02X",ID(keynr)); break;
case TYPE_IV: snprintf(tmp+3,sizeof(tmp)-3,"IV"); break;
case TYPE_SEED: snprintf(tmp+3,sizeof(tmp)-3,"%s",ID(keynr)?"EMM":"ECM"); break;
case TYPE_PMK: snprintf(tmp+3,sizeof(tmp)-3,"MK%d",ID(keynr)); break;
}
}
else
snprintf(tmp,sizeof(tmp),"%02X",ID(keynr));
return tmp;
}
| bool cPlainKeyIrd::SetBinKey | ( | unsigned char * | Mem, |
| int | Keylen | ||
| ) | [virtual] |
Reimplemented from cHexKey.
Definition at line 70 of file irdeto.c.
References cPlainKey::SetSupersede().
Referenced by Parse().
{
if(!IsI2Key()) SetSupersede(false);
return cHexKey::SetBinKey(Mem,Keylen);
}
| bool cPlainKeyIrd::SetKey | ( | void * | Key, |
| int | Keylen | ||
| ) | [virtual] |
Reimplemented from cHexKey.
Definition at line 64 of file irdeto.c.
References cPlainKey::SetSupersede().
{
if(!IsI2Key()) SetSupersede(false);
return cHexKey::SetKey(Key,Keylen);
}