コード例 #1
0
 internal async Task <EncryptedAppTicketResponse_t?> RequestEncryptedAppTicket(IntPtr pDataToInclude, int cbDataToInclude)
 {
     return(await EncryptedAppTicketResponse_t.GetResultAsync(_RequestEncryptedAppTicket( Self, pDataToInclude, cbDataToInclude )));
 }
コード例 #2
0
	void OnEncryptedAppTicketResponse(EncryptedAppTicketResponse_t pCallback, bool bIOFailure) {
		Debug.Log("[" + EncryptedAppTicketResponse_t.k_iCallback + " - EncryptedAppTicketResponse] - " + pCallback.m_eResult);

		// This code is taken directly from SteamworksExample/SpaceWar
		if (pCallback.m_eResult == EResult.k_EResultOK) {
			byte[] rgubTicket = new byte[1024];
			uint cubTicket;
			SteamUser.GetEncryptedAppTicket(rgubTicket, 1024, out cubTicket);

			// normally at this point you transmit the encrypted ticket to the service that knows the decryption key
			// this code is just to demonstrate the ticket cracking library

			// included is the "secret" key for spacewar. normally this is secret
			byte[] rgubKey = new byte[32] { 0xed, 0x93, 0x86, 0x07, 0x36, 0x47, 0xce, 0xa5, 0x8b, 0x77, 0x21, 0x49, 0x0d, 0x59, 0xed, 0x44, 0x57, 0x23, 0xf0, 0xf6, 0x6e, 0x74, 0x14, 0xe1, 0x53, 0x3b, 0xa3, 0x3c, 0xd8, 0x03, 0xbd, 0xbd };		

			byte[] rgubDecrypted = new byte[1024];
			uint cubDecrypted = 1024;
			if (!SteamEncryptedAppTicket.BDecryptTicket(rgubTicket, cubTicket, rgubDecrypted, out cubDecrypted, rgubKey, rgubKey.Length)) {
				Debug.Log("Ticket failed to decrypt");
				return;
			}

			if (!SteamEncryptedAppTicket.BIsTicketForApp(rgubDecrypted, cubDecrypted, SteamUtils.GetAppID())) {
				Debug.Log("Ticket for wrong app id");
			}

			CSteamID steamIDFromTicket;
			SteamEncryptedAppTicket.GetTicketSteamID(rgubDecrypted, cubDecrypted, out steamIDFromTicket);
			if (steamIDFromTicket != SteamUser.GetSteamID()) {
				Debug.Log("Ticket for wrong user");
			}

			uint cubData;
			byte[] punSecretData = SteamEncryptedAppTicket.GetUserVariableData(rgubDecrypted, cubDecrypted, out cubData);
			if(cubData != sizeof(uint)) {
				Debug.Log("Secret data size is wrong.");
			}
			Debug.Log(punSecretData.Length);
			Debug.Log(System.BitConverter.ToUInt32(punSecretData, 0));
			if (System.BitConverter.ToUInt32(punSecretData, 0) != 0x5444) {
				Debug.Log("Failed to retrieve secret data");
				return;
			}

			Debug.Log("Successfully retrieved Encrypted App Ticket");
		}
	}
コード例 #3
0
        internal async Task <EncryptedAppTicketResponse_t?> RequestEncryptedAppTicket(IntPtr pDataToInclude, int cbDataToInclude)
        {
            EncryptedAppTicketResponse_t?resultAsync = await EncryptedAppTicketResponse_t.GetResultAsync(this._RequestEncryptedAppTicket(this.Self, pDataToInclude, cbDataToInclude));

            return(resultAsync);
        }