|
SASC
DVBSoftCAM
|
Inheritance diagram for cCamCrypt:Public Member Functions | |
| cCamCrypt (void) | |
| cCamCrypt (void) | |
Protected Member Functions | |
| void | CamCrypt (const unsigned char *key, unsigned char *data) |
| void | RevCamCrypt (const unsigned char *key, unsigned char *data) |
| bool | SetupCardFiles (unsigned char *data, int len, BIGNUM *exp, BIGNUM *mod) |
| void | PrepareCamMessage (unsigned char *plain) |
| bool | EncryptCamMessage (unsigned char *encrypted, const unsigned char *plain) |
| const unsigned char * | CamKey (const unsigned char *data) |
| const unsigned char * | HelperKey (const unsigned char *data) |
| void | CamCrypt (const unsigned char *key, unsigned char *data) |
| void | RevCamCrypt (const unsigned char *key, unsigned char *data) |
| bool | SetupCardFiles (unsigned char *data, int len, BIGNUM *exp, BIGNUM *mod) |
| void | PrepareCamMessage (unsigned char *plain) |
| bool | EncryptCamMessage (unsigned char *encrypted, const unsigned char *plain) |
| const unsigned char * | CamKey (const unsigned char *data) |
| const unsigned char * | HelperKey (const unsigned char *data) |
Definition at line 105 of file sc-irdeto.c.
| cCamCrypt::cCamCrypt | ( | void | ) |
Definition at line 147 of file sc-irdeto.c.
{
randomInit=false;
}
| cCamCrypt::cCamCrypt | ( | void | ) |
| void cCamCrypt::CamCrypt | ( | const unsigned char * | key, |
| unsigned char * | data | ||
| ) | [protected] |
Definition at line 207 of file sc-irdeto.c.
{
unsigned char localKey[8];
memcpy(localKey,key,sizeof(localKey));
for(int idx1=0 ; idx1<7 ; idx1++) RotateLeft8Byte(localKey);
for(int idx1=7 ; idx1>=0 ; idx1--) {
for(int idx2=7 ; idx2>=0 ; idx2--) {
const unsigned char tmp1=cryptTable[data[6] ^ localKey[idx2] ^ idx1];
const unsigned char tmp2=data[0];
data[0]=data[7] ^ tmp1;
data[7]=data[6];
data[6]=data[5] ^ tmp1;
data[5]=data[4];
data[4]=data[3];
data[3]=data[2];
data[2]=data[1];
data[1]=tmp2;
}
RotateRight8Byte(localKey);
}
}
| void cCamCrypt::CamCrypt | ( | const unsigned char * | key, |
| unsigned char * | data | ||
| ) | [protected] |
| const unsigned char* cCamCrypt::CamKey | ( | const unsigned char * | data | ) | [inline, protected] |
Definition at line 122 of file sc-irdeto.c.
Referenced by cSmartCardIrdeto::Init().
{ return data+8; }
| const unsigned char* cCamCrypt::CamKey | ( | const unsigned char * | data | ) | [inline, protected] |
Definition at line 122 of file sc-irdeto.c.
{ return data+8; }
| bool cCamCrypt::EncryptCamMessage | ( | unsigned char * | encrypted, |
| const unsigned char * | plain | ||
| ) | [protected] |
Definition at line 257 of file sc-irdeto.c.
References cRSA::RSA().
Referenced by cSmartCardIrdeto::Init().
{
return rsa.RSA(encrypted,plain,64,cardExp,cardMod,false)>0;
}
| bool cCamCrypt::EncryptCamMessage | ( | unsigned char * | encrypted, |
| const unsigned char * | plain | ||
| ) | [protected] |
| const unsigned char* cCamCrypt::HelperKey | ( | const unsigned char * | data | ) | [inline, protected] |
Definition at line 123 of file sc-irdeto.c.
{ return data+24; }
| const unsigned char* cCamCrypt::HelperKey | ( | const unsigned char * | data | ) | [inline, protected] |
Definition at line 123 of file sc-irdeto.c.
Referenced by cSmartCardIrdeto::Init().
{ return data+24; }
| void cCamCrypt::PrepareCamMessage | ( | unsigned char * | plain | ) | [protected] |
| void cCamCrypt::PrepareCamMessage | ( | unsigned char * | plain | ) | [protected] |
Definition at line 238 of file sc-irdeto.c.
Referenced by cSmartCardIrdeto::Init().
{
/*
static const unsigned char camMsg[] = {
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00
};
memcpy(plain,camMsg,sizeof(camMsg));
*/
plain[0]=0x80;
memset(plain+1 ,0x00,7);
GenerateRandom(plain+16,16);
memcpy(plain+8,plain+16,8);
memset(plain+32,0xFF,31);
plain[63]=0x00;
}
| void cCamCrypt::RevCamCrypt | ( | const unsigned char * | key, |
| unsigned char * | data | ||
| ) | [protected] |
| void cCamCrypt::RevCamCrypt | ( | const unsigned char * | key, |
| unsigned char * | data | ||
| ) | [protected] |
Definition at line 186 of file sc-irdeto.c.
Referenced by cSmartCardIrdeto::Decode(), and cSmartCardIrdeto::Init().
{
unsigned char localKey[8];
memcpy(localKey,key,sizeof(localKey));
for(int idx1=0 ; idx1<8 ; idx1++) {
for(int idx2=0 ; idx2<8 ; idx2++) {
const unsigned char tmp1=cryptTable[data[7] ^ localKey[idx2] ^ idx1];
const unsigned char tmp2=data[0];
data[0]=data[1];
data[1]=data[2];
data[2]=data[3];
data[3]=data[4];
data[4]=data[5];
data[5]=data[6] ^ tmp1;
data[6]=data[7];
data[7]=tmp1 ^ tmp2 ;
}
RotateLeft8Byte(localKey);
}
}
| bool cCamCrypt::SetupCardFiles | ( | unsigned char * | data, |
| int | len, | ||
| BIGNUM * | exp, | ||
| BIGNUM * | mod | ||
| ) | [protected] |
Definition at line 229 of file sc-irdeto.c.
References BN_complement(), and cRSA::RSA().
Referenced by cSmartCardIrdeto::Init().
| bool cCamCrypt::SetupCardFiles | ( | unsigned char * | data, |
| int | len, | ||
| BIGNUM * | exp, | ||
| BIGNUM * | mod | ||
| ) | [protected] |