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

Method ParsePEM

src/common/keypair.cpp:577–599  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

575}
576
577bool CECSigningPrivateKey::ParsePEM( const char *pBuffer, size_t cBytes )
578{
579 Wipe();
580
581 CAutoWipeBuffer buf;
582 if ( !CCrypto::DecodePEMBody( pBuffer, (uint32)cBytes, buf, "OPENSSH PRIVATE KEY" ) )
583 return false;
584 uint8 privateThenPublic[64];
585 if ( !BParseOpenSSHBinaryEd25519Private( buf, privateThenPublic ) )
586 return false;
587
588 if ( !SetRawDataAndWipeInput( privateThenPublic, 32 ) )
589 return false;
590
591 // Check that the public key matches the private one.
592 // (And also that all of our code works.)
593 if ( V_memcmp( m_publicKey, privateThenPublic+32, 32 ) == 0 )
594 return true;
595
596 AssertMsg( false, "Ed25519 key public doesn't match private!" );
597 Wipe();
598 return false;
599}
600
601//-----------------------------------------------------------------------------
602// CECSigningPublicKey

Callers 2

mainFunction · 0.80
mainFunction · 0.80

Calls 2

V_memcmpFunction · 0.85

Tested by 1

mainFunction · 0.64