#include "chrome/browser/enterprise/connectors/device_trust/key_management/installer/key_rotation_manager_impl.h"
#include <memory>
#include <string>
#include <utility>
#include "base/check.h"
#include "base/functional/callback.h"
#include "base/syslog_logging.h"
#include "base/threading/platform_thread.h"
#include "chrome/browser/enterprise/connectors/device_trust/device_trust_features.h"
#include "chrome/browser/enterprise/connectors/device_trust/key_management/core/network/key_network_delegate.h"
#include "chrome/browser/enterprise/connectors/device_trust/key_management/core/network/key_upload_request.h"
#include "chrome/browser/enterprise/connectors/device_trust/key_management/core/network/util.h"
#include "chrome/browser/enterprise/connectors/device_trust/key_management/core/persistence/key_persistence_delegate.h"
#include "chrome/browser/enterprise/connectors/device_trust/key_management/installer/key_rotation_types.h"
#include "chrome/browser/enterprise/connectors/device_trust/key_management/installer/metrics_util.h"
#include "components/enterprise/client_certificates/core/cloud_management_delegate.h"
#include "components/policy/proto/device_management_backend.pb.h"
#include "url/gurl.h"
BPKUR;
namespace enterprise_connectors {
namespace {
constexpr int kMaxDMTokenLength = …;
bool IsValidKey(const SigningKeyPair* key_pair) { … }
}
KeyRotationManagerImpl::KeyRotationManagerImpl(
std::unique_ptr<KeyNetworkDelegate> network_delegate,
std::unique_ptr<KeyPersistenceDelegate> persistence_delegate)
: … { … }
KeyRotationManagerImpl::KeyRotationManagerImpl(
std::unique_ptr<enterprise_attestation::CloudManagementDelegate>
cloud_management_delegate,
std::unique_ptr<KeyPersistenceDelegate> persistence_delegate)
: … { … }
KeyRotationManagerImpl::~KeyRotationManagerImpl() = default;
void KeyRotationManagerImpl::Rotate(
const GURL& dm_server_url,
const std::string& dm_token,
const std::string& nonce,
base::OnceCallback<void(KeyRotationResult)> result_callback) { … }
void KeyRotationManagerImpl::OnDmServerResponse(
scoped_refptr<SigningKeyPair> old_key_pair,
base::OnceCallback<void(KeyRotationResult)> result_callback,
KeyNetworkDelegate::HttpResponseCode response_code) { … }
void KeyRotationManagerImpl::OnUploadPublicKeyCompleted(
scoped_refptr<SigningKeyPair> old_key_pair,
base::OnceCallback<void(KeyRotationResult)> callback,
const policy::DMServerJobResult result) { … }
}