Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim:set ts=2 sw=2 sts=2 et cindent: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 : * You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #include "mozilla/dom/U2FHIDTokenManager.h"
8 :
9 : namespace mozilla {
10 : namespace dom {
11 :
12 0 : U2FHIDTokenManager::U2FHIDTokenManager()
13 : {
14 0 : }
15 :
16 0 : U2FHIDTokenManager::~U2FHIDTokenManager()
17 : {
18 0 : }
19 :
20 : // A U2F Register operation causes a new key pair to be generated by the token.
21 : // The token then returns the public key of the key pair, and a handle to the
22 : // private key, which is a fancy way of saying "key wrapped private key", as
23 : // well as the generated attestation certificate and a signature using that
24 : // certificate's private key.
25 : //
26 : // The KeyHandleFromPrivateKey and PrivateKeyFromKeyHandle methods perform
27 : // the actual key wrap/unwrap operations.
28 : //
29 : // The format of the return registration data is as follows:
30 : //
31 : // Bytes Value
32 : // 1 0x05
33 : // 65 public key
34 : // 1 key handle length
35 : // * key handle
36 : // ASN.1 attestation certificate
37 : // * attestation signature
38 : //
39 : RefPtr<U2FRegisterPromise>
40 0 : U2FHIDTokenManager::Register(const nsTArray<WebAuthnScopedCredentialDescriptor>& aDescriptors,
41 : const nsTArray<uint8_t>& aApplication,
42 : const nsTArray<uint8_t>& aChallenge)
43 : {
44 0 : return U2FRegisterPromise::CreateAndReject(NS_ERROR_NOT_IMPLEMENTED, __func__);
45 : }
46 :
47 : // A U2F Sign operation creates a signature over the "param" arguments (plus
48 : // some other stuff) using the private key indicated in the key handle argument.
49 : //
50 : // The format of the signed data is as follows:
51 : //
52 : // 32 Application parameter
53 : // 1 User presence (0x01)
54 : // 4 Counter
55 : // 32 Challenge parameter
56 : //
57 : // The format of the signature data is as follows:
58 : //
59 : // 1 User presence
60 : // 4 Counter
61 : // * Signature
62 : //
63 : RefPtr<U2FSignPromise>
64 0 : U2FHIDTokenManager::Sign(const nsTArray<WebAuthnScopedCredentialDescriptor>& aDescriptors,
65 : const nsTArray<uint8_t>& aApplication,
66 : const nsTArray<uint8_t>& aChallenge)
67 : {
68 0 : return U2FSignPromise::CreateAndReject(NS_ERROR_NOT_IMPLEMENTED, __func__);
69 : }
70 :
71 : void
72 0 : U2FHIDTokenManager::Cancel()
73 : {
74 0 : }
75 :
76 : }
77 : }
|