crypto/p256_key_exchange_unittest.cc
// The sign test creates multiple signatures from a fixed private EC key. These
// signatures must verify the signature check for the public key. Some results
// have been verified against the same fixed private key in the fred reference
// implementation.
The sign test creates multiple signatures from a fixed private EC key. These
signatures must verify the signature check for the public key. Some results
have been verified against the same fixed private key in the fred reference
implementation.
The sign test creates multiple signatures from a fixed private EC key . These signatures must verify the signature check for the public key . Some results have been verified against the same fixed private key in the fred reference implementation .
TEST(P256KeyExchange, Sign) {
  for (int i = 0; i < 5; i++) {
    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(
      reinterpret_cast<const char *>(public_key), sizeof(public_key));
    const base::StringPiece p256ex_sig(p256ex.GetSignature());
    ASSERT_FALSE(p256ex_sig.empty());
    ASSERT_TRUE(P256KeyExchange::VerifySignature(public_str, p256ex_sig));
  }
}
TEST ( P256KeyExchange , Sign ) { for ( int i = 0 ; i < 5 ; i ++ ) { 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 ( reinterpret_cast < const char * > ( public_key ) , sizeof ( public_key ) ) ; const base :: StringPiece p256ex_sig ( p256ex . GetSignature ( ) ) ; ASSERT_FALSE ( p256ex_sig . empty ( ) ) ; ASSERT_TRUE ( P256KeyExchange :: VerifySignature ( public_str , p256ex_sig ) ) ; } }
The sign test creates multiple signatures from a fixed private EC key.
The sign test creates multiple signatures from a fixed private EC key .
// Create the exchange from the private key // Get the public key signature // Verify the signature against it's public key.