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 */
ChunckPacket is a packet consisting of several memory chunks.
ByteBufferConvertible & operator[](OsiLayer ol)
ChunkPacket & merge(ChunkPacket &packet, OsiLayer from, OsiLayer to)
std::size_t size() const
const ByteBufferConvertible & layer(OsiLayer ol) const
const ByteBufferConvertible & operator[](OsiLayer ol) const
ByteBufferConvertible & layer(OsiLayer ol)
std::size_t size(OsiLayer from, OsiLayer to) const
ChunkPacket extract(OsiLayer from, OsiLayer to)
std::size_t size(OsiLayer from, OsiLayer to) const
buffer_const_range operator[](OsiLayer layer) const
std::size_t size() const
void set_boundary(OsiLayer, unsigned bytes)
const ByteBuffer & buffer() const
CohesivePacket(const ByteBuffer &buffer, OsiLayer layer)
void trim(OsiLayer from, unsigned bytes)
std::size_t size(OsiLayer single_layer) const
Result create(Args... args) const
Definition factory.hpp:45
value_type operator[](size_type) const
Definition byte_view.cpp:48
byte_view_range(ByteBuffer &&)
Definition byte_view.cpp:37
byte_view_range(const ByteBuffer::const_iterator &, const ByteBuffer::const_iterator &)
Definition byte_view.cpp:27
ByteBuffer::const_pointer data() const
Definition byte_view.cpp:42
void encode(units::Duration)
Definition lifetime.cpp:45
units::Duration decode() const
Definition lifetime.cpp:59
bool after(const Timestamp &other) const
Definition timestamp.cpp:76
bool before(const Timestamp &other) const
Definition timestamp.cpp:71
virtual boost::optional< Uncompressed > decompress_point(const EccPoint &ecc_point)=0
decompress a possibly compressed elliptic curve point
static CertificateValidity valid()
Create CertificateValidity signalling a valid certificate This method is equivalent to default constr...
CertificateValidity(CertificateInvalidReason reason)
CertificateInvalidReason reason() const
Get reason for certificate invalidity This call is only safe if reason is available,...
IntX specified in TS 103 097 v1.2.1, section 4.2.1.
Definition int_x.hpp:21
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
static DecapConfirm from(VerifyConfirm &&verify_confirm, const SecuredMessageView &msg_view)
Input data for decapsulating a secured message.
EcdsaSignature specified in TS 103 097 v1.2.1, section 4.2.9.
Definition signature.hpp:17
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
described in TS 103 097 v1.2.1 (2015-06), section 6.1
void add_permission(ItsAid aid, const ByteBuffer &ssp)
const ValidityRestriction * get_restriction(ValidityRestrictionType type) const
const SubjectAttribute * get_attribute(SubjectAttributeType type) const
void remove_attribute(SubjectAttributeType type)
const validity_restriction_type< T > * get_restriction() const
const subject_attribute_type< T > * get_attribute() const
void remove_restriction(ValidityRestrictionType type)
Payload specified in TS 103 097 v1.2.1, section 5.2.
Definition payload.hpp:28
SecuredMessage as specified in TS 103 097 v1.2.1, section 5.1.
HeaderField * header_field(HeaderFieldType)
const TrailerField * trailer_field(TrailerFieldType type) const
const HeaderField * header_field(HeaderFieldType type) const
TrailerField * trailer_field(TrailerFieldType)
described in TS 103 097 v1.2.1, section 6.2
ThreeDLocation specified in TS 103 097 v1.2.1, section 4.2.19.
Definition region.hpp:21
Time64WithStandardDeviation specified in TS 103 097 v1.2.1, section 4.2.16.
resolve type for matching HeaderFieldType
resolve type for matching TrailerFieldType