#include "remoting/protocol/spake2_authenticator.h"
#include <utility>
#include "base/base64.h"
#include "base/containers/span.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/numerics/byte_conversions.h"
#include "crypto/hmac.h"
#include "crypto/secure_util.h"
#include "remoting/base/constants.h"
#include "remoting/base/rsa_key_pair.h"
#include "remoting/protocol/ssl_hmac_channel_authenticator.h"
#include "third_party/boringssl/src/include/openssl/curve25519.h"
#include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
namespace remoting::protocol {
namespace {
const jingle_xmpp::StaticQName kSpakeMessageTag = …;
const jingle_xmpp::StaticQName kVerificationHashTag = …;
const jingle_xmpp::StaticQName kCertificateTag = …;
std::unique_ptr<jingle_xmpp::XmlElement> EncodeBinaryValueToXml(
const jingle_xmpp::StaticQName& qname,
const std::string& content) { … }
bool DecodeBinaryValueFromXml(const jingle_xmpp::XmlElement* message,
const jingle_xmpp::QName& qname,
bool* found,
std::string* data) { … }
std::string PrefixWithLength(const std::string& str) { … }
}
std::unique_ptr<Authenticator> Spake2Authenticator::CreateForClient(
const std::string& local_id,
const std::string& remote_id,
const std::string& shared_secret,
Authenticator::State initial_state) { … }
std::unique_ptr<Authenticator> Spake2Authenticator::CreateForHost(
const std::string& local_id,
const std::string& remote_id,
const std::string& local_cert,
scoped_refptr<RsaKeyPair> key_pair,
const std::string& shared_secret,
Authenticator::State initial_state) { … }
Spake2Authenticator::Spake2Authenticator(const std::string& local_id,
const std::string& remote_id,
const std::string& shared_secret,
bool is_host,
Authenticator::State initial_state)
: … { … }
Spake2Authenticator::~Spake2Authenticator() { … }
CredentialsType Spake2Authenticator::credentials_type() const { … }
const Authenticator& Spake2Authenticator::implementing_authenticator() const { … }
Authenticator::State Spake2Authenticator::state() const { … }
bool Spake2Authenticator::started() const { … }
Authenticator::RejectionReason Spake2Authenticator::rejection_reason() const { … }
void Spake2Authenticator::ProcessMessage(const jingle_xmpp::XmlElement* message,
base::OnceClosure resume_callback) { … }
void Spake2Authenticator::ProcessMessageInternal(
const jingle_xmpp::XmlElement* message) { … }
std::unique_ptr<jingle_xmpp::XmlElement> Spake2Authenticator::GetNextMessage() { … }
const std::string& Spake2Authenticator::GetAuthKey() const { … }
std::unique_ptr<ChannelAuthenticator>
Spake2Authenticator::CreateChannelAuthenticator() const { … }
std::string Spake2Authenticator::CalculateVerificationHash(
bool from_host,
const std::string& local_id,
const std::string& remote_id) { … }
}