You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor code that sets identity and certificates.
This is to enable cacfhing of certificates and relay tickets to a durable
cache, especially on consoles.
- InternalClearIdentity is virtual, this will give the SDR class a chance
to nuke any existing tickets when we reset our identity.
- Added InternalOnGotIdentity
- Refactored SetCertificate and added some flags so that we can control
how it interacts with the cache. Things can get a bit tangled because
in some sitautions the certificate is how we learn what our identity
is.
P4:7307221
boolCSteamNetworkingSockets::InternalSetCertificate( constvoid *pCertificate, int cbCertificate, SteamNetworkingErrMsg &errMsg, int nIdentitySetFlags )
// If we already have an identity, it must match the cert
722
+
bool bSetIdentity = false;
723
+
if ( m_identity.IsInvalid() || m_identity.IsLocalHost() )
724
+
{
725
+
bSetIdentity = true;
726
+
}
727
+
elseif ( !( m_identity == certIdentity ) )
728
+
{
729
+
V_sprintf_safe( errMsg, "Cert is for identity '%s'. We are '%s'", SteamNetworkingIdentityRender( certIdentity ).c_str(), SteamNetworkingIdentityRender( m_identity ).c_str() );
730
+
returnfalse;
731
+
}
732
+
709
733
// We currently only support one key type
710
734
if ( msgCert.key_type() != CMsgSteamDatagramCertificate_EKeyType_ED25519 || msgCert.key_data().size() != 32 )
711
735
{
712
736
V_strcpy_safe( errMsg, "Cert has invalid public key" );
713
737
returnfalse;
714
738
}
715
739
740
+
// FIXME - should we check if we already have a newer, equivalent cert?
// If we don't know our identity, then set it now. Otherwise,
769
795
// it better match.
770
-
if ( m_identity.IsInvalid() || m_identity.IsLocalHost() )
796
+
if ( bSetIdentity )
771
797
{
772
798
m_identity = certIdentity;
773
799
SpewMsg( "Local identity established from certificate. We are '%s'\n", SteamNetworkingIdentityRender( m_identity ).c_str() );
774
800
}
775
-
elseif ( !( m_identity == certIdentity ) )
776
-
{
777
-
V_sprintf_safe( errMsg, "Cert is for identity '%s'. We are '%s'", SteamNetworkingIdentityRender( certIdentity ).c_str(), SteamNetworkingIdentityRender( m_identity ).c_str() );
if ( m_identity.IsInvalid() || m_identity.IsLocalHost() )
833
+
{
834
+
int nIdentitySetFlags = k_nIdentitySetFlag_NoSave; // Allow us to check the durable cache for any credentials, but we know we are empty, so don't save anything
0 commit comments