Vanetza
 
Loading...
Searching...
No Matches
ecc_point.hpp
1#ifndef ECC_POINT_HPP_XCESTUEB
2#define ECC_POINT_HPP_XCESTUEB
3
4#include <vanetza/common/byte_buffer.hpp>
5#include <vanetza/security/ecc_point.hpp>
6#include <vanetza/security/v2/serialization.hpp>
7#include <cstdint>
8
9namespace vanetza
10{
11namespace security
12{
13namespace v2
14{
15
16/// forward declaration, see public_key.hpp
17enum class PublicKeyAlgorithm: uint8_t;
18
19/// EccPointType specified in TS 103 097 v1.2.1 in section 4.2.6
20enum class EccPointType : uint8_t
21{
22 X_Coordinate_Only = 0,
23 Compressed_Lsb_Y_0 = 2,
24 Compressed_Lsb_Y_1 = 3,
25 Uncompressed = 4
26};
27
28/**
29 * \brief Determines EccPointType to a given EccPoint
30 * \param ecc_point
31 * \return type
32 */
33EccPointType get_type(const EccPoint&);
34
35/**
36 * \brief Serializes an EccPoint into a binary archive
37 * \param ar to serialize in
38 * \param ecc_point to serialize
39 * \param pka Public key algorithm used for EccPoint
40 */
41void serialize(OutputArchive&, const EccPoint&, PublicKeyAlgorithm);
42
43/**
44 * \brief Deserializes an EccPoint from a binary archive
45 * \param ar with a serialized EccPoint at the beginning,
46 * \param ecc_point to deserialize
47 * \param pka to get field size of the encoded coordinates
48 */
49void deserialize(InputArchive&, EccPoint&, PublicKeyAlgorithm);
50
51/**
52 * \brief Calculates size of an EccPoint
53 * \param ecc_point
54 * \return size_t containing the number of octets needed to serialize the EccPoint
55 */
56size_t get_size(const EccPoint&);
57
58} // namespace v2
59} // namespace security
60} // namespace vanetza
61
62#endif /* ECC_POINT_HPP_XCESTUEB */