Vanetza
 
Loading...
Searching...
No Matches
signer_info.hpp
1#ifndef SIGNER_INFO_HPP_9K6GXK4R
2#define SIGNER_INFO_HPP_9K6GXK4R
3
4#include <vanetza/security/v2/basic_elements.hpp>
5#include <vanetza/security/v2/public_key.hpp>
6#include <boost/variant/recursive_wrapper.hpp>
7#include <boost/variant/variant.hpp>
8#include <cstddef>
9#include <cstdint>
10#include <list>
11
12namespace vanetza
13{
14namespace security
15{
16namespace v2
17{
18
19struct Certificate;
20
21/// described in TS 103 097 v1.2.1, section 4.2.11
22enum class SignerInfoType : uint8_t
23{
24 Self = 0, // nothing -> nullptr_t
25 Certificate_Digest_With_SHA256 = 1, // HashedId8
26 Certificate = 2, // Certificate
27 Certificate_Chain = 3, // std::list<Certificate>
28 Certificate_Digest_With_Other_Algorithm = 4 // CertificateDigestWithOtherAlgorithm
29};
30
31/// described in TS 103 097 v1.2.1, section 4.2.10
33{
34 PublicKeyAlgorithm algorithm;
35 HashedId8 digest;
36};
37
38/// described in TS 103 097 v1.2.1, section 4.2.10
39using SignerInfo = boost::variant<
40 std::nullptr_t,
41 HashedId8,
42 boost::recursive_wrapper<Certificate>,
43 std::list<Certificate>,
45>;
46
47/**
48 * \brief Determines SignerInfoType of SignerInfo
49 * \param SignerInfo
50 * \return SignerInfoType
51 */
52SignerInfoType get_type(const SignerInfo&);
53
54/**
55 * \brief Calculates size of an CertificateDigestWithOtherAlgorithm
56 * \param CertificateDigestWithOtherAlgorithm
57 * \return number of octets needed to serialize the CertificateDigestWithOtherAlgorithm
58 */
59size_t get_size(const CertificateDigestWithOtherAlgorithm&);
60
61/**
62 * \brief Calculates size of an SignerInfo
63 * \param SignerInfo
64 * \return number of octets needed to serialize the SignerInfo
65 */
66size_t get_size(const SignerInfo&);
67
68/**
69 * \brief Serializes an CertificateDigestWithOtherAlgorithm into a binary archive
70 */
72
73/**
74 * \brief Serializes an SignerInfo into a binary archive
75 */
76void serialize(OutputArchive&, const SignerInfo&);
77
78/**
79 * \brief Deserializes an CertificateDigestWithOtherAlgorithm from a binary archive
80 * \param archive with a CertificateDigestWithOtherAlgorithm at the beginning
81 * \param CertificateDigestWithOtherAlgorithm to deserialize
82 * \return size of the deserialized CertificateDigestWithOtherAlgorithm
83 */
85
86/**
87 * \brief Deserializes an SignerInfo from a binary archive
88 * \param archive with a SignerInfo at the beginning
89 * \param SignerInfo to deserialize
90 * \return size of the deserialized SignerInfo
91 */
92size_t deserialize(InputArchive&, SignerInfo&);
93
94} // namespace v2
95} // namespace security
96} // namespace vanetza
97
98#endif /* SIGNER_INFO_HPP_9K6GXK4R */
described in TS 103 097 v1.2.1, section 4.2.10
Definition: signer_info.hpp:33