crypto/p256_key_exchange_unittest.cc
// Private key test builds a P256 key exchange from a known private key, then it
// checks that the public key derived from the private matches exactly with the
// one in the reference
Private key test builds a P256 key exchange from a known private key, then it
checks that the public key derived from the private matches exactly with the
one in the reference
Private key test builds a P256 key exchange from a known private key then it checks that the public key derived from the private matches exactly with the one in the reference
TEST(P256KeyExchange, Private) {
  const base::StringPiece private_str(
    reinterpret_cast<const char *>(private_key), sizeof(private_key));
  P256KeyExchange p256ex;
  p256ex.Init(private_str);
  const base::StringPiece public_str(p256ex.GetX509Public());
  const base::StringPiece ref_public(reinterpret_cast<const char *>(public_key),
                                     sizeof(public_key));
  ASSERT_EQ(public_str.compare(ref_public), 0);
}
TEST ( P256KeyExchange , Private ) { const base :: StringPiece private_str ( reinterpret_cast < const char * > ( private_key ) , sizeof ( private_key ) ) ; P256KeyExchange p256ex ; p256ex . Init ( private_str ) ; const base :: StringPiece public_str ( p256ex . GetX509Public ( ) ) ; const base :: StringPiece ref_public ( reinterpret_cast < const char * > ( public_key ) , sizeof ( public_key ) ) ; ASSERT_EQ ( public_str . compare ( ref_public ) , 0 ) ; }
Private key test builds a P256 key exchange from a known private key, then it
checks that the public key derived from the private matches exactly with the
one in the reference
Private key test builds a P256 key exchange from a known private key then it checks that the public key derived from the private matches exactly with the one in the reference
// Create the exchange from the private key // Get the public key from the private // Public keys must match