forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathu2f_sign.h
51 lines (40 loc) · 1.76 KB
/
u2f_sign.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
// Copyright 2017 The Chromium 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 DEVICE_U2F_U2F_SIGN_H_
#define DEVICE_U2F_U2F_SIGN_H_
#include <vector>
#include "u2f_request.h"
namespace device {
class U2fSign : public U2fRequest {
public:
U2fSign(const std::vector<std::vector<uint8_t>>& registered_keys,
const std::vector<uint8_t>& challenge_hash,
const std::vector<uint8_t>& app_param,
const ResponseCallback& cb);
~U2fSign() override;
static std::unique_ptr<U2fRequest> TrySign(
const std::vector<std::vector<uint8_t>>& registered_keys,
const std::vector<uint8_t>& challenge_hash,
const std::vector<uint8_t>& app_param,
const ResponseCallback& cb);
private:
void TryDevice() override;
void OnTryDevice(std::vector<std::vector<uint8_t>>::const_iterator it,
U2fReturnCode return_code,
const std::vector<uint8_t>& response_data);
const std::vector<std::vector<uint8_t>> registered_keys_;
std::vector<uint8_t> challenge_hash_;
std::vector<uint8_t> app_param_;
const std::vector<uint8_t> kBogusAppParam = {
0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41};
const std::vector<uint8_t> kBogusChallenge = {
0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42,
0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42,
0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42};
base::WeakPtrFactory<U2fSign> weak_factory_;
};
} // namespace device
#endif // DEVICE_U2F_U2F_SIGN_H_