p256_public_key.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright 2017 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef DEVICE_FIDO_P256_PUBLIC_KEY_H_
  5. #define DEVICE_FIDO_P256_PUBLIC_KEY_H_
  6. #include <stdint.h>
  7. #include <memory>
  8. #include "base/component_export.h"
  9. #include "base/containers/span.h"
  10. #include "components/cbor/values.h"
  11. namespace device {
  12. struct PublicKey;
  13. struct COMPONENT_EXPORT(DEVICE_FIDO) P256PublicKey {
  14. static std::unique_ptr<PublicKey> ExtractFromU2fRegistrationResponse(
  15. int32_t algorithm,
  16. base::span<const uint8_t> u2f_data);
  17. static std::unique_ptr<PublicKey> ExtractFromCOSEKey(
  18. int32_t algorithm,
  19. base::span<const uint8_t> cbor_bytes,
  20. const cbor::Value::MapValue& map);
  21. // Parse a public key encoded in ANSI X9.62 uncompressed format.
  22. static std::unique_ptr<PublicKey> ParseX962Uncompressed(
  23. int32_t algorithm,
  24. base::span<const uint8_t> input);
  25. };
  26. } // namespace device
  27. #endif // DEVICE_FIDO_P256_PUBLIC_KEY_H_