SASC-NG
DVBSoftCAM

cBNKey Class Reference

#include <system-common.h>

Inheritance diagram for cBNKey:

List of all members.

Public Member Functions

 cBNKey (bool Super, bool Rotate=false)
virtual ~cBNKey ()
virtual bool Parse (const char *line)

Protected Member Functions

virtual bool SetKey (void *Key, int Keylen)
virtual bool SetBinKey (unsigned char *Mem, int Keylen)
virtual cString Print (void)
virtual bool Cmp (cPlainKey *k)
virtual void Get (void *mem)
virtual int Size (void)

Detailed Description

Definition at line 49 of file system-common.h.


Constructor & Destructor Documentation

cBNKey::cBNKey ( bool  Super,
bool  Rotate = false 
)

Definition at line 78 of file system-common.c.

:cPlainKey(Super)
{
  key=new cBN; rotate=Rotate;
}
cBNKey::~cBNKey ( ) [virtual]

Definition at line 84 of file system-common.c.

{
  delete key;
}

Member Function Documentation

bool cBNKey::Cmp ( cPlainKey *  k) [protected, virtual]

Implements cPlainKey.

Definition at line 101 of file system-common.c.

References k.

{
  cBNKey *bk=dynamic_cast<cBNKey *>(k); // downcast
  return bk && BN_cmp(*key,*bk->key)==0;
}
void cBNKey::Get ( void *  mem) [protected, virtual]

Implements cPlainKey.

Definition at line 107 of file system-common.c.

{
  BN_copy((BIGNUM *)mem,*key);
}
virtual bool cBNKey::Parse ( const char *  line) [inline, virtual]

Implements cPlainKey.

Reimplemented in cPlainKeyConax.

Definition at line 64 of file system-common.h.

{ return false; }
cString cBNKey::Print ( void  ) [protected, virtual]

Implements cPlainKey.

Definition at line 112 of file system-common.c.

References AUTOMEM, HexStr(), cBN::Put(), and cBN::PutLE().

{
  unsigned char *mem=AUTOMEM(keylen);
  if(rotate) key->PutLE(mem,keylen); else key->Put(mem,keylen);
  char *str=(char *)malloc(keylen*2+2);
  if(str) HexStr(str,mem,keylen);
  return cString(str,true);
}
bool cBNKey::SetBinKey ( unsigned char *  Mem,
int  Keylen 
) [protected, virtual]

Implements cPlainKey.

Definition at line 95 of file system-common.c.

References cBN::Get(), and cBN::GetLE().

Referenced by cPlainKeyConax::Parse().

{
  keylen=Keylen;
  return rotate ? key->GetLE(Mem,Keylen) : key->Get(Mem,Keylen);
}
bool cBNKey::SetKey ( void *  Key,
int  Keylen 
) [protected, virtual]

Implements cPlainKey.

Definition at line 89 of file system-common.c.

{
  keylen=Keylen;
  return BN_copy(*key,(BIGNUM *)Key)!=0;
}
virtual int cBNKey::Size ( void  ) [inline, protected, virtual]

Implements cPlainKey.

Definition at line 60 of file system-common.h.

{ return keylen; }

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