00001 //**************************************************************************** 00002 //* Author: Guillaume Plante, Philippe Lalande gsdevelopers@ubisoft.com 00003 //* Date: 2002-05-07 16:18:32 00011 //**************************************************************************** 00012 00024 #ifndef __GSCRYPTOINTERFACE_H__ 00025 #define __GSCRYPTOINTERFACE_H__ 00026 00027 #include "GSTypes.h" 00028 00029 #include "GSCryptoDefines.h" 00030 00031 extern "C" { 00032 00033 //============================================================================ 00034 // Function InitializeCrypto 00035 // Author: Guillaume Plante gplante@ubisoft.com 00036 // Date: 2002-05-07 15:49:51 00049 //============================================================================ 00050 GSbool __stdcall InitializeCrypto(); 00051 00052 //============================================================================ 00053 // Function UninitializeCrypto 00054 // Author: Guillaume Plante gplante@ubisoft.com 00055 // Date: 2002-05-07 15:49:52 00063 //============================================================================ 00064 GSvoid __stdcall UninitializeCrypto(); 00065 00075 //============================================================================ 00076 // Function GenerateRawHash 00077 // Author: Guillaume Plante gplante@ubisoft.com 00078 // Date: 2002-05-07 15:49:53 00102 //============================================================================ 00103 GSbool __stdcall GenerateRawHash(GSCRYPTO_HASH_ALGO eAlgo, 00104 const GSubyte* pucInBuffer, 00105 GSuint uiBufferSize, 00106 GSubyte* pucOutBuffer, 00107 GSuint uiIterations = 1); 00108 00109 00110 //============================================================================ 00111 // Function GenerateHexaHash 00112 // Author: Guillaume Plante gplante@ubisoft.com 00113 // Date: 2002-05-07 15:49:53 00140 //============================================================================ 00141 GSbool __stdcall GenerateHexaHash(GSCRYPTO_HASH_ALGO eAlgo, 00142 const GSubyte* pucInBuffer, 00143 GSuint uiBufferSize, 00144 GSchar* pszOutBuffer, 00145 GSuint uiIterations = 1); 00146 00147 00148 //============================================================================ 00149 // Function InitializeHash 00150 // Author: Guillaume Plante gplante@ubisoft.com 00151 // Date: 2002-05-07 16:27:15 00167 //============================================================================ 00168 GShandle __stdcall InitializeHash(GSCRYPTO_HASH_ALGO eAlgo); 00169 00170 00171 //============================================================================ 00172 // Function UpdateHash 00173 // Author: Guillaume Plante gplante@ubisoft.com 00174 // Date: 2002-05-07 16:37:38 00195 //============================================================================ 00196 GSbool __stdcall UpdateHash(GShandle hHash, const GSubyte* pucInBuffer, GSuint uiBufferSize,GSuint uiIterations = 1); 00197 00198 00199 //============================================================================ 00200 // Function TerminateRawHash 00201 // Author: Guillaume Plante gplante@ubisoft.com 00202 // Date: 2002-05-07 16:46:15 00221 //============================================================================ 00222 GSbool __stdcall TerminateRawHash(GShandle hHash, GSubyte* pucOutBuffer); 00223 00224 //============================================================================ 00225 // Function TerminateRawHash 00226 // Author: Guillaume Plante gplante@ubisoft.com 00227 // Date: 2002-05-07 16:46:15 00249 //============================================================================ 00250 GSbool __stdcall TerminateHexaHash(GShandle hHash, GSchar* pszOutBuffer); 00251 00252 00253 //============================================================================ 00254 // Function ResetHash 00255 // Author: Guillaume Plante gplante@ubisoft.com 00256 // Date: 2002-06-03 17:05:49 00270 //============================================================================ 00271 GSbool __stdcall ResetHash(GShandle hHash); 00272 00273 //============================================================================ 00274 // Function UninitializeHash 00275 // Author: Guillaume Plante gplante@ubisoft.com 00276 // Date: 2002-06-03 17:05:49 00287 //============================================================================ 00288 GSvoid __stdcall UninitializeHash(GShandle hHash); 00289 00299 //============================================================================ 00300 // Function StartNumberGenerator 00301 // Author: Guillaume Plante gplante@ubisoft.com 00302 // Date: 2002-06-03 16:35:30 00319 //============================================================================ 00320 GShandle __stdcall StartNumberGenerator(GSCRYPTO_PRNG_ALGO eAlgo, 00321 GSCRYPTO_HASH_ALGO eHash, 00322 const GSubyte *pucSeed, 00323 GSuint uiSeedSize); 00324 00325 //============================================================================ 00326 // Function StopNumberGenerator 00327 // Author: Guillaume Plante gplante@ubisoft.com 00328 // Date: 2002-06-03 17:03:37 00339 //============================================================================ 00340 GSvoid __stdcall StopNumberGenerator(GShandle hPRNG); 00341 00342 //============================================================================ 00343 // Function GenerateBit 00344 // Author: Guillaume Plante gplante@ubisoft.com 00345 // Date: 2002-06-03 16:35:36 00355 //============================================================================ 00356 GSubyte __stdcall GenerateBit(GShandle hPRNG); 00357 00358 //============================================================================ 00359 // Function GenerateBit 00360 // Author: Guillaume Plante gplante@ubisoft.com 00361 // Date: 2002-06-03 16:35:36 00371 //============================================================================ 00372 GSubyte __stdcall GenerateByte(GShandle hPRNG); 00373 00374 //============================================================================ 00375 // Function GenerateNumber 00376 // Author: Guillaume Plante gplante@ubisoft.com 00377 // Date: 2002-06-03 16:35:36 00389 //============================================================================ 00390 GSulong __stdcall GenerateNumber(GShandle hPRNG, GSulong ulMax = (GSulong)-1,GSulong ulMin = 0); 00391 00392 //============================================================================ 00393 // Function GenerateBlock 00394 // Author: Guillaume Plante gplante@ubisoft.com 00395 // Date: 2002-06-03 16:35:37 00408 //============================================================================ 00409 GSvoid __stdcall GenerateBlock(GShandle hPRNG, GSubyte *pucBlock,GSuint uiBlockSize); 00410 00421 //============================================================================ 00422 // Function InitializeCipher 00423 // Author: Guillaume Plante gplante@ubisoft.com 00424 // Date: 2002-06-06 09:25:38 00440 //============================================================================ 00441 GShandle __stdcall InitializeCipher(GSCRYPTO_CIPHER_ALGO eAlgo, 00442 const GSubyte* ucKey, GSuint uiKeyLength); 00443 00444 00445 //============================================================================ 00446 // Function UnitializeCipher 00447 // Author: Guillaume Plante gplante@ubisoft.com 00448 // Date: 2002-06-06 09:30:12 00459 //============================================================================ 00460 GSvoid __stdcall UninitializeCipher(GShandle hCipher); 00461 00462 00463 //============================================================================ 00464 // Function ResetKey 00465 // Author: Guillaume Plante gplante@ubisoft.com 00466 // Date: 2002-06-06 09:31:48 00482 //============================================================================ 00483 GSbool __stdcall ResetKey(GShandle hCipher,const GSubyte* ucKey, GSuint uiKeyLength); 00484 00485 00486 //============================================================================ 00487 // Function Encrypt 00488 // Author: Guillaume Plante gplante@ubisoft.com 00489 // Date: 2002-06-06 09:34:15 00509 //============================================================================ 00510 GSbool __stdcall Encrypt(GShandle hCipher,const GSvoid* pInputBuffer, GSuint uiInBufferLength, 00511 GSvoid* pOutputBuffer, GSuint* puiOutBufferLength); 00512 00513 00514 //============================================================================ 00515 // Function Decrypt 00516 // Author: Guillaume Plante gplante@ubisoft.com 00517 // Date: 2002-06-06 09:51:10 00537 //============================================================================ 00538 GSbool __stdcall Decrypt(GShandle hCipher,const GSvoid* pInputBuffer, GSuint uiInBufferLength, 00539 GSvoid* pOutputBuffer, GSuint* puiOutBufferLength); 00540 00541 00552 //============================================================================ 00553 // Function InitializePKC 00554 // Author: Guillaume Plante gplante@ubisoft.com 00555 // Date: 2002-05-07 16:27:15 00571 //============================================================================ 00572 GShandle __stdcall InitializePKC(GSCRYPTO_PKC_ALGO eAlgo); 00573 00574 //============================================================================ 00575 // Function UninitializeHash 00576 // Author: Guillaume Plante gplante@ubisoft.com 00577 // Date: 2002-06-03 17:05:49 00588 //============================================================================ 00589 GSvoid __stdcall UninitializePKC(GShandle hPKC); 00590 00591 00592 GSbool __stdcall RandomInit(GShandle hPKC,RANDOM_STRUCT *pRandomData); 00593 GSbool __stdcall RandomUpdate (GShandle hPKC,RANDOM_STRUCT *pRandomData, GSubyte *block, GSuint blockLen); 00594 GSvoid __stdcall RandomFinal(GShandle hPKC,RANDOM_STRUCT *pRandomData); 00595 GSint __stdcall GetRandomBytesNeeded(GShandle hPKC,GSuint *bytesNeeded,RANDOM_STRUCT * pRandomData); 00596 00597 GSbool __stdcall GenerateKeyPair(GShandle hPKC,RSA_PUBLIC_KEY *pPublicKey, RSA_PRIVATE_KEY *pPrivateKey, 00598 RSA_PROTO_KEY *pProtoKey,RANDOM_STRUCT *pRandomData); 00599 00600 GSbool __stdcall PublicEncrypt(GShandle hPKC,GSubyte *pInputBuffer, GSuint uiInputBufferLength, 00601 GSubyte *pOutputBuffer, GSuint *pOutputBufferLength,RSA_PUBLIC_KEY * pPublicKey, RANDOM_STRUCT * pRandomData); 00602 00603 GSbool __stdcall PrivateEncrypt(GShandle hPKC,GSubyte *pInputBuffer, GSuint uiInputBufferLength, 00604 GSubyte *pOutputBuffer, GSuint *pOutputBufferLength,RSA_PRIVATE_KEY *pPrivateKey); 00605 00606 GSbool __stdcall PublicDecrypt(GShandle hPKC,GSubyte *pInputBuffer, GSuint uiInputBufferLength, 00607 GSubyte *pOutputBuffer, GSuint *pOutputBufferLength,RSA_PUBLIC_KEY *pPublicKey); 00608 00609 GSbool __stdcall PrivateDecrypt(GShandle hPKC,GSubyte *pInputBuffer, GSuint uiInputBufferLength, 00610 GSubyte *pOutputBuffer, GSuint *pOutputBufferLength,RSA_PRIVATE_KEY *pPrivateKey); 00611 00614 } // extern "C" 00615 00616 #endif // __GSCRYPTOINTERFACE_H__ 00617 00618 00619 00620 00621 00622 00623 00624
Ubi.com GameService SDK - ©UbiSoft Entertainment 2002
GameService development team