-
Notifications
You must be signed in to change notification settings - Fork 1
/
fake_easy_unlock_service.h
55 lines (45 loc) · 1.99 KB
/
fake_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_FAKE_EASY_UNLOCK_SERVICE_H_
#define EASY_UNLOCK_FAKE_EASY_UNLOCK_SERVICE_H_
#include <vector>
#include "easy-unlock/easy_unlock_service.h"
namespace easy_unlock {
// EasyUnlock service to be used in unittests.
class FakeService : public Service {
public:
FakeService();
FakeService(const FakeService&) = delete;
FakeService& operator=(const FakeService&) = delete;
virtual ~FakeService();
// easy_unlock::Service overrides:
void GenerateEcP256KeyPair(std::vector<uint8_t>* private_key,
std::vector<uint8_t>* public_key) override;
std::vector<uint8_t> WrapPublicKey(
easy_unlock_crypto::ServiceImpl::KeyAlgorithm algorithm,
const std::vector<uint8_t>& public_key) override;
std::vector<uint8_t> PerformECDHKeyAgreement(
const std::vector<uint8_t>& private_key,
const std::vector<uint8_t>& public_key) override;
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) override;
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) override;
private:
int private_key_count_;
int public_key_count_;
};
} // namespace easy_unlock
#endif // EASY_UNLOCK_FAKE_EASY_UNLOCK_SERVICE_H_