ETSI STF525 / Internal Testing test suite This project provides an internal testing test suite and its associated Test Adapter/Codec

security_db_record.hh
Go to the documentation of this file.
1 #pragma once
2
3 #include <string>
4 #include <vector>
5
6 #include "security_ecc.hh"
7
8 namespace IEEE1609dot2 {
9 class CertificateBase;
10 };
11
16 class security_db_record {
17
18 ec_elliptic_curves _algorithm;
19 std::string _certificate_id;
20 std::vector<unsigned char> _certificate;
21 std::vector<unsigned char> _hashed_id_issuer;
22 std::vector<unsigned char> _hashed_id;
23 std::vector<unsigned char> _pr_key;
24 std::vector<unsigned char> _pu_key_x;
25 std::vector<unsigned char> _pu_key_y;
26 std::vector<unsigned char> _pr_enc_key;
27 std::vector<unsigned char> _pu_enc_key_x;
28 std::vector<unsigned char> _pu_enc_key_y;
29 bool _to_be_saved;
30 IEEE1609dot2::CertificateBase* _decoded_certificate;
31
32 public:
36 explicit security_db_record(): _algorithm{ec_elliptic_curves::nist_p_256}, _certificate_id(), _certificate(), _hashed_id_issuer(), _hashed_id(), _pr_key(), _pu_key_x(), _pu_key_y(), _pr_enc_key(), _pu_enc_key_x(), _pu_enc_key_y(), _to_be_saved(false), _decoded_certificate(nullptr) { };
37 security_db_record(const std::string& p_certificate_id, const std::vector<unsigned char>& p_certificate, const IEEE1609dot2::CertificateBase& p_decoded_certificate, const std::vector<unsigned char>& p_hashed_id_issuer, const std::vector<unsigned char>& p_hashed_id, const std::vector<unsigned char>& p_pr_key, const std::vector<unsigned char>& p_pu_key_x, const std::vector<unsigned char>& p_pu_key_y, const std::vector<unsigned char>& p_pr_enc_key, const std::vector<unsigned char>& p_pu_enc_key_x, const std::vector<unsigned char>& p_pu_enc_key_y, const bool p_to_be_saved = true);
38
42 ~security_db_record() { if (_decoded_certificate != nullptr) { delete _decoded_certificate; } };
43
44 const IEEE1609dot2::CertificateBase& decoded_certificate() const;
45
46 inline const std::string& certificate_id() const { return _certificate_id; };
47 inline const std::vector<unsigned char>& certificate() const { return _certificate; };
48 inline const std::vector<unsigned char>& hashed_id() const { return _hashed_id; };
49 inline const std::vector<unsigned char>& issuer() const { return _hashed_id_issuer; };
50 inline const std::vector<unsigned char>& private_key() const { return _pr_key; };
51 inline const std::vector<unsigned char>& public_key_x() const { return _pu_key_x; };
52 inline const std::vector<unsigned char>& public_key_y() const { return _pu_key_y; };
53 inline const std::vector<unsigned char>& private_enc_key() const { return _pr_enc_key; };
54 inline const std::vector<unsigned char>& public_enc_key_x() const { return _pu_enc_key_x; };
55 inline const std::vector<unsigned char>& public_enc_key_y() const { return _pu_enc_key_y; };
56 }; // End of class security_db_record
security_db_record::_to_be_saved
bool _to_be_saved
Definition: security_db_record.hh:29
security_db_record::_decoded_certificate
IEEE1609dot2::CertificateBase * _decoded_certificate
Definition: security_db_record.hh:30
security_db_record::_certificate
std::vector< unsigned char > _certificate
Definition: security_db_record.hh:20
security_db_record::_hashed_id_issuer
std::vector< unsigned char > _hashed_id_issuer
Definition: security_db_record.hh:21
security_db_record::_algorithm
ec_elliptic_curves _algorithm
Definition: security_db_record.hh:18
security_db_record::_pu_enc_key_y
std::vector< unsigned char > _pu_enc_key_y
Definition: security_db_record.hh:28
security_db_record::_pu_key_y
std::vector< unsigned char > _pu_key_y
Definition: security_db_record.hh:25
security_db_record::security_db_record
security_db_record()
Default private ctor.
Definition: security_db_record.hh:36
ec_elliptic_curves::nist_p_256
security_db_record::issuer
const std::vector< unsigned char > & issuer() const
Definition: security_db_record.hh:49
security_db_record::public_enc_key_y
const std::vector< unsigned char > & public_enc_key_y() const
Definition: security_db_record.hh:55
security_db_record::_pr_key
std::vector< unsigned char > _pr_key
Definition: security_db_record.hh:23
IEEE1609dot2
Definition: security_db_record.hh:8
security_db_record::~security_db_record
~security_db_record()
Default private dtor.
Definition: security_db_record.hh:42
security_db_record::public_key_y
const std::vector< unsigned char > & public_key_y() const
Definition: security_db_record.hh:52
security_db_record
This class provides security record description for security database.
Definition: security_db_record.hh:16
ec_elliptic_curves
ec_elliptic_curves
Definition: security_ecc.hh:23
security_ecc.hh
Header file for Elliptic Curve Cryptography.
security_db_record::_pu_enc_key_x
std::vector< unsigned char > _pu_enc_key_x
Definition: security_db_record.hh:27
security_db_record::_hashed_id
std::vector< unsigned char > _hashed_id
Definition: security_db_record.hh:22
security_db_record::public_key_x
const std::vector< unsigned char > & public_key_x() const
Definition: security_db_record.hh:51
security_db_record::certificate
const std::vector< unsigned char > & certificate() const
Definition: security_db_record.hh:47
security_db_record::_certificate_id
std::string _certificate_id
Definition: security_db_record.hh:19
security_db_record::hashed_id
const std::vector< unsigned char > & hashed_id() const
Definition: security_db_record.hh:48
security_db_record::_pu_key_x
std::vector< unsigned char > _pu_key_x
Definition: security_db_record.hh:24
security_db_record::certificate_id
const std::string & certificate_id() const
Definition: security_db_record.hh:46
security_db_record::public_enc_key_x
const std::vector< unsigned char > & public_enc_key_x() const
Definition: security_db_record.hh:54
security_db_record::_pr_enc_key
std::vector< unsigned char > _pr_enc_key
Definition: security_db_record.hh:26
security_db_record::private_enc_key
const std::vector< unsigned char > & private_enc_key() const
Definition: security_db_record.hh:53
security_db_record::private_key
const std::vector< unsigned char > & private_key() const
Definition: security_db_record.hh:50