blob: a62a2b6278434be24f50763bef5a320bfd3fcc3c [file] [log] [blame]
// Copyright 2018 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef HERMES_SMDP_INTERFACE_H_
#define HERMES_SMDP_INTERFACE_H_
#include <cstdint>
#include <memory>
#include <string>
#include <vector>
#include <base/callback.h>
#include <base/values.h>
namespace hermes {
// Provides an interface through which the LPD can communicate with the SM-DP
// server. This is responsible for opening, maintaining, and closing a HTTPS
// connection to the server.
class SmdpInterface {
public:
using InitiateAuthenticationCallback =
base::Callback<void(const std::string& transaction_id,
const std::vector<uint8_t>& server_signed1,
const std::vector<uint8_t>& server_signature1,
const std::vector<uint8_t>& euicc_ci_pk_id_to_be_used,
const std::vector<uint8_t>& server_certificate)>;
using AuthenticateClientCallback =
base::Callback<void(const std::string& transaction_id,
const std::vector<uint8_t>& profile_metadata,
const std::vector<uint8_t>& smdp_signed2,
const std::vector<uint8_t>& smdp_signature2,
const std::vector<uint8_t>& public_key)>;
using GetBoundProfilePackageCallback =
base::Callback<void(const std::string& transaction_id,
const std::vector<uint8_t>& bound_profile_package)>;
using ErrorCallback =
base::Callback<void(const std::vector<uint8_t>& error_data)>;
virtual ~SmdpInterface() = default;
// First, establishes a connection to the SM-DP+ server over which
// the ES8+ secure channel will be tunneled, then sends server the eSIM
// challenge and info1 to begin the Authentication procedure. |callback| is
// called upon server's response, or |error_callback| is called on server
// error.
//
// Parameters
// challenge - eSIM challenge as returned by Esim.GetEuiccChallenge
// info1 - eSIM info1 as returned by Esim.GetEuiccInfo
virtual void InitiateAuthentication(
const std::vector<uint8_t>& info1,
const std::vector<uint8_t>& challenge,
const InitiateAuthenticationCallback& data_callback,
const ErrorCallback& error_callback) = 0;
virtual void AuthenticateClient(
const std::string& transaction_id,
const std::vector<uint8_t>& data,
const AuthenticateClientCallback& data_callback,
const ErrorCallback& error_callback) = 0;
virtual void GetBoundProfilePackage(
const std::string& transaction_id,
const std::vector<uint8_t>& data,
const GetBoundProfilePackageCallback& data_callback,
const ErrorCallback& error_callback) = 0;
};
} // namespace hermes
#endif // HERMES_SMDP_INTERFACE_H_