Vanetza
Loading...
Searching...
No Matches
naive_certificate_provider.hpp
1#ifndef NAIVE_CERTIFICATE_PROVIDER_HPP_MTULFLKX
2#define NAIVE_CERTIFICATE_PROVIDER_HPP_MTULFLKX
3
4#include <memory>
5#include <string>
6#include <vanetza/common/runtime.hpp>
7#include <vanetza/security/backend.hpp>
8#include <vanetza/security/v2/certificate.hpp>
9#include <vanetza/security/v2/certificate_provider.hpp>
10
11namespace vanetza
12{
13namespace security
14{
15namespace v2
16{
17
18/**
19 * \brief A very simplistic certificate provider
20 *
21 * This certificate provider signs its certificates with a randomly generated root certificate. This means the
22 * signatures produced based on this certificate provider can't be verified by other parties.
23 *
24 * It's intended for experimenting with secured messages without validating signatures.
25 */
27{
28public:
29 NaiveCertificateProvider(const Runtime&);
30
31 /**
32 * \brief get own certificate for signing
33 * \return own certificate
34 */
35 const Certificate& own_certificate() override;
36
37 /**
38 * Get own certificate chain, excluding the leaf certificate and root CA
39 * \return own certificate chain
40 */
41 std::list<Certificate> own_chain() override;
42
43 /**
44 * \brief get own private key
45 * \return private key
46 */
47 const ecdsa256::PrivateKey& own_private_key() override;
48
49 /**
50 * \brief get ticket signer certificate (same for all instances)
51 * \return signing authorization authority certificate
52 */
54
55 /**
56 * \brief get root certificate (same for all instances)
57 * \return signing root certificate
58 */
60
61 /**
62 * \brief generate an authorization ticket
63 * \return generated certificate
64 */
66
67 /**
68 * \brief sign an authorization ticket
69 * \param certificate certificate to sign
70 */
71 void sign_authorization_ticket(Certificate& certificate);
72
73private:
74 /**
75 * \brief get root key (same for all instances)
76 * \return root key
77 */
78 const ecdsa256::KeyPair& aa_key_pair();
79
80 /**
81 * \brief get root key (same for all instances)
82 * \return root key
83 */
84 const ecdsa256::KeyPair& root_key_pair();
85
86 /**
87 * \brief generate a authorization authority certificate
88 *
89 * \return generated certificate
90 */
91 Certificate generate_aa_certificate(const std::string& subject_name);
92
93 /**
94 * \brief generate a root certificate
95 *
96 * \return generated certificate
97 */
98 Certificate generate_root_certificate(const std::string& subject_name);
99
100 std::unique_ptr<Backend> m_crypto_backend;
101 const Runtime& m_runtime;
102 const ecdsa256::KeyPair m_own_key_pair;
103 Certificate m_own_certificate;
104};
105
106} // namespace v2
107} // namespace security
108} // namespace vanetza
109
110#endif /* NAIVE_CERTIFICATE_PROVIDER_HPP_MTULFLKX */
const Certificate & own_certificate() override
get own certificate for signing
Certificate generate_authorization_ticket()
generate an authorization ticket
const ecdsa256::KeyPair & aa_key_pair()
get root key (same for all instances)
void sign_authorization_ticket(Certificate &certificate)
sign an authorization ticket
const ecdsa256::KeyPair & root_key_pair()
get root key (same for all instances)
Certificate generate_aa_certificate(const std::string &subject_name)
generate a authorization authority certificate
const ecdsa256::PrivateKey & own_private_key() override
get own private key
const Certificate & aa_certificate()
get ticket signer certificate (same for all instances)
const Certificate & root_certificate()
get root certificate (same for all instances)
Certificate generate_root_certificate(const std::string &subject_name)
generate a root certificate
Uncompressed specified in TS 103 097 v1.2.1 in section 4.2.5.
Definition ecc_point.hpp:36
described in TS 103 097 v1.2.1 (2015-06), section 6.1
void add_permission(ItsAid aid, const ByteBuffer &ssp)
SubjectAssurance specified in TS 103 097 v1.2.1 in section 6.6 and 7.4.1.
VerificationKey specified in TS 103 097 v1.2.1, section 6.4.
ecdsa_nistp256_with_sha256 specified in TS 103 097 v1.2.1, section 4.2.4