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