1 #ifndef VG_STEAM_AUTH_H
2 #define VG_STEAM_AUTH_H
4 #include "vg/vg_platform.h"
7 typedef u32 HAuthTicket
;
8 enum{ k_HAuthTicketInvalid
= 0 };
11 #if defined( VALVE_CALLBACK_PACK_SMALL )
12 #pragma pack( push, 4 )
13 #elif defined( VALVE_CALLBACK_PACK_LARGE )
14 #pragma pack( push, 8 )
17 typedef struct EncryptedAppTicketResponse_t EncryptedAppTicketResponse_t
;
18 struct EncryptedAppTicketResponse_t
22 enum{ k_iEncryptedAppTicketResponse
= k_iSteamUserCallbacks
+ 54 };
24 typedef struct GetAuthSessionTicketResponse_t GetAuthSessionTicketResponse_t
;
25 struct GetAuthSessionTicketResponse_t
27 HAuthTicket m_hAuthTicket
;
30 enum{ k_iGetAuthSessionTicketResponse
= k_iSteamUserCallbacks
+ 63 };
35 * Regular authentication
38 typedef void ISteamUser
;
39 ISteamUser
*SteamAPI_SteamUser_v021(void);
40 ISteamUser
*SteamAPI_SteamUser(void)
42 return SteamAPI_SteamUser_v021();
45 HAuthTicket
SteamAPI_ISteamUser_GetAuthSessionTicket(
46 ISteamUser
*self
, void *pTicket
,
47 int cbMaxTicket
, u32
*pcbTicket
);
50 * Application symetric-key ticket (Client)
53 SteamAPICall_t
SteamAPI_ISteamUser_RequestEncryptedAppTicket(
54 ISteamUser
*self
, void *pDataToInclude
, int cbDataToInclude
);
56 int SteamAPI_ISteamUser_GetEncryptedAppTicket(
57 ISteamUser
*self
, void *pTicket
,
58 int cbMaxTicket
, u32
*pcbTicket
);
62 * Application symetric-key ticket method (Server)
65 enum { k_nSteamEncryptedAppTicketSymmetricKeyLen
= 32 };
67 int SteamEncryptedAppTicket_BDecryptTicket( u8
*rgubTicketEncrypted
,
68 u32 cubTicketEncrypted
, u8
*rgubTicketDecrypted
,
69 u32
*pcubTicketDecrypted
,
70 u8 rgubKey
[k_nSteamEncryptedAppTicketSymmetricKeyLen
],
73 int SteamEncryptedAppTicket_BIsTicketForApp( u8
*rgubTicketDecrypted
,
74 u32 cubTicketDecrypted
, AppId_t nAppID
);
76 RTime32
SteamEncryptedAppTicket_GetTicketIssueTime( u8
*rgubTicketDecrypted
,
77 u32 cubTicketDecrypted
);
79 void SteamEncryptedAppTicket_GetTicketSteamID(
80 u8
*rgubTicketDecrypted
, u32 cubTicketDecrypted
, CSteamID
*psteamID
);
82 AppId_t
SteamEncryptedAppTicket_GetTicketAppID( u8
*rgubTicketDecrypted
,
83 u32 cubTicketDecrypted
);
85 int SteamEncryptedAppTicket_BUserOwnsAppInTicket( u8
*rgubTicketDecrypted
,
86 u32 cubTicketDecrypted
, AppId_t nAppID
);
88 int SteamEncryptedAppTicket_BUserIsVacBanned( u8
*rgubTicketDecrypted
,
89 u32 cubTicketDecrypted
);
91 int SteamEncryptedAppTicket_BGetAppDefinedValue( u8
*rgubTicketDecrypted
,
92 u32 cubTicketDecrypted
, u32
*pValue
);
94 u8
*SteamEncryptedAppTicket_GetUserVariableData( u8
*rgubTicketDecrypted
,
95 u32 cubTicketDecrypted
, u32
*pcubUserData
);
97 int SteamEncryptedAppTicket_BIsTicketSigned( u8
*rgubTicketDecrypted
,
98 u32 cubTicketDecrypted
, u8
*pubRSAKey
, u32 cubRSAKey
);
100 int SteamEncryptedAppTicket_BIsLicenseBorrowed( u8
*rgubTicketDecrypted
,
101 u32 cubTicketDecrypted
);
103 int SteamEncryptedAppTicket_BIsLicenseTemporary( u8
*rgubTicketDecrypted
,
104 u32 cubTicketDecrypted
);
106 static u8
vg_char_base16( char c
)
108 if( c
>= '0' && c
<= '9' )
110 if( c
>= 'a' && c
<= 'f' )
116 static int vg_load_steam_symetric_key( const char *path
, u8
*buf
)
118 vg_linear_clear( vg_mem
.scratch
);
120 char *src
= vg_file_read( vg_mem
.scratch
, path
, &size
);
124 if( size
< k_nSteamEncryptedAppTicketSymmetricKeyLen
)
126 vg_error( "Application key was invalid size\n" );
130 for( int i
=0; i
<k_nSteamEncryptedAppTicketSymmetricKeyLen
; i
++ )
132 buf
[i
] = (vg_char_base16( src
[i
*2+0] ) << 4) |
133 vg_char_base16( src
[i
*2+1] );
140 vg_error( "Application key path was invalid\n" );
146 #endif /* VG_STEAM_AUTH_H */