Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2155)

Unified Diff: remoting/protocol/negotiating_authenticator_unittest.cc

Issue 1780403002: Enable Curve25519 in host and client for PIN-based and third-party auth. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/protocol/negotiating_authenticator_unittest.cc
diff --git a/remoting/protocol/negotiating_authenticator_unittest.cc b/remoting/protocol/negotiating_authenticator_unittest.cc
index 534eeccf87311d787b18cfeab95a01fcfd60992f..f07be708dc6772c84701724e8a264e9e9da10f9e 100644
--- a/remoting/protocol/negotiating_authenticator_unittest.cc
+++ b/remoting/protocol/negotiating_authenticator_unittest.cc
@@ -37,6 +37,9 @@ const char kTestClientName[] = "client-name";
const char kTestClientId[] = "client-id";
const char kTestHostId[] = "12345678910123456";
+const char kClientJid[] = "alice@gmail.com/abc";
+const char kHostJid[] = "alice@gmail.com/123";
+
const char kTestPairedSecret[] = "1111-2222-3333";
const char kTestPairedSecretBad[] = "4444-5555-6666";
const char kTestPin[] = "123456";
@@ -57,15 +60,15 @@ class NegotiatingAuthenticatorTest : public AuthenticatorTestBase {
bool it2me) {
if (it2me) {
host_ = NegotiatingHostAuthenticator::CreateForIt2Me(
- host_cert_, key_pair_, host_secret);
+ kHostJid, kClientJid, host_cert_, key_pair_, host_secret);
} else {
std::string host_secret_hash =
GetSharedSecretHash(kTestHostId, host_secret);
host_ = NegotiatingHostAuthenticator::CreateWithPin(
- host_cert_, key_pair_, host_secret_hash, pairing_registry_);
+ kHostJid, kClientJid, host_cert_, key_pair_, host_secret_hash,
+ pairing_registry_);
}
-
protocol::ClientAuthenticationConfig client_auth_config;
client_auth_config.host_id = kTestHostId;
client_auth_config.pairing_client_id = client_id;
@@ -74,8 +77,8 @@ class NegotiatingAuthenticatorTest : public AuthenticatorTestBase {
client_auth_config.fetch_secret_callback =
base::Bind(&NegotiatingAuthenticatorTest::FetchSecret,
client_interactive_pin, pairing_expected);
- client_as_negotiating_authenticator_ =
- new NegotiatingClientAuthenticator(client_auth_config);
+ client_as_negotiating_authenticator_ = new NegotiatingClientAuthenticator(
+ kClientJid, kHostJid, client_auth_config);
client_.reset(client_as_negotiating_authenticator_);
}
@@ -145,14 +148,14 @@ TEST_F(NegotiatingAuthenticatorTest, SuccessfulAuthMe2MePin) {
ASSERT_NO_FATAL_FAILURE(InitAuthenticators(kNoClientId, kNoPairedSecret,
kTestPin, kTestPin, false));
VerifyAccepted(
- NegotiatingAuthenticatorBase::Method::SPAKE2_SHARED_SECRET_HMAC);
+ NegotiatingAuthenticatorBase::Method::SHARED_SECRET_SPAKE2_CURVE25519);
}
TEST_F(NegotiatingAuthenticatorTest, SuccessfulAuthIt2me) {
ASSERT_NO_FATAL_FAILURE(InitAuthenticators(kNoClientId, kNoPairedSecret,
kTestPin, kTestPin, true));
VerifyAccepted(
- NegotiatingAuthenticatorBase::Method::SPAKE2_SHARED_SECRET_PLAIN);
+ NegotiatingAuthenticatorBase::Method::SHARED_SECRET_PLAIN_SPAKE2_P224);
}
TEST_F(NegotiatingAuthenticatorTest, InvalidMe2MePin) {
@@ -178,7 +181,7 @@ TEST_F(NegotiatingAuthenticatorTest, IncompatibleMethods) {
&(client_as_negotiating_authenticator_->methods_);
methods->erase(std::find(
methods->begin(), methods->end(),
- NegotiatingAuthenticatorBase::Method::SPAKE2_SHARED_SECRET_PLAIN));
+ NegotiatingAuthenticatorBase::Method::SHARED_SECRET_PLAIN_SPAKE2_P224));
ASSERT_NO_FATAL_FAILURE(RunAuthExchange());
@@ -190,7 +193,7 @@ TEST_F(NegotiatingAuthenticatorTest, PairingNotSupported) {
kTestPin, kTestPin, false));
ASSERT_NO_FATAL_FAILURE(RunAuthExchange());
VerifyAccepted(
- NegotiatingAuthenticatorBase::Method::SPAKE2_SHARED_SECRET_HMAC);
+ NegotiatingAuthenticatorBase::Method::SHARED_SECRET_SPAKE2_CURVE25519);
}
TEST_F(NegotiatingAuthenticatorTest, PairingSupportedButNotPaired) {
@@ -198,7 +201,7 @@ TEST_F(NegotiatingAuthenticatorTest, PairingSupportedButNotPaired) {
ASSERT_NO_FATAL_FAILURE(InitAuthenticators(kNoClientId, kNoPairedSecret,
kTestPin, kTestPin, false));
ASSERT_NO_FATAL_FAILURE(RunAuthExchange());
- VerifyAccepted(NegotiatingAuthenticatorBase::Method::SPAKE2_PAIR);
+ VerifyAccepted(NegotiatingAuthenticatorBase::Method::PAIRED_SPAKE2_P224);
}
TEST_F(NegotiatingAuthenticatorTest, PairingRevokedPinOkay) {
@@ -206,7 +209,7 @@ TEST_F(NegotiatingAuthenticatorTest, PairingRevokedPinOkay) {
ASSERT_NO_FATAL_FAILURE(InitAuthenticators(kTestClientId, kTestPairedSecret,
kTestPin, kTestPin, false));
ASSERT_NO_FATAL_FAILURE(RunAuthExchange());
- VerifyAccepted(NegotiatingAuthenticatorBase::Method::SPAKE2_PAIR);
+ VerifyAccepted(NegotiatingAuthenticatorBase::Method::PAIRED_SPAKE2_P224);
}
TEST_F(NegotiatingAuthenticatorTest, PairingRevokedPinBad) {
@@ -222,7 +225,7 @@ TEST_F(NegotiatingAuthenticatorTest, PairingSucceeded) {
ASSERT_NO_FATAL_FAILURE(InitAuthenticators(kTestClientId, kTestPairedSecret,
kTestPinBad, kTestPin, false));
ASSERT_NO_FATAL_FAILURE(RunAuthExchange());
- VerifyAccepted(NegotiatingAuthenticatorBase::Method::SPAKE2_PAIR);
+ VerifyAccepted(NegotiatingAuthenticatorBase::Method::PAIRED_SPAKE2_P224);
}
TEST_F(NegotiatingAuthenticatorTest,
@@ -231,7 +234,7 @@ TEST_F(NegotiatingAuthenticatorTest,
ASSERT_NO_FATAL_FAILURE(InitAuthenticators(
kTestClientId, kTestPairedSecretBad, kTestPin, kTestPin, false));
ASSERT_NO_FATAL_FAILURE(RunAuthExchange());
- VerifyAccepted(NegotiatingAuthenticatorBase::Method::SPAKE2_PAIR);
+ VerifyAccepted(NegotiatingAuthenticatorBase::Method::PAIRED_SPAKE2_P224);
}
TEST_F(NegotiatingAuthenticatorTest, PairingFailedInvalidSecretAndPin) {
« no previous file with comments | « remoting/protocol/negotiating_authenticator_base.cc ('k') | remoting/protocol/negotiating_client_authenticator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698