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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
//==========================================================================
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE.
//
// Copyright (c) 1999 - 2001 On2 Technologies Inc. All Rights Reserved.
//
//--------------------------------------------------------------------------
#if !defined(ON2CRYPT_H)
#define ON2CRYPT_H
//______________________________________________________________________________
//
// On2Crypt.h
// API to on2comp's encryption dll
//--------------------------------------------------------------------------
#ifdef _USRDLL
#define DLLExport __declspec(dllexport)
#else
#define DLLExport
#endif
#define DLLCC __stdcall
#ifdef __cplusplus
extern "C"
{
#endif
typedef void* HOn2Encryptor;
DLLExport int DLLCC MakeEncryptor(unsigned char* pString, int iLength, HOn2Encryptor* phOn2Encryptor);
//***************************************************************************************
// Name : MakeEncryptor
// Description: set up an encryption session
// Inputs : pString -> information to be used by encryptor to set up encryption session
// iLength -> number of bytes used in pString
// Outputs : phOn2Encryptor -> pointer to an encryption session
// Returns : 0 = success
//***************************************************************************************
DLLExport int DLLCC GetEncryptionCode(char* pfccCode); // size of szCode must be >= 4
//***************************************************************************************
// Name : GetEncryptionCode
// Description: get the 4 character code to use as a reference for this encryption dll
// Inputs :
// Outputs : pfccCode 4 character code
// Returns : 0 = success
//***************************************************************************************
DLLExport int DLLCC GetDRMXLength(HOn2Encryptor hOn2Encryptor, int* piLength);
//***************************************************************************************
// Name : GetDRMXLength
// Description: calculates the length of decryption chunk to be produced
// Inputs : hOn2Encryptor -> handle of encryption sesion to use ( from make encryptor)
// Outputs : piLength -> filled with length of extra information
// Returns : 0 = success
//***************************************************************************************
DLLExport int DLLCC GenerateDRMX(HOn2Encryptor hOn2Encryptor, unsigned char* pBuffer);
//***************************************************************************************
// Name : GenerateDRMX
// Description: generates a decryption chunk
// Inputs : hOn2Encryptor -> handle of encryption sesion to use ( from make encryptor)
// Outputs : pBuffer is filled with information necessary to decrypt the file we are
// encrypting
// Returns : 0 = success
//***************************************************************************************
DLLExport int DLLCC EncryptedSize(HOn2Encryptor hOn2Encryptor, int iSizeIn, int* piSizeOut);
//***************************************************************************************
// Name : EncryptedSize
// Description: returns size that an encrypted chunk will be given a size in
// Inputs : hOn2Encryptor -> handle of encryption sesion to use ( from make encryptor)
// : iSizeIn -> size of input data
// Outputs : piSizeOut -> size of output data
// Returns : 0 = success
//***************************************************************************************
DLLExport int DLLCC EncryptBytes(HOn2Encryptor hOn2Encryptor, unsigned char* pBufferIn, int iSizeIn, unsigned char* pBufferOut, int iSizeOutMax, int* piSizeOut);
//***************************************************************************************
// Name : EncryptBytes
// Description: encrypts bytes in input buffer and stores them to the output buffer
// Inputs : hOn2Encryptor -> handle of encryption sesion to use ( from make encryptor)
// : pBufferIn -> buffer holding bytes to encrypt
// iSizeIn -> number of bytes to encrypt of that buffer
// Outputs : pBufferOut -> buffer for holding encrypted bytes
// iSizeOutMax -> maximum number of bytes to write to pBufferOut
// piSizeOut -> number of bytes actually written to pbufferout
// Returns : 0 = success
//***************************************************************************************
DLLExport int DLLCC EncryptorError(char* szError, int nErrorMax);
//***************************************************************************************
// Name : EncryptorError
// Description: gets a string description of the last error
// Inputs : szError -> pointer to string
// nErrorMax -> the largest number of bytes to fill in in szerror
// Outputs :
// Returns : 0 = success
//***************************************************************************************
DLLExport int DLLCC DeleteEncryptor(HOn2Encryptor hOn2Encryptor);
//***************************************************************************************
// Name : DeleteEncryptor
// Description: ends the encryption session and cleans up
// Inputs : hOn2Encryptor -> handle of encryption sesion to use ( from make encryptor)
// Outputs :
// Returns : 0 = success
//***************************************************************************************
typedef int (DLLCC *PFNMakeEncryptor)(unsigned char* pString, int iLength, HOn2Encryptor* phOn2Encryptor);
typedef int (DLLCC *PFNGetEncryptionCode)(char* pfccCode); // size of szCode must be >= 4
typedef int (DLLCC *PFNGetDRMXLength)(HOn2Encryptor hOn2Encryptor, int* piLength);
typedef int (DLLCC *PFNGenerateDRMX)(HOn2Encryptor hOn2Encryptor, unsigned char* pBuffer);
typedef int (DLLCC *PFNEncryptedSize)(HOn2Encryptor hOn2Encryptor, int iSizeIn, int* piSizeOut);
typedef int (DLLCC *PFNEncryptBytes)(HOn2Encryptor hOn2Encryptor, unsigned char* pBufferIn, int iSizeIn, unsigned char* pBufferOut, int iSizeOutMax, int* piSizeOut);
typedef int (DLLCC *PFNEncryptorError)(char* szError, int nErrorMax);
typedef int (DLLCC *PFNDeleteEncryptor)(HOn2Encryptor hOn2Encryptor);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // ON2CRYPT_H
|