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

security_cache.hh
Go to the documentation of this file.
1 #pragma once
2
3 #include <string>
4 #include <memory>
5 #include <vector>
6 #include <map>
7
8 #include "security_db_record.hh"
9
10 class OCTETSTRING;
11 class CHARSTRING;
12
17 class security_cache {
18 protected:
19 // TODO Enforce with const security_cache_record, and const std::string
20 std::map<std::string, std::unique_ptr<security_db_record> > _certificates;
21 std::map<std::vector<unsigned char>, std::string> _hashed_id8s;
22
23 public:
27 security_cache();
31 virtual ~security_cache();
32
33 int get_certificate_id(const OCTETSTRING& p_hashed_id8, std::string& p_certificate_id) const;
34 int get_certificate(const std::string& p_certificate_id, OCTETSTRING& p_certificate) const;
35 int get_certificate(const std::string& p_certificate_id, IEEE1609dot2::CertificateBase& p_certificate) const;
36 int get_issuer(const std::string& p_certificate_id, OCTETSTRING& p_hashed_id_issuer) const;
37 int get_hashed_id(const std::string& p_certificate_id, OCTETSTRING& p_hashed_id) const;
38 int get_private_key(const std::string& p_certificate_id, OCTETSTRING& p_private_key) const;
39 int get_public_keys(const std::string& p_certificate_id, OCTETSTRING& p_public_key_x, OCTETSTRING& p_public_key_y) const;
40 int get_private_enc_key(const std::string& p_certificate_id, OCTETSTRING& p_private_enc_key) const;
41 int get_public_enc_keys(const std::string& p_certificate_id, OCTETSTRING& p_public_enc_key_x, OCTETSTRING& p_public_enc_key_y) const;
42
43 virtual int store_certificate(const CHARSTRING& p_cert_id, const OCTETSTRING& p_cert, const OCTETSTRING& p_private_key, const OCTETSTRING& p_public_key_x, const OCTETSTRING& p_public_key_y, const OCTETSTRING& p_hashid8, const OCTETSTRING& p_issuer, const OCTETSTRING& p_private_enc_key, const OCTETSTRING& p_public_enc_key_x, const OCTETSTRING& p_public_enc_key_y);
44
45 //virtual int store_certificate(const std::sring& p_cert_id, const std::vector<unsigned char>& p_cert, const std::vector<unsigned char>& p_private_key, const std::vector<unsigned char>& p_public_key_x, const std::vector<unsigned char>& p_public_key_y, const std::vector<unsigned char>& p_hashid8, const OCTETSTRING& p_issuer);
46 virtual int clear();
47
48 void dump() const;
49
50 }; // End of class security_cache
security_cache::_hashed_id8s
std::map< std::vector< unsigned char >, std::string > _hashed_id8s
List of the certificates indexed by the certificate identifier.
Definition: security_cache.hh:21
security_cache::get_certificate_id
int get_certificate_id(const OCTETSTRING &p_hashed_id8, std::string &p_certificate_id) const
Definition: security_cache.cc:29
security_cache::get_issuer
int get_issuer(const std::string &p_certificate_id, OCTETSTRING &p_hashed_id_issuer) const
Definition: security_cache.cc:71
security_cache::_certificates
std::map< std::string, std::unique_ptr< security_db_record > > _certificates
Definition: security_cache.hh:20
security_db_record.hh
security_cache::get_public_enc_keys
int get_public_enc_keys(const std::string &p_certificate_id, OCTETSTRING &p_public_enc_key_x, OCTETSTRING &p_public_enc_key_y) const
Definition: security_cache.cc:143
security_cache::get_private_key
int get_private_key(const std::string &p_certificate_id, OCTETSTRING &p_private_key) const
Definition: security_cache.cc:99
security_cache
This class provides security record description for in memory security database. In memory mens there...
Definition: security_cache.hh:17
security_cache::store_certificate
virtual int store_certificate(const CHARSTRING &p_cert_id, const OCTETSTRING &p_cert, const OCTETSTRING &p_private_key, const OCTETSTRING &p_public_key_x, const OCTETSTRING &p_public_key_y, const OCTETSTRING &p_hashid8, const OCTETSTRING &p_issuer, const OCTETSTRING &p_private_enc_key, const OCTETSTRING &p_public_enc_key_x, const OCTETSTRING &p_public_enc_key_y)
Definition: security_cache.cc:159
security_cache::dump
void dump() const
Definition: security_cache.cc:216
security_cache::~security_cache
virtual ~security_cache()
Default private dtor.
Definition: security_cache.cc:16
security_cache::get_certificate
int get_certificate(const std::string &p_certificate_id, OCTETSTRING &p_certificate) const
Definition: security_cache.cc:43
security_cache::clear
virtual int clear()
Definition: security_cache.cc:21
security_cache::get_private_enc_key
int get_private_enc_key(const std::string &p_certificate_id, OCTETSTRING &p_private_enc_key) const
Definition: security_cache.cc:129
security_cache::security_cache
security_cache()
List of the certificates indexed by the HashedId8.
Definition: security_cache.cc:12
security_cache::get_public_keys
int get_public_keys(const std::string &p_certificate_id, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y) const
Definition: security_cache.cc:113
security_cache::get_hashed_id
int get_hashed_id(const std::string &p_certificate_id, OCTETSTRING &p_hashed_id) const
Definition: security_cache.cc:85