1 #ifndef VG_STEAM_AUTH_H
2 #define VG_STEAM_AUTH_H
4 typedef u32 HAuthTicket
;
5 enum{ k_HAuthTicketInvalid
= 0 };
8 #if defined( VALVE_CALLBACK_PACK_SMALL )
9 #pragma pack( push, 4 )
10 #elif defined( VALVE_CALLBACK_PACK_LARGE )
11 #pragma pack( push, 8 )
14 typedef struct EncryptedAppTicketResponse_t EncryptedAppTicketResponse_t
;
15 struct EncryptedAppTicketResponse_t
19 enum{ k_iEncryptedAppTicketResponse
= k_iSteamUserCallbacks
+ 54 };
21 typedef struct GetAuthSessionTicketResponse_t GetAuthSessionTicketResponse_t
;
22 struct GetAuthSessionTicketResponse_t
24 HAuthTicket m_hAuthTicket
;
27 enum{ k_iGetAuthSessionTicketResponse
= k_iSteamUserCallbacks
+ 63 };
32 * Regular authentication
35 typedef void ISteamUser
;
36 ISteamUser
*SteamAPI_SteamUser_v021(void);
37 ISteamUser
*SteamAPI_SteamUser(void)
39 return SteamAPI_SteamUser_v021();
42 HAuthTicket
SteamAPI_ISteamUser_GetAuthSessionTicket(
43 ISteamUser
*self
, void *pTicket
,
44 int cbMaxTicket
, u32
*pcbTicket
);
47 * Application symetric-key ticket (Client)
50 SteamAPICall_t
SteamAPI_ISteamUser_RequestEncryptedAppTicket(
51 ISteamUser
*self
, void *pDataToInclude
, int cbDataToInclude
);
53 int SteamAPI_ISteamUser_GetEncryptedAppTicket(
54 ISteamUser
*self
, void *pTicket
,
55 int cbMaxTicket
, u32
*pcbTicket
);
59 * Application symetric-key ticket method (Server)
62 enum { k_nSteamEncryptedAppTicketSymmetricKeyLen
= 32 };
64 int SteamEncryptedAppTicket_BDecryptTicket( u8
*rgubTicketEncrypted
,
65 u32 cubTicketEncrypted
, u8
*rgubTicketDecrypted
,
66 u32
*pcubTicketDecrypted
,
67 u8 rgubKey
[k_nSteamEncryptedAppTicketSymmetricKeyLen
],
70 int SteamEncryptedAppTicket_BIsTicketForApp( u8
*rgubTicketDecrypted
,
71 u32 cubTicketDecrypted
, AppId_t nAppID
);
73 RTime32
SteamEncryptedAppTicket_GetTicketIssueTime( u8
*rgubTicketDecrypted
,
74 u32 cubTicketDecrypted
);
76 void SteamEncryptedAppTicket_GetTicketSteamID(
77 u8
*rgubTicketDecrypted
, u32 cubTicketDecrypted
, CSteamID
*psteamID
);
79 AppId_t
SteamEncryptedAppTicket_GetTicketAppID( u8
*rgubTicketDecrypted
,
80 u32 cubTicketDecrypted
);
82 int SteamEncryptedAppTicket_BUserOwnsAppInTicket( u8
*rgubTicketDecrypted
,
83 u32 cubTicketDecrypted
, AppId_t nAppID
);
85 int SteamEncryptedAppTicket_BUserIsVacBanned( u8
*rgubTicketDecrypted
,
86 u32 cubTicketDecrypted
);
88 int SteamEncryptedAppTicket_BGetAppDefinedValue( u8
*rgubTicketDecrypted
,
89 u32 cubTicketDecrypted
, u32
*pValue
);
91 u8
*SteamEncryptedAppTicket_GetUserVariableData( u8
*rgubTicketDecrypted
,
92 u32 cubTicketDecrypted
, u32
*pcubUserData
);
94 int SteamEncryptedAppTicket_BIsTicketSigned( u8
*rgubTicketDecrypted
,
95 u32 cubTicketDecrypted
, u8
*pubRSAKey
, u32 cubRSAKey
);
97 int SteamEncryptedAppTicket_BIsLicenseBorrowed( u8
*rgubTicketDecrypted
,
98 u32 cubTicketDecrypted
);
100 int SteamEncryptedAppTicket_BIsLicenseTemporary( u8
*rgubTicketDecrypted
,
101 u32 cubTicketDecrypted
);
103 static u8
vg_char_base16( char c
)
105 if( c
>= '0' && c
<= '9' )
107 if( c
>= 'a' && c
<= 'f' )
113 static int vg_load_steam_symetric_key( const char *path
, u8
*buf
)
116 char *text_src
= vg_textasset_read_s( path
, &len
);
120 if( len
< k_nSteamEncryptedAppTicketSymmetricKeyLen
)
122 vg_error( "Application key was invalid size\n" );
127 for( int i
=0; i
<k_nSteamEncryptedAppTicketSymmetricKeyLen
; i
++ )
129 buf
[i
] = (vg_char_base16( text_src
[i
*2+0] ) << 4) |
130 vg_char_base16( text_src
[i
*2+1] );
138 vg_error( "Application key path was invalid\n" );
144 #endif /* VG_STEAM_AUTH_H */