libcamera: include/libcamera/internal/pub_key.h Source File

libcamera v0.1.0 Supporting cameras in Linux since 2019

Loading...
Searching...
No Matches
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
8#pragma once
9
10#include <stdint.h>
11
12#include <libcamera/base/span.h>
13
14#if HAVE_CRYPTO
15struct evp_pkey_st;
16#elif HAVE_GNUTLS
17struct gnutls_pubkey_st;
18#endif
19
20namespace libcamera {
21
22 class PubKey
23{
24public:
25 PubKey(Span<const uint8_t> key);
26 ~PubKey();
27
28 bool isValid() const { return valid_; }
29 bool verify(Span<const uint8_t> data, Span<const uint8_t> sig) const;
30
31private:
32 bool valid_;
33#if HAVE_CRYPTO
34 struct evp_pkey_st *pubkey_;
35#elif HAVE_GNUTLS
36 struct gnutls_pubkey_st *pubkey_;
37#endif
38};
39
40} /* namespace libcamera */
libcamera::PubKey
Public key wrapper for signature verification.
Definition pub_key.h:23
libcamera::PubKey::verify
bool verify(Span< const uint8_t > data, Span< const uint8_t > sig) const
Verify signature on data.
Definition pub_key.cpp:90
libcamera::PubKey::isValid
bool isValid() const
Check is the public key is valid.
Definition pub_key.h:28
libcamera
Top-level libcamera namespace.
Definition backtrace.h:17