Esempio n. 1
0
GHTTPRequest ghttpSaveExW
(
	const unsigned short * URL,
	const unsigned short * filename,
	const unsigned short * headers,
	GHTTPPost post,
	GHTTPBool throttle,
	GHTTPBool blocking,
	ghttpProgressCallback progressCallback,
	ghttpCompletedCallback completedCallback,
	void * param
)
{
	char URL_A[1024];
	//char filename_A[1024] = { '\0' };
	char headers_A[1024] = { '\0' };

	assert(URL_A != NULL);
	UCS2ToAsciiString(URL, URL_A);
	//if (filename != NULL)
	//	UCS2ToAsciiString(filename, filename_A);
	if (headers != NULL)
		UCS2ToAsciiString(headers, headers_A);

	return _ghttpSaveEx(URL_A, filename, headers_A, post, throttle, blocking, progressCallback, completedCallback, param);
}
Esempio n. 2
0
GHTTPBool ghttpPostAddFileFromMemoryW
(
	GHTTPPost post,
	const unsigned short * name,
	const char * buffer,
	int bufferLen,
	const unsigned short * reportFilename,
	const unsigned short * contentType
)
{
	char name_A[1024] = { '\0' };
	char reportFilename_A[1024] = { '\0' };
	char contentType_A[1024] = { '\0' };
	if (name != NULL)
		UCS2ToAsciiString(name, name_A);
	if (reportFilename != NULL)
		UCS2ToAsciiString(reportFilename, reportFilename_A);
	if (contentType != NULL)
		UCS2ToAsciiString(contentType, contentType_A);

	
	return ghttpPostAddFileFromMemoryA(post, name_A, buffer, bufferLen, reportFilename_A, contentType_A);
	
	GSI_UNUSED(reportFilename);
	GSI_UNUSED(contentType);
}
Esempio n. 3
0
ServerBrowser ServerBrowserNewW(const unsigned short *queryForGamename, const unsigned short *queryFromGamename, const unsigned short *queryFromKey, int queryFromVersion, int maxConcUpdates, int queryVersion, SBBool lanBrowse, ServerBrowserCallback callback, void *instance)
{
	char forGameName_A[255];
	char fromGameName_A[255];
	char fromGameKey_A[255];

	assert(queryForGamename != NULL);
	assert(queryFromGamename != NULL);
	assert(queryFromKey != NULL);

	UCS2ToAsciiString(queryForGamename, forGameName_A);
	UCS2ToAsciiString(queryFromGamename, fromGameName_A);
	UCS2ToAsciiString(queryFromKey, fromGameKey_A);
	return ServerBrowserNewA(forGameName_A, fromGameName_A, fromGameKey_A, queryFromVersion, maxConcUpdates, queryVersion, lanBrowse, callback, instance);
}
Esempio n. 4
0
GHTTPBool ghttpPostAddStringW
(
	GHTTPPost post,
	const unsigned short * name,
	const unsigned short * string
)
{
	char name_A[1024] = {'\0'};
	char string_A[1024] = {'\0'};
	if (name != NULL)
		UCS2ToAsciiString(name, name_A);
	if (string != NULL)
		UCS2ToAsciiString(string, string_A);
	return ghttpPostAddStringA(post, name_A, string_A);
}
Esempio n. 5
0
GHTTPRequest ghttpSaveW
(
	const unsigned short * URL,
	const unsigned short * filename,
	GHTTPBool blocking,
	ghttpCompletedCallback completedCallback,
	void * param
)
{
	char URL_A[1024] = { '\0' };
	char filename_A[1024] = { '\0' };

	assert(URL != NULL);
	UCS2ToAsciiString(URL, URL_A);
	UCS2ToAsciiString(filename, filename_A);
	return ghttpSaveA(URL_A, filename_A, blocking, completedCallback, param);
}
Esempio n. 6
0
gsi_bool wsLoginCertWriteBinary(const GSLoginCertificate * cert, char * bufout, unsigned int maxlen, unsigned int * lenout)
{
	gsi_i32 intNB; // network byte order int
	gsi_i32 lenoutSoFar = 0; // tracks bytes written to bufout
	gsi_i32 lenTemp = 0; // for temp length of large ints


	WRITE_NETWORK_INT(cert->mLength);
	WRITE_NETWORK_INT(cert->mVersion);
	WRITE_NETWORK_INT(cert->mPartnerCode);
	WRITE_NETWORK_INT(cert->mNamespaceId);
	WRITE_NETWORK_INT(cert->mUserId);
	WRITE_NETWORK_INT(cert->mProfileId);
	WRITE_NETWORK_INT(cert->mExpireTime);

#ifndef GSI_UNICODE
	WRITE_NTS(cert->mProfileNick);
	WRITE_NTS(cert->mUniqueNick);
	WRITE_NTS(cert->mCdKeyHash);
#else
	if((lenoutSoFar + _tcslen(cert->mProfileNick) + _tcslen(cert->mUniqueNick) + _tcslen(cert->mCdKeyHash)) > maxlen)
		return gsi_false;
	// strip unicode to Ascii before writing this to the buffer
	lenoutSoFar += UCS2ToAsciiString(cert->mProfileNick, bufout+lenoutSoFar)+1;
	lenoutSoFar += UCS2ToAsciiString(cert->mUniqueNick, bufout+lenoutSoFar)+1;
	lenoutSoFar += UCS2ToAsciiString(cert->mCdKeyHash, bufout+lenoutSoFar)+1;
#endif

	lenTemp = (gsi_i32)gsLargeIntGetByteLength(&cert->mPeerPublicKey.modulus); // size in bytes, no leading zeroes
	WRITE_NETWORK_INT(lenTemp); 
	WRITE_REV_BINARY(cert->mPeerPublicKey.modulus.mData, (unsigned int)lenTemp);

	lenTemp = (gsi_i32)gsLargeIntGetByteLength(&cert->mPeerPublicKey.exponent); // size in bytes, no leading zeroes
	WRITE_NETWORK_INT(lenTemp);
	WRITE_REV_BINARY(cert->mPeerPublicKey.exponent.mData, (unsigned int)lenTemp);

	WRITE_NETWORK_INT(WS_LOGIN_SERVERDATA_LEN); 
	WRITE_BINARY(cert->mServerData, (unsigned int)WS_LOGIN_SERVERDATA_LEN); 

	WRITE_NETWORK_INT(GS_CRYPT_RSA_BYTE_SIZE); 
	WRITE_BINARY(cert->mSignature, (unsigned int)WS_LOGIN_SERVERDATA_LEN); 

	*lenout = (gsi_u32)lenoutSoFar;
	return gsi_true;
}
Esempio n. 7
0
GHTTPRequest ghttpPostExW
(
	const unsigned short * URL,
	const unsigned short * headers,
	GHTTPPost post,
	GHTTPBool throttle,
	GHTTPBool blocking,
	ghttpProgressCallback progressCallback,
	ghttpCompletedCallback completedCallback,
	void * param
)
{
	char URL_A[1024] = {'\0'};
	char headers_A[1024] = {'\0'};
	UCS2ToAsciiString(URL, URL_A);
	if (headers != NULL)
		UCS2ToAsciiString(headers, headers_A);
	return ghttpPostExA(URL_A, headers_A, post, throttle, blocking, progressCallback, completedCallback, param);
}
Esempio n. 8
0
GHTTPBool ghttpPostAddFileFromDiskW
(
	GHTTPPost post,
	const unsigned short * name,
	const unsigned short * filename,
	const unsigned short * reportFilename,
	const unsigned short * contentType
)
{
	char name_A[1024] = {'\0'};
	char filename_A[1024] = {'\0'};
	char reportFilename_A[1024] = {'\0'};
	char contentType_A[1024] = {'\0'};
	if (name != NULL)			UCS2ToAsciiString(name, name_A);
	if (filename != NULL)		UCS2ToAsciiString(filename, filename_A);
	if (reportFilename != NULL)	UCS2ToAsciiString(reportFilename, reportFilename_A);
	if (contentType != NULL)	UCS2ToAsciiString(contentType, contentType_A);
	return ghttpPostAddFileFromDiskA(post, name_A, filename_A, reportFilename_A, contentType_A);
}
Esempio n. 9
0
SBServer ServerBrowserGetServerByIPW(ServerBrowser sb, const unsigned short* ip, unsigned short port)
{
	char ip_A[20];

	if(ip == NULL || wcslen(ip) > 16)
		return NULL;

	UCS2ToAsciiString(ip, ip_A);
	return ServerBrowserGetServerByIPA(sb, ip_A, port);
}
Esempio n. 10
0
GHTTPRequest ghttpHeadW
(
	const unsigned short * URL,
	GHTTPBool blocking,
	ghttpCompletedCallback completedCallback,
	void * param
)
{
	char URL_A[1024] = {'\0'};
	UCS2ToAsciiString(URL, URL_A);
	return ghttpHeadA(URL_A, blocking, completedCallback, param);
}
Esempio n. 11
0
GHTTPRequest ghttpStreamW
(
	const unsigned short * URL,
	GHTTPBool blocking,
	ghttpProgressCallback progressCallback,
	ghttpCompletedCallback completedCallback,
	void * param
)
{
	char* URL_A = { '\0' };
	UCS2ToAsciiString(URL, URL_A);
	return ghttpStreamA(URL_A, blocking, progressCallback, completedCallback, param);
}
Esempio n. 12
0
	static void AppDebug(const unsigned short* format, ...)
	{
        // Construct text, then pass in as ASCII
        unsigned short buf[1024];
        char tmp[2056];
        va_list aList;
        va_start(aList, format);
        vswprintf(buf, 1024, format, aList);

        UCS2ToAsciiString(buf, tmp);
        gsDebugFormat(GSIDebugCat_App, GSIDebugType_Misc, GSIDebugLevel_Notice,
            "%s", tmp);
	}
