1 #ifndef VG_STEAM_AUTH_H
2 #define VG_STEAM_AUTH_H
4 #include "vg/vg_platform.h"
6 typedef u32 HAuthTicket
;
7 enum{ k_HAuthTicketInvalid
= 0 };
10 #if defined( VALVE_CALLBACK_PACK_SMALL )
11 #pragma pack( push, 4 )
12 #elif defined( VALVE_CALLBACK_PACK_LARGE )
13 #pragma pack( push, 8 )
16 typedef struct EncryptedAppTicketResponse_t EncryptedAppTicketResponse_t
;
17 struct EncryptedAppTicketResponse_t
21 enum{ k_iEncryptedAppTicketResponse
= k_iSteamUserCallbacks
+ 54 };
23 typedef struct GetAuthSessionTicketResponse_t GetAuthSessionTicketResponse_t
;
24 struct GetAuthSessionTicketResponse_t
26 HAuthTicket m_hAuthTicket
;
29 enum{ k_iGetAuthSessionTicketResponse
= k_iSteamUserCallbacks
+ 63 };
34 * Regular authentication
37 typedef void ISteamUser
;
38 ISteamUser
*SteamAPI_SteamUser_v021(void);
39 ISteamUser
*SteamAPI_SteamUser(void)
41 return SteamAPI_SteamUser_v021();
44 HAuthTicket
SteamAPI_ISteamUser_GetAuthSessionTicket(
45 ISteamUser
*self
, void *pTicket
,
46 int cbMaxTicket
, u32
*pcbTicket
);
49 * Application symetric-key ticket (Client)
52 SteamAPICall_t
SteamAPI_ISteamUser_RequestEncryptedAppTicket(
53 ISteamUser
*self
, void *pDataToInclude
, int cbDataToInclude
);
55 int SteamAPI_ISteamUser_GetEncryptedAppTicket(
56 ISteamUser
*self
, void *pTicket
,
57 int cbMaxTicket
, u32
*pcbTicket
);
61 * Application symetric-key ticket method (Server)
64 enum { k_nSteamEncryptedAppTicketSymmetricKeyLen
= 32 };
66 int SteamEncryptedAppTicket_BDecryptTicket( u8
*rgubTicketEncrypted
,
67 u32 cubTicketEncrypted
, u8
*rgubTicketDecrypted
,
68 u32
*pcubTicketDecrypted
,
69 u8 rgubKey
[k_nSteamEncryptedAppTicketSymmetricKeyLen
],
72 int SteamEncryptedAppTicket_BIsTicketForApp( u8
*rgubTicketDecrypted
,
73 u32 cubTicketDecrypted
, AppId_t nAppID
);
75 RTime32
SteamEncryptedAppTicket_GetTicketIssueTime( u8
*rgubTicketDecrypted
,
76 u32 cubTicketDecrypted
);
78 void SteamEncryptedAppTicket_GetTicketSteamID(
79 u8
*rgubTicketDecrypted
, u32 cubTicketDecrypted
, CSteamID
*psteamID
);
81 AppId_t
SteamEncryptedAppTicket_GetTicketAppID( u8
*rgubTicketDecrypted
,
82 u32 cubTicketDecrypted
);
84 int SteamEncryptedAppTicket_BUserOwnsAppInTicket( u8
*rgubTicketDecrypted
,
85 u32 cubTicketDecrypted
, AppId_t nAppID
);
87 int SteamEncryptedAppTicket_BUserIsVacBanned( u8
*rgubTicketDecrypted
,
88 u32 cubTicketDecrypted
);
90 int SteamEncryptedAppTicket_BGetAppDefinedValue( u8
*rgubTicketDecrypted
,
91 u32 cubTicketDecrypted
, u32
*pValue
);
93 u8
*SteamEncryptedAppTicket_GetUserVariableData( u8
*rgubTicketDecrypted
,
94 u32 cubTicketDecrypted
, u32
*pcubUserData
);
96 int SteamEncryptedAppTicket_BIsTicketSigned( u8
*rgubTicketDecrypted
,
97 u32 cubTicketDecrypted
, u8
*pubRSAKey
, u32 cubRSAKey
);
99 int SteamEncryptedAppTicket_BIsLicenseBorrowed( u8
*rgubTicketDecrypted
,
100 u32 cubTicketDecrypted
);
102 int SteamEncryptedAppTicket_BIsLicenseTemporary( u8
*rgubTicketDecrypted
,
103 u32 cubTicketDecrypted
);
105 static u8
vg_char_base16( char c
)
107 if( c
>= '0' && c
<= '9' )
109 if( c
>= 'a' && c
<= 'f' )
115 static int vg_load_steam_symetric_key( const char *path
, u8
*buf
)
117 vg_linear_clear( vg_mem
.scratch
);
119 char *src
= vg_file_read( vg_mem
.scratch
, path
, &size
);
123 if( size
< k_nSteamEncryptedAppTicketSymmetricKeyLen
)
125 vg_error( "Application key was invalid size\n" );
129 for( int i
=0; i
<k_nSteamEncryptedAppTicketSymmetricKeyLen
; i
++ )
131 buf
[i
] = (vg_char_base16( src
[i
*2+0] ) << 4) |
132 vg_char_base16( src
[i
*2+1] );
139 vg_error( "Application key path was invalid\n" );
145 #endif /* VG_STEAM_AUTH_H */