List of all members.
Protected Member Functions |
| void | ScheduleKey (void) |
| int | PadMessage (unsigned char *data, int len) |
| void | Expand (unsigned char *expanded, const unsigned char *normal) |
| void | Decrypt (unsigned char *data, int len) |
| const unsigned char * | Encrypt (const unsigned char *data, int len, unsigned char *crypt) |
| void | ScheduleKey (void) |
| int | PadMessage (unsigned char *data, int len) |
| void | Expand (unsigned char *expanded, const unsigned char *normal) |
| void | Decrypt (unsigned char *data, int len) |
| const unsigned char * | Encrypt (const unsigned char *data, int len, unsigned char *crypt) |
Protected Attributes |
| unsigned char | desKey [16] |
Detailed Description
Definition at line 38 of file newcamd.c.
Member Function Documentation
| void cTripleDes::Decrypt |
( |
unsigned char * |
data, |
|
|
int |
len |
|
) |
| [protected] |
Definition at line 112 of file newcamd.c.
References L_CC_NEWCAMD, and PRINTF.
{
if((len-2) % 8 || (len-2)<16) {
PRINTF(L_CC_NEWCAMD,"warning: encrypted data size mismatch");
return;
}
DES_cblock ivec;
len-=sizeof(ivec); memcpy(ivec, data+len, sizeof(ivec));
DES_ede2_cbc_encrypt(data+2,data+2,len-2,&ks1,&ks2,(DES_cblock *)ivec,DES_DECRYPT);
}
| void cTripleDes::Decrypt |
( |
unsigned char * |
data, |
|
|
int |
len |
|
) |
| [protected] |
| const unsigned char * cTripleDes::Encrypt |
( |
const unsigned char * |
data, |
|
|
int |
len, |
|
|
unsigned char * |
crypt |
|
) |
| [protected] |
Definition at line 103 of file newcamd.c.
{
DES_cblock ivec;
DES_random_key((DES_cblock *)ivec);
memcpy(crypt+len,ivec,sizeof(ivec));
DES_ede2_cbc_encrypt(data+2,crypt+2,len-2,&ks1,&ks2,(DES_cblock *)ivec,DES_ENCRYPT);
return crypt;
}
| const unsigned char* cTripleDes::Encrypt |
( |
const unsigned char * |
data, |
|
|
int |
len, |
|
|
unsigned char * |
crypt |
|
) |
| [protected] |
| void cTripleDes::Expand |
( |
unsigned char * |
expanded, |
|
|
const unsigned char * |
normal |
|
) |
| [protected] |
Definition at line 65 of file newcamd.c.
Referenced by cCardClientNewCamd::Login().
{
expand[0] = normal[0] & 0xfe;
expand[1] = ((normal[0] << 7) | (normal[1] >> 1)) & 0xfe;
expand[2] = ((normal[1] << 6) | (normal[2] >> 2)) & 0xfe;
expand[3] = ((normal[2] << 5) | (normal[3] >> 3)) & 0xfe;
expand[4] = ((normal[3] << 4) | (normal[4] >> 4)) & 0xfe;
expand[5] = ((normal[4] << 3) | (normal[5] >> 5)) & 0xfe;
expand[6] = ((normal[5] << 2) | (normal[6] >> 6)) & 0xfe;
expand[7] = normal[6] << 1;
expand[8] = normal[7] & 0xfe;
expand[9] = ((normal[7] << 7) | (normal[8] >> 1)) & 0xfe;
expand[10] = ((normal[8] << 6) | (normal[9] >> 2)) & 0xfe;
expand[11] = ((normal[9] << 5) | (normal[10] >> 3)) & 0xfe;
expand[12] = ((normal[10] << 4) | (normal[11] >> 4)) & 0xfe;
expand[13] = ((normal[11] << 3) | (normal[12] >> 5)) & 0xfe;
expand[14] = ((normal[12] << 2) | (normal[13] >> 6)) & 0xfe;
expand[15] = normal[13] << 1;
SetOddParity(expand);
}
| void cTripleDes::Expand |
( |
unsigned char * |
expanded, |
|
|
const unsigned char * |
normal |
|
) |
| [protected] |
| int cTripleDes::PadMessage |
( |
unsigned char * |
data, |
|
|
int |
len |
|
) |
| [protected] |
| int cTripleDes::PadMessage |
( |
unsigned char * |
data, |
|
|
int |
len |
|
) |
| [protected] |
| void cTripleDes::ScheduleKey |
( |
void |
| ) |
[protected] |
| void cTripleDes::ScheduleKey |
( |
void |
| ) |
[protected] |
Member Data Documentation
The documentation for this class was generated from the following files:
- contrib/sasc-ng/sc/PLUGINS/src/sc-src/systems/cardclient/newcamd.c
- systems/cardclient/newcamd.c