SASC
DVBSoftCAM

cAES Class Reference

#include <crypto.h>

Inheritance diagram for cAES:

List of all members.

Public Member Functions

 cAES (void)
void SetKey (const unsigned char *key)
bool Decrypt (unsigned char *data, int len) const
bool Decrypt (const unsigned char *data, int len, unsigned char *decrypt) const
int Encrypt (const unsigned char *data, int len, unsigned char *crypt) const
 cAES (void)
void SetKey (const unsigned char *key)
bool Decrypt (unsigned char *data, int len) const
bool Decrypt (const unsigned char *data, int len, unsigned char *decrypt) const
int Encrypt (const unsigned char *data, int len, unsigned char *crypt) const

Detailed Description

Definition at line 89 of file crypto.h.


Constructor & Destructor Documentation

cAES::cAES ( void  )

Definition at line 409 of file crypto.c.

{
  active=false;
}
cAES::cAES ( void  )

Member Function Documentation

bool cAES::Decrypt ( unsigned char *  data,
int  len 
) const

Definition at line 431 of file crypto.c.

References AES_decrypt(), and i.

Referenced by cSmartCardViaccess::Decode(), cCmd0cCrypt::Decrypt(), cCardClientCamd35::RecvBlock(), cCardClientCommon::RecvMsg(), and cTPSDecrypt::TpsDecrypt().

{
  if(active) {
    for(int i=0; i<len; i+=16) AES_decrypt(data+i,data+i,(const AES_KEY *)&dkey);
    return true;
    }
  return false;
}
bool cAES::Decrypt ( const unsigned char *  data,
int  len,
unsigned char *  decrypt 
) const

Definition at line 440 of file crypto.c.

References AES_decrypt(), and i.

{
  if(active) {
    for(int i=0; i<len; i+=16) AES_decrypt(data+i,decrypt+i,(const AES_KEY *)&dkey);
    return true;
    }
  return false;
}
bool cAES::Decrypt ( const unsigned char *  data,
int  len,
unsigned char *  decrypt 
) const
bool cAES::Decrypt ( unsigned char *  data,
int  len 
) const
int cAES::Encrypt ( const unsigned char *  data,
int  len,
unsigned char *  crypt 
) const

Definition at line 421 of file crypto.c.

References AES_encrypt(), and i.

Referenced by cCardClientCamd35::SendBlock(), and cCardClientCommon::SendMsg().

{
  if(active) {
    len=(len+15)&(~15); // pad up to a multiple of 16
    for(int i=0; i<len; i+=16) AES_encrypt(data+i,crypt+i,(const AES_KEY *)&ekey);
    return len;
    }
  return -1;
}
int cAES::Encrypt ( const unsigned char *  data,
int  len,
unsigned char *  crypt 
) const
void cAES::SetKey ( const unsigned char *  key)
void cAES::SetKey ( const unsigned char *  key)

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