summaryrefslogtreecommitdiff
path: root/plugins/SecureIM/src/cryptopp.h
blob: bfa4e097b3682ab4dbb9eae173a738988d24b8e5 (plain)
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
65
66
67
68
69
70
71
72
73
#ifndef __CRYPTOPP_H__
#define __CRYPTOPP_H__

#define CPP_FEATURES_UTF8		0x01
#define CPP_FEATURES_BASE64		0x02
#define CPP_FEATURES_GZIP		0x04
#define CPP_FEATURES_CRC32		0x08
#define CPP_FEATURES_PSK		0x10
#define CPP_FEATURES_NEWPG		0x20
#define CPP_FEATURES_RSA		0x40

#define CPP_MODE_BASE16			0x0000
#define CPP_MODE_BASE64			0x0001
#define CPP_MODE_PGP			0x0002
#define CPP_MODE_GPG			0x0004
#define CPP_MODE_GPG_ANSI		0x0008
#define CPP_MODE_PRIV_KEY		0x0010
#define CPP_MODE_RSA_2048		0x0020
#define CPP_MODE_RSA_4096		0x0040
#define CPP_MODE_RSA			CPP_MODE_RSA_4096
#define CPP_MODE_RSA_ONLY		0x0080
#define CPP_MODE_RSA_ZLIB		0x0100
#define CPP_MODE_RSA_BER 		0x0200

#define CPP_ERROR_NONE			0
#define CPP_ERROR_SEH			1
#define CPP_ERROR_NO_KEYA		2
#define CPP_ERROR_NO_KEYB		3
#define CPP_ERROR_NO_KEYX		4
#define CPP_ERROR_BAD_LEN		5
#define CPP_ERROR_BAD_CRC		6
#define CPP_ERROR_NO_PSK		7
#define CPP_ERROR_BAD_PSK		8
#define CPP_ERROR_BAD_KEYB		9
#define CPP_ERROR_NO_PGP_KEY		10

typedef struct {
    int (__cdecl *rsa_gen_keypair)(short);				// ãåíåðèò RSA-êëþ÷è äëÿ óêàçàííîé äëèíû (ëèáî òîêà 2048, ëèáî 2048 è 4096)
    int (__cdecl *rsa_get_keypair)(short,PBYTE,int*,PBYTE,int*);	// âîçâðàùàåò ïàðó êëþ÷åé äëÿ óêàçàííîé äëèíû
    int (__cdecl *rsa_get_keyhash)(short,PBYTE,int*,PBYTE,int*);	// âîçâðàùàåò hash ïàðû êëþ÷åé äëÿ óêàçàííîé äëèíû
    int (__cdecl *rsa_set_keypair)(short,PBYTE,int);			// óñòàíàâëèâàåò êëþ÷è, óêàçàííîé äëèíû
    int (__cdecl *rsa_get_pubkey)(HANDLE,PBYTE,int*);			// âîçâðàùàåò ïàáëèê êëþ÷ èç óêàçàííîãî êîíòåêñòà
    int (__cdecl *rsa_set_pubkey)(HANDLE,PBYTE,int);			// çàãðóæàåò ïàáëèê êëþ÷ äëÿ óêàçàííîãî êîíòåêñòà
    void (__cdecl *rsa_set_timeout)(int);				// óñòàíîâèòü òàéìàóò äëÿ óñòàíîâêè ñåêþðíîãî ñîåäèíåíèÿ
    int (__cdecl *rsa_get_state)(HANDLE);				// ïîëó÷èòü ñòàòóñ óêàçàííîãî êîíòåêñòà
    int (__cdecl *rsa_get_hash)(PBYTE,int,PBYTE,int*);			// âû÷èñëÿåò SHA1(key)
    int (__cdecl *rsa_connect)(HANDLE);					// çàïóñêàåò ïðîöåññ óñòàíîâêè ñîäèíåíèÿ ñ óêàçàííûì êîíòåêñòîì
    int (__cdecl *rsa_disconnect)(HANDLE);				// ðàçðûâàåò ñîåäèíåíèå ñ óêàçàííûì êîíòåêñòîì
    int (__cdecl *rsa_disabled)(HANDLE);				// ðàçðûâàåò ñîåäèíåíèå ïî ïðè÷èíå "disabled"
    LPSTR (__cdecl *rsa_recv)(HANDLE,LPCSTR);				// íåîáõîäèìî ïåðåäàâàòü ñþäà âñå âõîäÿùèå ïðîòîêîëüíûå ñîîáùåíèÿ
    int   (__cdecl *rsa_send)(HANDLE,LPCSTR);				// âûçûâàåì äëÿ îòïðàâêè ñîîáùåíèÿ êëèåíòó
    int (__cdecl *rsa_encrypt_file)(HANDLE,LPCSTR,LPCSTR);
    int (__cdecl *rsa_decrypt_file)(HANDLE,LPCSTR,LPCSTR);
    LPSTR  (__cdecl *utf8encode)(LPCWSTR);
    LPWSTR (__cdecl *utf8decode)(LPCSTR);
    int (__cdecl *is_7bit_string)(LPCSTR);
    int (__cdecl *is_utf8_string)(LPCSTR);
    int (__cdecl *rsa_export_keypair)(short,LPSTR,LPSTR,LPSTR);		// export private key
    int (__cdecl *rsa_import_keypair)(short,LPSTR,LPSTR);		// import & activate private key
    int (__cdecl *rsa_export_pubkey)(HANDLE,LPSTR);			// export public key from context
    int (__cdecl *rsa_import_pubkey)(HANDLE,LPSTR);			// import public key into context
} RSA_EXPORT;
typedef RSA_EXPORT* pRSA_EXPORT;

typedef struct {
    int  (__cdecl *rsa_inject)(HANDLE,LPCSTR);			// âñòàâëÿåò ñîîáùåíèå â î÷åðåäü íà îòïðàâêó
    int  (__cdecl *rsa_check_pub)(HANDLE,PBYTE,int,PBYTE,int);	// ïðîâåðÿåò èíòåðàêòèâíî SHA è ñîõðàíÿåò êëþ÷, åñëè âñå íîðìàëüíî
    void (__cdecl *rsa_notify)(HANDLE,int);			// íîòèôèêàöèÿ î ñìåíå ñîñòîÿíèÿ
} RSA_IMPORT;
typedef RSA_IMPORT* pRSA_IMPORT;


#endif