-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsigner.h
64 lines (55 loc) · 1.61 KB
/
signer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef __SIGNER_H_INCLUDE__
#define __SIGNER_H_INCLUDE__
#include "stdafx.h"
#include "cmdbase.h"
#define MAXBUF 8192
#define MAXSTR 8192
const long lMinKeyFileSize = 164;//smallest size of the keysfaile
const long lKiloByte = 1024;//1 kilobyte in bytes
const long lMegaByte = lKiloByte*lKiloByte;//1 megabyte in bytes
const long lScrollZoom = 100;
const long lMaxKeyFileSize = 10*lMegaByte;//10 Mb in this version
const szptr szOptionKeyFileSize = "KeyFileSize";
const unsigned int uiKWNHeaderOffset = 2;
const unsigned int uiKWNHeaderSize = uiKWNHeaderOffset + lMinKeyFileSize;
const unsigned int uiBlockSizeOffset = 1;
class Signer
{
public:
bool isIgnoreKeyFile;
bool isIgnoreIniFile;
bool isKWMFileFromCL;
char szKeyData[MAXBUF+1]; /* Buffer for Signre-s key */
int Key64Flag;
protected:
szptr m_szUserName;
szptr m_szPassword;
szptr m_szKeyFileName;
short m_siErrorCode;
Keys keys;
bool SecureKeyByIDPW(char *buf, DWORD dwBuf);
bool SecureKeyByIDPWHalf(char *buf, DWORD dwBuf);
int virtual LoadKeys();
public:
Signer(const char *szLogin, const char *szPassword, const char *szKeyFileName);
bool Sign(const char *szIn, szptr& szSign);
short ErrorCode();
//-------------------------------------------------
public:
int KeyFromCL;
char KeyBuffer[164];
void SetKeyFromCL( int flag, char *KeyBuf );
//-------------------------------------------------
};
class Signer2: public Signer
{
protected:
szptr m_strKeyData;
short m_siErrorCode;
int virtual LoadKeys();
public:
Signer2(const char *szLogin, const char *szPassword, const char *szKeyData);
short ErrorCode();
};
#endif
//-----