-
Notifications
You must be signed in to change notification settings - Fork 1
/
easy_unlock_service.h
55 lines (45 loc) · 2.08 KB
/
easy_unlock_service.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright 2014 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 EASY_UNLOCK_EASY_UNLOCK_SERVICE_H_
#define EASY_UNLOCK_EASY_UNLOCK_SERVICE_H_
#include <stdint.h>
#include <memory>
#include <vector>
#include <easy-unlock-crypto/service_impl.h>
namespace easy_unlock {
// Wrapper around actual EasyUnlock dbus service implementation.
// See ServiceImpl in easy_unlock_crypto repo for more information on the
// methods provided by this interface.
class Service {
public:
// Creates the service implementation to be used in production code.
// Caller should take ownership.
static std::unique_ptr<Service> Create();
virtual ~Service() {}
virtual void GenerateEcP256KeyPair(std::vector<uint8_t>* private_key,
std::vector<uint8_t>* public_key) = 0;
virtual std::vector<uint8_t> WrapPublicKey(
easy_unlock_crypto::ServiceImpl::KeyAlgorithm algorithm,
const std::vector<uint8_t>& public_key) = 0;
virtual std::vector<uint8_t> PerformECDHKeyAgreement(
const std::vector<uint8_t>& private_key,
const std::vector<uint8_t>& public_key) = 0;
virtual std::vector<uint8_t> CreateSecureMessage(
const std::vector<uint8_t>& payload,
const std::vector<uint8_t>& key,
const std::vector<uint8_t>& associated_data,
const std::vector<uint8_t>& public_metadata,
const std::vector<uint8_t>& verification_key_id,
const std::vector<uint8_t>& decryption_key_id,
easy_unlock_crypto::ServiceImpl::EncryptionType encryption_type,
easy_unlock_crypto::ServiceImpl::SignatureType signature_type) = 0;
virtual std::vector<uint8_t> UnwrapSecureMessage(
const std::vector<uint8_t>& secure_message,
const std::vector<uint8_t>& key,
const std::vector<uint8_t>& associated_data,
easy_unlock_crypto::ServiceImpl::EncryptionType encryption_type,
easy_unlock_crypto::ServiceImpl::SignatureType signature_type) = 0;
};
} // namespace easy_unlock
#endif // EASY_UNLOCK_EASY_UNLOCK_SERVICE_H_