зеркало из https://github.com/mozilla/gecko-dev.git
80 строки
2.4 KiB
C++
80 строки
2.4 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "mozilla/dom/U2FHIDTokenManager.h"
|
|
|
|
namespace mozilla {
|
|
namespace dom {
|
|
|
|
U2FHIDTokenManager::U2FHIDTokenManager()
|
|
{
|
|
}
|
|
|
|
U2FHIDTokenManager::~U2FHIDTokenManager()
|
|
{
|
|
}
|
|
|
|
// A U2F Register operation causes a new key pair to be generated by the token.
|
|
// The token then returns the public key of the key pair, and a handle to the
|
|
// private key, which is a fancy way of saying "key wrapped private key", as
|
|
// well as the generated attestation certificate and a signature using that
|
|
// certificate's private key.
|
|
//
|
|
// The KeyHandleFromPrivateKey and PrivateKeyFromKeyHandle methods perform
|
|
// the actual key wrap/unwrap operations.
|
|
//
|
|
// The format of the return registration data is as follows:
|
|
//
|
|
// Bytes Value
|
|
// 1 0x05
|
|
// 65 public key
|
|
// 1 key handle length
|
|
// * key handle
|
|
// ASN.1 attestation certificate
|
|
// * attestation signature
|
|
//
|
|
RefPtr<U2FRegisterPromise>
|
|
U2FHIDTokenManager::Register(const nsTArray<WebAuthnScopedCredentialDescriptor>& aDescriptors,
|
|
const nsTArray<uint8_t>& aApplication,
|
|
const nsTArray<uint8_t>& aChallenge,
|
|
uint32_t aTimeoutMS)
|
|
{
|
|
return U2FRegisterPromise::CreateAndReject(NS_ERROR_NOT_IMPLEMENTED, __func__);
|
|
}
|
|
|
|
// A U2F Sign operation creates a signature over the "param" arguments (plus
|
|
// some other stuff) using the private key indicated in the key handle argument.
|
|
//
|
|
// The format of the signed data is as follows:
|
|
//
|
|
// 32 Application parameter
|
|
// 1 User presence (0x01)
|
|
// 4 Counter
|
|
// 32 Challenge parameter
|
|
//
|
|
// The format of the signature data is as follows:
|
|
//
|
|
// 1 User presence
|
|
// 4 Counter
|
|
// * Signature
|
|
//
|
|
RefPtr<U2FSignPromise>
|
|
U2FHIDTokenManager::Sign(const nsTArray<WebAuthnScopedCredentialDescriptor>& aDescriptors,
|
|
const nsTArray<uint8_t>& aApplication,
|
|
const nsTArray<uint8_t>& aChallenge,
|
|
uint32_t aTimeoutMS)
|
|
{
|
|
return U2FSignPromise::CreateAndReject(NS_ERROR_NOT_IMPLEMENTED, __func__);
|
|
}
|
|
|
|
void
|
|
U2FHIDTokenManager::Cancel()
|
|
{
|
|
}
|
|
|
|
}
|
|
}
|