Esempio n. 13
0
GHTTPRequest ghttpGetW
(
	const unsigned short * URL,
	GHTTPBool blocking,
	ghttpCompletedCallback completedCallback,
	void * param
)
{
	char URL_A[1024];

	assert(URL != NULL);
	UCS2ToAsciiString(URL, (char*)URL_A);
	return ghttpGetA(URL_A, blocking, completedCallback, param);
}
Esempio n. 14
0
GHTTPRequest ghttpGetExW
(
	const unsigned short * URL,
	const unsigned short * headers,
	char * buffer,
	int bufferSize,
	GHTTPPost post,
	GHTTPBool throttle,
	GHTTPBool blocking,
	ghttpProgressCallback progressCallback,
	ghttpCompletedCallback completedCallback,
	void * param
)
{
	char URL_A[1024];
	char headers_A[1024] = { '\0' };

	assert(URL != NULL);
	UCS2ToAsciiString(URL, (char*)URL_A);
	if (headers != NULL)
		UCS2ToAsciiString(headers, headers_A);
	return ghttpGetExA((char*)URL_A, (char*)headers_A, buffer, bufferSize, post, throttle, blocking, progressCallback, completedCallback, param);
}
Esempio n. 15
0
static void wsiLoginEncryptPassword(const gsi_char * password, gsi_u8 ciphertext[GS_CRYPT_RSA_BYTE_SIZE])
{
	gsCryptRSAKey sigkeypub;


#ifdef GSI_UNICODE
	char password_A[WS_LOGIN_PASSWORD_LEN];
		// strip password into ascii to encrypt
	UCS2ToAsciiString(password, password_A);
#endif

	gsLargeIntSetFromHexString(&sigkeypub.modulus, WS_AUTHSERVICE_SIGNATURE_KEY);
	gsLargeIntSetFromHexString(&sigkeypub.exponent, WS_AUTHSERVICE_SIGNATURE_EXP);

#ifdef GSI_UNICODE
	gsCryptRSAEncryptBuffer(&sigkeypub, (const gsi_u8*)password_A, _tcslen(password), ciphertext);
#else
	gsCryptRSAEncryptBuffer(&sigkeypub, (const gsi_u8*)password, strlen(password), ciphertext);
#endif
}
Esempio n. 16
0
static void myLoginCallback(GHTTPResult httpResult, WSLoginResponse * theResponse, void * theUserData)
{
	if (httpResult != GHTTPSuccess)
	{
		gsDebugFormat(GSIDebugCat_App, GSIDebugType_Misc, GSIDebugLevel_HotError, 
			"Failed on player login, HTTP error: %d\r\n", httpResult);
		getc(stdin);
		exit(0);
	}
	else if (theResponse->mLoginResult != WSLogin_Success)
	{
		
		gsDebugFormat(GSIDebugCat_App, GSIDebugType_Misc, GSIDebugLevel_HotError, 
			"Failed on player login, Login result: %d\r\n", theResponse->mLoginResult);
		getc(stdin);
		exit(0);
	}
	else
	{
		SamplePlayerData * newPlayer = NULL;
		int playerIndex = (int)theUserData;
		char playerNick[WS_LOGIN_NICK_LEN];

		newPlayer = &gPlayerData[playerIndex];

		// copy certificate and private key
		newPlayer->mProfileId = theResponse->mCertificate.mProfileId;
		memcpy(&newPlayer->mCertificate, &theResponse->mCertificate, sizeof(GSLoginCertificate));
		memcpy(&newPlayer->mPrivateData, &theResponse->mPrivateData, sizeof(GSLoginPrivateData));

#ifdef GSI_UNICODE		
		UCS2ToAsciiString(theResponse->mCertificate.mUniqueNick, playerNick);
		printf("Player '%s' logged in.\r\n", playerNick);
#else
		printf("Player '%s' logged in.\r\n", theResponse->mCertificate.mUniqueNick);
		GSI_UNUSED(playerNick);
#endif
	}
	gServerData.mWaitCount--;
}
Esempio n. 17
0
SCResult SC_CALL sciReportAddStringValue(SCIReport *      theReport,
										 gsi_u16          theKeyId,
										 const gsi_char * theValue)
{
	SCIReportHeader * aHeader = (SCIReportHeader*)theReport->mBuffer.mData;
	int writtenLen = 0, numLenBytes = 0, asciiLen = 0;
	gsi_i16 theKeyType = SCIKeyType_STRING;	

	// for unicode we need to store the ascii-converted string first in the buffer so as
	// not to dynamically allocate space for it. Then once we have the length of it, we can
	// write over the buffer

#if defined(GSI_UNICODE)
	// First check room in buffer
	GS_ASSERT(((theReport->mBuffer.mPos + (_tcslen(theValue)) + (sizeof(gsi_u16)*2))
		< theReport->mBuffer.mCapacity));

	// as long as we have enough room - add to the buffer and store length of the Ascii string
	// need to remove 1 for the appended null char \0 which we want to remove
	asciiLen = UCS2ToAsciiString(theValue, &theReport->mBuffer.mData[theReport->mBuffer.mPos])-1;

	// now determine how many bytes are necessary to represent len
	numLenBytes = (asciiLen/127)+1; 

#else

	numLenBytes = (gsi_i32)(strlen(theValue)/127)+1; //finds out number of bytes necessary to represent len
	asciiLen = (int)strlen(theValue);
#endif


	// calculate length of data to be written
	writtenLen += sizeof(gsi_u16) + sizeof(gsi_u16);	// 2 byte key ID, 2 byte key type;
	writtenLen += asciiLen;								// 0 for empty string
	writtenLen += numLenBytes;							// the number of bytes necessary to represent len

	// Check room in buffer
	GS_ASSERT((theReport->mBuffer.mPos + writtenLen) < theReport->mBuffer.mCapacity);

	// Update count and length markers
	if (theReport->mReportState == SCIReportState_GLOBALDATA)
	{
		aHeader->mGameKeyCount++;
		aHeader->mGameSectionLength += writtenLen;
	}
	else if (theReport->mReportState == SCIReportState_PLAYERDATA)
	{
		aHeader->mPlayerKeyCount++;
		aHeader->mPlayerSectionLength += writtenLen;

		theReport->mCurEntityKeyCount++;
		sciSerializeInt16((gsi_u8 *)&theReport->mBuffer.mData[theReport->mCurEntityStartPos], (gsi_i16)theReport->mCurEntityKeyCount);
	}
	else if (theReport->mReportState == SCIReportState_TEAMDATA)
	{
		aHeader->mTeamKeyCount++;
		aHeader->mTeamSectionLength += writtenLen;

		theReport->mCurEntityKeyCount++;
		sciSerializeInt16((gsi_u8 *)&theReport->mBuffer.mData[theReport->mCurEntityStartPos], (gsi_i16)theReport->mCurEntityKeyCount);
	}
	// Needs real error handling code or an assertion on a non-constant expression
	//else 
	//	GS_ASSERT(0); // invalid state for writing key/value pairs!

	// Write the data
	sciSerializeInt16((gsi_u8 *)&theReport->mBuffer.mData[theReport->mBuffer.mPos], (gsi_i16)theKeyId);
	theReport->mBuffer.mPos += sizeof(gsi_u16);
	sciSerializeInt16((gsi_u8 *)&theReport->mBuffer.mData[theReport->mBuffer.mPos], theKeyType);
	theReport->mBuffer.mPos += sizeof(gsi_u16);

	// now prior to writing the string we need to prepend the length of the string to follow
	// the .NET format of (string length)(String)
	memset(&theReport->mBuffer.mData[theReport->mBuffer.mPos], asciiLen, (gsi_u32)numLenBytes);
	theReport->mBuffer.mPos += numLenBytes;

#if defined(GSI_UNICODE)
	// Now strip to Ascii and write the length - subtract 1 to get rid of appended null character
	theReport->mBuffer.mPos += UCS2ToAsciiString(theValue, &theReport->mBuffer.mData[theReport->mBuffer.mPos])-1;
#else
	strncpy(&theReport->mBuffer.mData[theReport->mBuffer.mPos], theValue, strlen(theValue));
	theReport->mBuffer.mPos += strlen(theValue);
#endif

	return SCResult_NO_ERROR;
}
Esempio n. 18
0
void ServerBrowserRemoveIPW(ServerBrowser sb, const unsigned short *ip, unsigned short port)
{
	char ip_A[128];
	UCS2ToAsciiString(ip, ip_A);
	ServerBrowserRemoveIPA(sb, ip_A, port);
}
Esempio n. 19
0
SBError ServerBrowserAuxUpdateIPW(ServerBrowser sb, const unsigned short *ip, unsigned short port, SBBool viaMaster, SBBool async, SBBool fullUpdate)
{
	char ip_A[128];
	UCS2ToAsciiString(ip, ip_A);
	return ServerBrowserAuxUpdateIPA(sb, ip_A, port, viaMaster, async, fullUpdate);
}
Esempio n. 20
0
SBError ServerBrowserSendNatNegotiateCookieToServerW(ServerBrowser sb, const unsigned short *ip, unsigned short port, int cookie)
{
	char ip_A[128];
	UCS2ToAsciiString(ip, ip_A);
	return ServerBrowserSendNatNegotiateCookieToServerA(sb, ip_A, port, cookie);
}
Esempio n. 21
0
SBError ServerBrowserSendMessageToServerW(ServerBrowser sb, const unsigned short *ip, unsigned short port, const char *data, int len)
{
	char ip_A[128];
	UCS2ToAsciiString(ip, ip_A);
	return ServerBrowserSendMessageToServerA(sb, ip_A, port, data, len);
}
Esempio n. 22
0
void gpiAddToNpBlockListInfoCallback(
  GPConnection * pconnection, 
  GPGetInfoResponseArg * arg, 
  void * param
)
{
    SceNpOnlineId onlineId;
    int ret;
    npIdLookupTrans transaction;
    GPIConnection * iconnection = (GPIConnection*)*pconnection;
#ifdef GSI_UNICODE
    char asciiUniquenick[GP_UNIQUENICK_LEN];
#endif

    if(arg->result == GP_NO_ERROR)
    {
        // Make sure its a PS3 uniquenick (e.g. we have the uniquenick)
        ///////////////////////////////////////////////////////////////
        if (_tcslen(arg->uniquenick) != 0)
        {
            memset(&onlineId, 0, sizeof(onlineId));

#ifdef GSI_UNICODE
            UCS2ToAsciiString(arg->uniquenick, (char*)asciiUniquenick);
            strncpy(onlineId.data, asciiUniquenick, SCE_NET_NP_ONLINEID_MAX_LENGTH);
#else
            strncpy(onlineId.data, arg->uniquenick, SCE_NET_NP_ONLINEID_MAX_LENGTH);
#endif

            if (ArrayLength(iconnection->npTransactionList) < GPI_NP_NUM_TRANSACTIONS)
            {
                ret = sceNpLookupCreateTransactionCtx(iconnection->npLookupTitleCtxId);
                if (ret < 0)
                {
                    gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError,
                        "PS3AddToNpBlockList: sceNpLookupCreateTransactionCtx() failed. ret = 0x%x\n", ret);  
                }
                else
                {
                    transaction.npIdForAdd = (SceNpId*)gsimalloc(sizeof(SceNpId));
                    if(transaction.npIdForAdd == NULL)
                    {
                        sceNpLookupDestroyTransactionCtx(ret);
                        gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError,
                            "PS3AddToNpBlockList: Out of memory.\n");  
                        return;
                    }
                    transaction.npTransId = ret;
                    transaction.npLookupDone = gsi_false;
                    ArrayAppend(iconnection->npTransactionList, &transaction);

                    // Perform NP lookup to get the NpId
                    /////////////////////////////////////
                    ret = sceNpLookupNpIdAsync(transaction.npTransId, &onlineId, 
                        transaction.npIdForAdd, 0, NULL);
                    if (ret < 0) 
                    {
                        gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError,
                            "PS3AddToNpBlockList: sceNpLookupNpIdAsync() failed. ret = 0x%x\n", ret);  
                    } 
                }
            }
            else
            {
                // Can only have a max of 32 simultaneous transactions (based on PS3 lib)
                /////////////////////////////////////////////////////////////////////////
                gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_WarmError,
                    "PS3AddToNpBlockList: Transactions limit reached for np lookups\n");  
            }
        }
        else
            gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError,
                "PS3AddToNpBlockList: Profile [%d] does not have a uniquenick in namespace %d!\n",
                arg->profile, iconnection->namespaceID);
    }
    else
        gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError,
            "PS3AddToNpBlockList: Player Info lookup FAILED!\n");

    GSI_UNUSED(pconnection);
    GSI_UNUSED(param);
}
Esempio n. 23
0
gsi_bool wsLoginCertIsValid(const GSLoginCertificate * cert)
{
	// Verify the signature
	gsCryptRSAKey sigkeypub;
	MD5_CTX md5;
	gsi_u8 hash[16];
	gsi_i32 cryptResult = 0;
	gsi_u32 temp;

	// hash certificate data
	MD5Init(&md5);
	temp = wsiMakeLittleEndian32(cert->mLength);
	MD5Update(&md5, (unsigned char*)&temp, 4);
	temp = wsiMakeLittleEndian32(cert->mVersion);
	MD5Update(&md5, (unsigned char*)&temp, 4);
	temp = wsiMakeLittleEndian32(cert->mPartnerCode);
	MD5Update(&md5, (unsigned char*)&temp, 4);
	temp = wsiMakeLittleEndian32(cert->mNamespaceId);
	MD5Update(&md5, (unsigned char*)&temp, 4);
	temp = wsiMakeLittleEndian32(cert->mUserId);
	MD5Update(&md5, (unsigned char*)&temp, 4);
	temp = wsiMakeLittleEndian32(cert->mProfileId);
	MD5Update(&md5, (unsigned char*)&temp, 4);
	temp = wsiMakeLittleEndian32(cert->mExpireTime);
	MD5Update(&md5, (unsigned char*)&temp, 4);

#if defined(GSI_UNICODE)
	{
		char profile_A[WS_LOGIN_NICK_LEN];
		char uniquenick_A[WS_LOGIN_UNIQUENICK_LEN];
		char keyhash_A[WS_LOGIN_KEYHASH_LEN];

		UCS2ToAsciiString(cert->mProfileNick, profile_A);
		UCS2ToAsciiString(cert->mUniqueNick, uniquenick_A);
		UCS2ToAsciiString(cert->mCdKeyHash, keyhash_A);

		MD5Update(&md5, (unsigned char*)profile_A, strlen(profile_A));        //FIX for unicode
		MD5Update(&md5, (unsigned char*)uniquenick_A, strlen(uniquenick_A));  //FIX for unicode
		MD5Update(&md5, (unsigned char*)keyhash_A, strlen(keyhash_A));        //FIX for unicode
	}
#else
	MD5Update(&md5, (unsigned char*)&cert->mProfileNick, strlen(cert->mProfileNick)); 
	MD5Update(&md5, (unsigned char*)&cert->mUniqueNick, strlen(cert->mUniqueNick));   
	MD5Update(&md5, (unsigned char*)&cert->mCdKeyHash, strlen(cert->mCdKeyHash));     
#endif

	// must be hashed in big endian byte order
	//    skip leading zeroes
	gsLargeIntAddToMD5(&cert->mPeerPublicKey.modulus, &md5);
	gsLargeIntAddToMD5(&cert->mPeerPublicKey.exponent, &md5);

	MD5Update(&md5, (unsigned char*)&cert->mServerData, WS_LOGIN_SERVERDATA_LEN);
	MD5Final(hash, &md5);
				
	gsLargeIntSetFromHexString(&sigkeypub.modulus, WS_AUTHSERVICE_SIGNATURE_KEY);
	gsLargeIntSetFromHexString(&sigkeypub.exponent, WS_AUTHSERVICE_SIGNATURE_EXP);
	cryptResult = gsCryptRSAVerifySignedHash(&sigkeypub, hash, 16, cert->mSignature, WS_LOGIN_SIGNATURE_LEN);
	if (cryptResult == 0)
		return gsi_true;
	else
		return gsi_false;
}