public:
EasyUnlockClientImpl() : proxy_(NULL), weak_ptr_factory_(this) {}
- virtual ~EasyUnlockClientImpl() {}
+ ~EasyUnlockClientImpl() override {}
// EasyUnlockClient override.
- virtual void PerformECDHKeyAgreement(const std::string& private_key,
- const std::string& public_key,
- const DataCallback& callback) OVERRIDE {
+ void GenerateEcP256KeyPair(const KeyPairCallback& callback) override {
dbus::MethodCall method_call(
easy_unlock::kEasyUnlockServiceInterface,
- easy_unlock::kPerformECDHKeyAgreementMethod);
+ easy_unlock::kGenerateEcP256KeyPairMethod);
+ proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ base::Bind(&EasyUnlockClientImpl::OnKeyPair,
+ weak_ptr_factory_.GetWeakPtr(),
+ callback));
+ }
+
+ // EasyUnlockClient override.
+ void WrapPublicKey(const std::string& key_algorithm,
+ const std::string& public_key,
+ const DataCallback& callback) override {
+ dbus::MethodCall method_call(
+ easy_unlock::kEasyUnlockServiceInterface,
+ easy_unlock::kWrapPublicKeyMethod);
dbus::MessageWriter writer(&method_call);
- // NOTE: DBus expects that data sent as string is UTF-8 encoded. This is
- // not guaranteed here, so the method uses byte arrays.
- AppendStringAsByteArray(private_key, &writer);
+ writer.AppendString(key_algorithm);
AppendStringAsByteArray(public_key, &writer);
proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
base::Bind(&EasyUnlockClientImpl::OnData,
}
// EasyUnlockClient override.
- virtual void GenerateEcP256KeyPair(const KeyPairCallback& callback) OVERRIDE {
+ void PerformECDHKeyAgreement(const std::string& private_key,
+ const std::string& public_key,
+ const DataCallback& callback) override {
dbus::MethodCall method_call(
easy_unlock::kEasyUnlockServiceInterface,
- easy_unlock::kGenerateEcP256KeyPairMethod);
+ easy_unlock::kPerformECDHKeyAgreementMethod);
+ dbus::MessageWriter writer(&method_call);
+ // NOTE: DBus expects that data sent as string is UTF-8 encoded. This is
+ // not guaranteed here, so the method uses byte arrays.
+ AppendStringAsByteArray(private_key, &writer);
+ AppendStringAsByteArray(public_key, &writer);
proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
- base::Bind(&EasyUnlockClientImpl::OnKeyPair,
+ base::Bind(&EasyUnlockClientImpl::OnData,
weak_ptr_factory_.GetWeakPtr(),
callback));
}
// EasyUnlockClient override.
- virtual void CreateSecureMessage(const std::string& payload,
- const CreateSecureMessageOptions& options,
- const DataCallback& callback) OVERRIDE {
+ void CreateSecureMessage(const std::string& payload,
+ const CreateSecureMessageOptions& options,
+ const DataCallback& callback) override {
dbus::MethodCall method_call(
easy_unlock::kEasyUnlockServiceInterface,
easy_unlock::kCreateSecureMessageMethod);
}
// EasyUnlockClient override.
- virtual void UnwrapSecureMessage(const std::string& message,
- const UnwrapSecureMessageOptions& options,
- const DataCallback& callback) OVERRIDE {
+ void UnwrapSecureMessage(const std::string& message,
+ const UnwrapSecureMessageOptions& options,
+ const DataCallback& callback) override {
dbus::MethodCall method_call(
easy_unlock::kEasyUnlockServiceInterface,
easy_unlock::kUnwrapSecureMessageMethod);
}
protected:
- virtual void Init(dbus::Bus* bus) OVERRIDE {
+ void Init(dbus::Bus* bus) override {
proxy_ =
bus->GetObjectProxy(
easy_unlock::kEasyUnlockServiceName,