|
SASC-NG
DVBSoftCAM
|
00001 /* 00002 * Softcam plugin to VDR (C++) 00003 * 00004 * This code is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This code is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 * Or, point your browser to http://www.gnu.org/copyleft/gpl.html 00018 */ 00019 00020 #ifndef __NAGRA_NAGRA_H 00021 #define __NAGRA_NAGRA_H 00022 00023 #include "system-common.h" 00024 #include "crypto.h" 00025 00026 // ---------------------------------------------------------------- 00027 00028 extern int minEcmTime; 00029 00030 // ---------------------------------------------------------------- 00031 00032 class cPlainKeyNagra : public cDualKey { 00033 private: 00034 int ParseTag(const char *tag, const char * &line); 00035 void GetTagDef(int nr, int &romnr, int &pk, int &keytype); 00036 protected: 00037 virtual bool IsBNKey(void) const; 00038 virtual int IdSize(void) { return 4; } 00039 virtual cString PrintKeyNr(void); 00040 public: 00041 cPlainKeyNagra(bool Super); 00042 virtual bool Parse(const char *line); 00043 static bool IsBNKey(int kn); 00044 }; 00045 00046 // ---------------------------------------------------------------- 00047 00048 class cNagra { 00049 protected: 00050 cRSA rsa; 00051 cBN pubExp; 00052 // 00053 virtual void CreatePQ(const unsigned char *pk, BIGNUM *p, BIGNUM *q)=0; 00054 void ExpandPQ(BIGNUM *p, BIGNUM *q, const unsigned char *data, BIGNUM *e, BIGNUM *m); 00055 void CreateRSAPair(const unsigned char *key, const unsigned char *data, BIGNUM *e, BIGNUM *m); 00056 public: 00057 cNagra(void); 00058 virtual ~cNagra() {}; 00059 }; 00060 00061 #endif