Utilidades para descodificar/descifrar tickets de aplicación cifrados.
Visita
Tickets de aplicación cifrados para obtener más información.
Para usar estas funciones, debes incluir el encabezado
steamencryptedappticket.h
y el enlace al binario sdkencryptedappticket. Así, se puede usar en una aplicación sin conexión que se ejecute en un servidor de confianza para autenticar los tickets recibidos de los clientes.
Nota: Un ticket de aplicación encriptado solo puede tener hasta 140 ids. de aplicación de DLC. Si planeas que tu juego tenga más de esa cantidad, debes usar tickets de sesión/WebAPI para verificar la propiedad.
Funciones
Estas son funciones globales que no requieren de interfaz para su uso.
SteamEncryptedAppTicket_BDecryptTicket
S_API bool SteamEncryptedAppTicket_BDecryptTicket( const uint8 *rgubTicketEncrypted, uint32 cubTicketEncrypted,
uint8 *rgubTicketDecrypted, uint32 *pcubTicketDecrypted,
const uint8 rgubKey[k_nSteamEncryptedAppTicketSymmetricKeyLen], int cubKey );
Nombre | Tipo | Descripción |
rgubTicketEncrypted | const uint8 * | El ticket de autenticación de usuario encriptado que será descifrado. |
cubTicketEncrypted | uint32 | El tamaño de rgubTicketEncrypted en bytes. |
rgubTicketDecrypted | uint8 * | El búfer donde se copiará el ticket descifrado. |
pcubTicketDecrypted | uint32 * | El tamaño de rgubTicketDecrypted en bytes. |
rgubKey | const uint8[[apitype]SteamEncryptedAppTicket::k_nSteamEncryptedAppTicketSymmetricKeyLen[/apitype]] | Clave usada para cifrar/descifrar el ticket. Esto no puede ser más largo que k_nSteamEncryptedAppTicketSymmetricKeyLen. |
cubKey | int | La longitud de rgubKey . |
Descifra un ticket de aplicación cifrado.
La clave de cifrado se puede obtener en la página
Clave de ticket de aplicación encriptada en la aplicación Admin.
Si la llamada se ha completado, se pueden usar las otras funciones de SteamEncryptedAppTicket para obtener más información sobre el ticket descifrado.
Devuelve: bool
true si el ticket se ha descifrado.
False en las siguientes condiciones:
-
cubKey
fue 0.
- El tamaño del búfer de salida
rgubTicketDecrypted
es demasiado pequeño. Debe ser al menos tan grande como rgubTicketEncrypted
.
- La lectura
rgubTicketEncrypted
falló, esto podría suceder si es NULL o está vacío.
- La encriptación ha fallado, probablemente porque la clave no es correcta.
Véase también: ISteamUser::RequestEncryptedAppTicketEjemplo:void DecryptTicket( uint8* rgubTicket, uint32 cubTicket )
{
// Se incluye la clave secreta del ticket de la aplicación cifrada para la barra espaciadora. Nunca debes enviar esto a los clientes.
const uint8 rgubKey[k_nSteamEncryptedAppTicketSymmetricKeyLen] = { 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 };
uint8 rgubDecrypted[1024];
uint32 cubDecrypted = sizeof( rgubDecrypted );
if ( !SteamEncryptedAppTicket_BDecryptTicket( rgubTicket, cubTicket, rgubDecrypted, &cubDecrypted, rgubKey, sizeof( rgubKey ) ) )
{
printf( "Ticket failed to decrypt\n" );
return;
}
if ( !SteamEncryptedAppTicket_BIsTicketForApp( rgubDecrypted, cubDecrypted, SteamUtils()->GetAppID() ) )
printf( "Ticket for wrong app id\n" );
CSteamID steamIDFromTicket;
SteamEncryptedAppTicket_GetTicketSteamID( rgubDecrypted, cubDecrypted, &steamIDFromTicket );
if ( steamIDFromTicket != SteamUser()->GetSteamID() )
printf( "Ticket for wrong user\n" );
uint32 cubData;
uint32 *punSecretData = (uint32 *)SteamEncryptedAppTicket_GetUserVariableData( rgubDecrypted, cubDecrypted, &cubData );
if ( cubData != sizeof( uint32 ) || *punSecretData != k_unSecretData )
printf( "Failed to retrieve secret data\n" );
}
SteamEncryptedAppTicket_BIsTicketForApp
S_API bool SteamEncryptedAppTicket_BIsTicketForApp( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted, AppId_t nAppID );
Nombre | Tipo | Descripción |
rgubTicketDecrypted | uint8 * | El ticket descifrado para comprobar. |
pcubTicketDecrypted | uint32 * | El tamaño de rgubTicketDecrypted en bytes. |
nAppID | AppId_t | Id. de aplicación que se usará como término de comparación. |
Verifica que un ticket de aplicación descifrado es para la aplicación que se espera.
Devuelve: bool
true si el ticket es para el id. de aplicación indicado;
false si no o si el ticket no es válido.
SteamEncryptedAppTicket_BUserIsVacBanned
S_API bool SteamEncryptedAppTicket_BUserIsVacBanned( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted );
Nombre | Tipo | Descripción |
rgubTicketDecrypted | uint8 * | El ticket descifrado para comprobar. |
pcubTicketDecrypted | uint32 * | El tamaño de rgubTicketDecrypted en bytes. |
Comprueba si el usuario asociado con el ticket está bloqueado por
VAC.
Devuelve: AppId_ttrue si el usuario está bloqueado por VAC; de lo contrario,
false si el ticket no es válido o si no contiene esta información.
SteamEncryptedAppTicket_BUserOwnsAppInTicket
S_API bool SteamEncryptedAppTicket_BUserOwnsAppInTicket( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted, AppId_t nAppID );
Nombre | Tipo | Descripción |
rgubTicketDecrypted | uint8 * | El ticket descifrado para comprobar. |
pcubTicketDecrypted | uint32 * | El tamaño de rgubTicketDecrypted en bytes. |
nAppID | AppId_t | El id. de la aplicación para comprobar si el usuario lo posee. |
Verifica que el ticket demuestre que el usuario posee el id. de aplicación dado.
Se puede usar para el id. del DLC y aplicaciones asociadas que estén en el ticket, no solo para el id. de aplicación principal.
Devuelve: bool
true si el ticket es para el id. de aplicación indicado; de lo contrario,
false, o si el ticket no es válido.
SteamEncryptedAppTicket_GetTicketAppID
S_API AppId_t SteamEncryptedAppTicket_GetTicketAppID( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted );
Nombre | Tipo | Descripción |
rgubTicketDecrypted | uint8 * | El ticket descifrado para comprobar. |
pcubTicketDecrypted | uint32 * | El tamaño de rgubTicketDecrypted en bytes. |
Obtiene el id. de aplicación asociado a un ticket.
Devuelve: AppId_tDevuelve el id. de la aplicación vinculado al ticket. Devuelve 0 si el ticket no es válido.
SteamEncryptedAppTicket_GetTicketIssueTime
S_API RTime32 SteamEncryptedAppTicket_GetTicketIssueTime( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted );
Nombre | Tipo | Descripción |
rgubTicketDecrypted | uint8 * | El ticket descifrado para comprobar. |
pcubTicketDecrypted | uint32 * | El tamaño de rgubTicketDecrypted en bytes. |
Obtiene la hora en la que se emitió un ticket.
Devuelve: RTime32Devuelve la hora en el formato de tiempo de Unix (tiempo transcurrido desde el 1 de enero de 1970). Devuelve 0 si el ticket no es válido.
SteamEncryptedAppTicket_GetTicketSteamID
S_API void SteamEncryptedAppTicket_GetTicketSteamID( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted, CSteamID *psteamID );
Nombre | Tipo | Descripción |
rgubTicketDecrypted | uint8 * | El ticket descifrado para comprobar. |
pcubTicketDecrypted | uint32 * | El tamaño en bytes del búfer rgubTicketDecrypted . |
psteamID | CSteamID * | Devuelve el id. de Steam asociado con el ticket. Devuelve k_steamIDNil si el ticket no es válido. |
Obtiene el id. de Steam asociado a un ticket.
SteamEncryptedAppTicket_GetUserVariableData
S_API const uint8 *SteamEncryptedAppTicket_GetUserVariableData( uint8 *rgubTicketDecrypted, uint32 cubTicketDecrypted, uint32 *pcubUserData );
Nombre | Tipo | Descripción |
rgubTicketDecrypted | uint8 * | El ticket descifrado para comprobar. |
pcubTicketDecrypted | uint32 * | El tamaño en bytes del búfer rgubTicketDecrypted . |
pcubUserData | uint32 * | Devuelve el tamaño de los datos del usuario. |
Obtiene los datos de usuario de longitud variable suministrados al crear el ticket.
Devuelve: const uint8 *
Devuelve un puntero a los datos del usuario. Devuelve el tamaño de estos datos a través de
pcubUserData
.
Constantes
Estas son constantes establecidas para usarse con SteamEncryptedAppTicket.
Nombre | Tipo | Valor | Descripción |
k_nSteamEncryptedAppTicketSymmetricKeyLen | int | 32 | La longitud de una clave utilizada con BDecryptTicket. |