security_cache.hh
Go to the documentation of this file.
#pragma once
#include <string>
#include <memory>
#include <vector>
#include <map>
#include "security_db_record.hh"
class OCTETSTRING;
class CHARSTRING;
class security_cache {
protected:
// TODO Enforce with const security_cache_record, and const std::string
std::map<std::string, std::unique_ptr<security_db_record> > _certificates;
std::map<std::vector<unsigned char>, std::string> _hashed_id8s;
public:
security_cache();
virtual ~security_cache();
int get_certificate_id(const OCTETSTRING& p_hashed_id8, std::string& p_certificate_id) const;
int get_certificate(const std::string& p_certificate_id, OCTETSTRING& p_certificate) const;
int get_certificate(const std::string& p_certificate_id, IEEE1609dot2::CertificateBase& p_certificate) const;
int get_issuer(const std::string& p_certificate_id, OCTETSTRING& p_hashed_id_issuer) const;
int get_hashed_id(const std::string& p_certificate_id, OCTETSTRING& p_hashed_id) const;
int get_private_key(const std::string& p_certificate_id, OCTETSTRING& p_private_key) const;
int get_public_keys(const std::string& p_certificate_id, OCTETSTRING& p_public_key_x, OCTETSTRING& p_public_key_y) const;
int get_private_enc_key(const std::string& p_certificate_id, OCTETSTRING& p_private_enc_key) const;
int get_public_enc_keys(const std::string& p_certificate_id, OCTETSTRING& p_public_enc_key_x, OCTETSTRING& p_public_enc_key_y) const;
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);
//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);
virtual int clear();
void dump() const;
}; // 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