@@ -244,7 +244,7 @@ struct PublicKey
244244 if ( m_eTrust >= k_ETrust_Trusted )
245245 return true ;
246246 Assert ( m_eTrust <= k_ETrust_NotTrusted );
247- Assert ( !m_status_msg.empty () ); // We should nkow the reason for any key we don't trust
247+ Assert ( !m_status_msg.empty () ); // We should know the reason for any key we don't trust
248248 return false ;
249249 }
250250
@@ -666,6 +666,38 @@ const CertAuthScope *CertStore_CheckCert( const CMsgSteamDatagramCertificateSign
666666 return nullptr ;
667667 }
668668
669+ // Check if their key has specifically been revoked.
670+ if ( outMsgCert.key_type () != CMsgSteamDatagramCertificate_EKeyType_ED25519 )
671+ {
672+ V_sprintf_safe ( errMsg, " Cert has invalid key type %d" , (int )outMsgCert.key_type () );
673+ return nullptr ;
674+ }
675+ uint64 nKeyID = CalculatePublicKeyID_Ed25519 ( outMsgCert.key_data ().c_str (), outMsgCert.key_data ().length () );
676+ if ( nKeyID == 0 )
677+ {
678+ V_sprintf_safe ( errMsg, " Cert has invalid public key" );
679+ return nullptr ;
680+ }
681+ const PublicKey *pPubKey = FindPublicKey ( nKeyID );
682+ if ( pPubKey )
683+ {
684+ if ( pPubKey->m_eTrust == k_ETrust_NotTrusted )
685+ {
686+ // Hm - this status doesn't mean "bad", it just means that the cert in the cert store
687+ // with this key was not able to be verified. This is an an unusual situation, ordinarily
688+ // we should not have any certs in the cert store that we are not able to trust. Still, we
689+ // just specific ally verified trust above. So let's continue on, but without adding this
690+ // to the cert store.
691+ }
692+ else if ( !pPubKey->IsTrusted () )
693+ {
694+ // Key is revoked.
695+ Assert ( pPubKey->m_eTrust == k_ETrust_Revoked );
696+ V_sprintf_safe ( errMsg, " Cert has untrusted public key. %s" , pPubKey->m_status_msg .c_str () );
697+ return nullptr ;
698+ }
699+ }
700+
669701 return pResult;
670702}
671703
@@ -677,7 +709,7 @@ bool CheckCertAppID( const CMsgSteamDatagramCertificate &msgCert, const CertAuth
677709 {
678710 if ( !pCACertAuthScope || pCACertAuthScope->m_apps .HasItem ( nAppID ) )
679711 return true ;
680- V_sprintf_safe ( errMsg, " Cert is not restricted by appid, by CA trust chain is, and does not authorize %u" , nAppID );
712+ V_sprintf_safe ( errMsg, " Cert is not restricted by appid, but CA trust chain is, and does not authorize %u" , nAppID );
681713 return true ;
682714 }
683715
@@ -713,7 +745,7 @@ bool CheckCertPOPID( const CMsgSteamDatagramCertificate &msgCert, const CertAuth
713745 {
714746 if ( !pCACertAuthScope || pCACertAuthScope->m_pops .HasItem ( popID ) )
715747 return true ;
716- V_sprintf_safe ( errMsg, " Cert is not restricted by POPID, by CA trust chain is, and does not authorize %s" , SteamNetworkingPOPIDRender ( popID ).c_str () );
748+ V_sprintf_safe ( errMsg, " Cert is not restricted by POPID, but CA trust chain is, and does not authorize %s" , SteamNetworkingPOPIDRender ( popID ).c_str () );
717749 return true ;
718750 }
719751
0 commit comments