crypto/p256_key_exchange_unittest.cc
// The SignAndVerify test generates a key exchange (public/private key pair) and
// takes the public key value and signs it. Finally it verifies that the
// signature matches with the public key signature. We repeat this test 5 times.
The SignAndVerify test generates a key exchange (public/private key pair) and
takes the public key value and signs it. Finally it verifies that the
signature matches with the public key signature. We repeat this test 5 times.
The SignAndVerify test generates a key exchange ( public / private key pair ) and takes the public key value and signs it . Finally it verifies that the signature matches with the public key signature . We repeat this test 5 times .
TEST(P256KeyExchange, SignAndVerify) {
  for (int i = 0; i < 5; i++) {
    P256KeyExchange alice;
    alice.Init();
    const base::StringPiece alice_sig(alice.GetSignature());
    ASSERT_FALSE(alice_sig.empty());
    const base::StringPiece public_x509(alice.GetX509Public());
    ASSERT_FALSE(public_x509.empty());
    ASSERT_TRUE(P256KeyExchange::VerifySignature(public_x509, alice_sig));
  }
}
TEST ( P256KeyExchange , SignAndVerify ) { for ( int i = 0 ; i < 5 ; i ++ ) { P256KeyExchange alice ; alice . Init ( ) ; const base :: StringPiece alice_sig ( alice . GetSignature ( ) ) ; ASSERT_FALSE ( alice_sig . empty ( ) ) ; const base :: StringPiece public_x509 ( alice . GetX509Public ( ) ) ; ASSERT_FALSE ( public_x509 . empty ( ) ) ; ASSERT_TRUE ( P256KeyExchange :: VerifySignature ( public_x509 , alice_sig ) ) ; } }
The SignAndVerify test generates a key exchange (public/private key pair) and
takes the public key value and signs it.
The SignAndVerify test generates a key exchange ( public / private key pair ) and takes the public key value and signs it .
// Take the public key in DER format. This is the string that is going to be // passed through the SHA256 and then signed. // Verify the signature against it's public key.