MCPcopy Create free account
hub / github.com/ValveSoftware/GameNetworkingSockets / SetFromOpenSSHAuthorizedKeys

Method SetFromOpenSSHAuthorizedKeys

src/common/keypair.cpp:659–682  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

657}
658
659bool CECSigningPublicKey::SetFromOpenSSHAuthorizedKeys( const char *pchData, size_t cbData )
660{
661 Wipe();
662
663 // Gah, we need to make a copy to '\0'-terminate it, to make parsing below easier
664 CAutoWipeBuffer bufText( int( cbData + 8 ) );
665 bufText.Put( pchData, int(cbData) );
666 bufText.PutChar(0);
667 pchData = (const char *)bufText.Base();
668
669 int idxStart = -1, idxEnd = -1;
670 sscanf( pchData, "ssh-ed25519 %nAAAA%*s%n", &idxStart, &idxEnd );
671 if ( idxStart <= 0 || idxEnd <= idxStart )
672 return false;
673
674 CAutoWipeBuffer bufBinary;
675 if ( !CCrypto::DecodeBase64ToBuf( pchData + idxStart, idxEnd-idxStart, bufBinary ) )
676 return false;
677
678 uint8 pubKey[ 32 ];
679 if ( !BParseOpenSSHBinaryEd25519Public( bufBinary, pubKey ) )
680 return false;
681 return SetRawDataAndWipeInput( pubKey, 32 );
682 }
683
684void CCrypto::GenerateKeyExchangeKeyPair( CECKeyExchangePublicKey *pPublicKey, CECKeyExchangePrivateKey *pPrivateKey )
685{

Callers 2

SlamHardcodedRootCAMethod · 0.80
mainFunction · 0.80

Calls 4

PutMethod · 0.80
PutCharMethod · 0.80
BaseMethod · 0.45

Tested by

no test coverage detected