Vanetza
Loading...
Searching...
No Matches
ecc_point.hpp
1#ifndef CFE4DC34_AD31_47E8_9EB2_1B98C6FB0887
2#define CFE4DC34_AD31_47E8_9EB2_1B98C6FB0887
3
4#include <vanetza/common/byte_buffer.hpp>
5#include <boost/variant/variant.hpp>
6
7namespace vanetza
8{
9namespace security
10{
11
12// forward declarations
13struct PublicKey;
14namespace ecdsa256 { struct PublicKey; }
15
16/// X_Coordinate_Only specified in TS 103 097 v1.2.1 in section 4.2.5
18{
19 ByteBuffer x;
20};
21
22/// Compressed_Lsb_Y_0 specified in TS 103 097 v1.2.1 in section 4.2.5
24{
25 ByteBuffer x;
26};
27
28/// Compressed_Lsb_Y_1 specified in TS 103 097 v1.2.1 in section 4.2.5
30{
31 ByteBuffer x;
32};
33
34/// Uncompressed specified in TS 103 097 v1.2.1 in section 4.2.5
36{
37 ByteBuffer x;
38 ByteBuffer y;
39};
40
41/// EccPoint specified in TS 103 097 v1.2.1 in section 4.2.5
42using EccPoint = boost::variant<
47>;
48
49/**
50 * \brief calculate byte length of ECC point structure
51 * \param ecc_point
52 * \return length in bytes
53 */
54std::size_t get_length(const EccPoint& ecc_point);
55
56/**
57 * \brief Convert EccPoint for signature calculation
58 * Uses ecc_point.x as relevant field for signatures.
59 *
60 * \param ecc_point
61 * \return binary representation of ECC point
62 */
63ByteBuffer convert_for_signing(const EccPoint& ecc_point);
64
65/**
66 * \brief Compressed ECC point from public key
67 * \param public_key
68 * \return compressed ECC point
69 */
70EccPoint compress_public_key(const PublicKey& public_key);
71EccPoint compress_public_key(const ecdsa256::PublicKey& public_key);
72
73} // namespace security
74} // namespace vanetza
75
76#endif /* CFE4DC34_AD31_47E8_9EB2_1B98C6FB0887 */
Compressed_Lsb_Y_0 specified in TS 103 097 v1.2.1 in section 4.2.5.
Definition ecc_point.hpp:24
Compressed_Lsb_Y_1 specified in TS 103 097 v1.2.1 in section 4.2.5.
Definition ecc_point.hpp:30
Uncompressed specified in TS 103 097 v1.2.1 in section 4.2.5.
Definition ecc_point.hpp:36
X_Coordinate_Only specified in TS 103 097 v1.2.1 in section 4.2.5.
Definition ecc_point.hpp:18