Vanetza
 
Loading...
Searching...
No Matches
ecdsa256.hpp
1#ifndef ECDSA256_HPP_IOXLJFVZ
2#define ECDSA256_HPP_IOXLJFVZ
3
4#include <array>
5#include <cstdint>
6#include <functional>
7
8namespace vanetza
9{
10namespace security
11{
12
13// forward declaration
14struct Uncompressed;
15
16namespace ecdsa256
17{
18
19constexpr unsigned digest_octets = 32;
20
22{
23 std::array<uint8_t, digest_octets> x;
24 std::array<uint8_t, digest_octets> y;
25};
26
27bool operator==(const PublicKey& lhs, const PublicKey& rhs);
28bool operator!=(const PublicKey& lhs, const PublicKey& rhs);
29
30
32{
33 std::array<uint8_t, digest_octets> key;
34};
35
36bool operator==(const PrivateKey& lhs, const PrivateKey& rhs);
37bool operator!=(const PrivateKey& lhs, const PrivateKey& rhs);
38
39
40struct KeyPair
41{
42 PrivateKey private_key;
43 PublicKey public_key;
44};
45
46/**
47 * Create generic public key from uncompressed ECC point
48 * \param unc Uncompressed ECC point
49 * \return public key
50 */
51PublicKey create_public_key(const Uncompressed&);
52
53} // namespace ecdsa256
54} // namespace security
55} // namespace vanetza
56
57
58namespace std
59{
60
61template<>
62struct hash<vanetza::security::ecdsa256::PublicKey>
63{
64 size_t operator()(const vanetza::security::ecdsa256::PublicKey&) const;
65};
66
67template<>
68struct hash<vanetza::security::ecdsa256::PrivateKey>
69{
70 size_t operator()(const vanetza::security::ecdsa256::PrivateKey&) const;
71};
72
73} // namespace std
74
75#endif /* ECDSA256_HPP_IOXLJFVZ */
76
STL namespace.
Uncompressed specified in TS 103 097 v1.2.1 in section 4.2.5.
Definition: ecc_point.hpp:32