Vanetza
Loading...
Searching...
No Matches
hash.hpp
1#pragma once
2#include <vanetza/common/byte_buffer.hpp>
3#include <vanetza/security/hash_algorithm.hpp>
4#include <vanetza/security/key_type.hpp>
5
6namespace vanetza
7{
8namespace security
9{
10
11// forward declarations
12class Backend;
13
14namespace v3
15{
16
17// forward declarations
18class CertificateView;
19
20/**
21 * Calculate message hash (combination of hashes).
22 *
23 * This function creates the message hash according to IEEE 1609.2 cause 5.3.1.2.2
24 * for verification type "certificate", i.e. not "self-signed" messages.
25 *
26 * \param backend backend for cryptographic operations
27 * \param algo hash algorithm
28 * \param data message payload (data to be signed)
29 * \param signing certificate used for signing
30 * \return message digest
31 */
32ByteBuffer calculate_message_hash(Backend&, HashAlgorithm, const ByteBuffer& data, const CertificateView& signing);
33
34/**
35 * Determine the hash algorithm for a given key type.
36 * \see IEEE 1609.2 clause 5.3.1.2.2 rule a)
37 * \param key_type key type
38 * \return suitable hash algorithm
39 */
40HashAlgorithm specified_hash_algorithm(KeyType key_type);
41
42} // namespace v3
43} // namespace security
44} // namespace vanetza