libcamera v0.0.0+3240-f2a18172-dirty (2021-12-21T19:23:13+00:00)
Supporting cameras in Linux since 2019
pub_key.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2020, Google Inc.
4 *
5 * pub_key.h - Public key signature verification
6 */
7#ifndef __LIBCAMERA_INTERNAL_PUB_KEY_H__
8#define __LIBCAMERA_INTERNAL_PUB_KEY_H__
9
10#include <stdint.h>
11
12#include <libcamera/base/span.h>
13
14#if HAVE_GNUTLS
15struct gnutls_pubkey_st;
16#endif
17
18namespace libcamera {
19
20class PubKey
21{
22public:
23 PubKey(Span<const uint8_t> key);
24 ~PubKey();
25
26 bool isValid() const { return valid_; }
27 bool verify(Span<const uint8_t> data, Span<const uint8_t> sig) const;
28
29private:
30 bool valid_;
31#if HAVE_GNUTLS
32 struct gnutls_pubkey_st *pubkey_;
33#endif
34};
35
36} /* namespace libcamera */
37
38#endif /* __LIBCAMERA_INTERNAL_PUB_KEY_H__ */
Public key wrapper for signature verification.
Definition: pub_key.h:21
PubKey(Span< const uint8_t > key)
Construct a PubKey from key data.
Definition: pub_key.cpp:33
bool verify(Span< const uint8_t > data, Span< const uint8_t > sig) const
Verify signature on data.
Definition: pub_key.cpp:76
bool isValid() const
Check is the public key is valid.
Definition: pub_key.h:26
Top-level libcamera namespace.
Definition: backtrace.h:17