certificate_db.h
Go to the documentation of this file.
75 };
97 bool find(std::string const & key, const Security::CertPointer &expectedOrig, Security::CertPointer & cert, Security::PrivateKeyPointer & pkey);
101 bool addCertAndPrivateKey(std::string const & useKey, const Security::CertPointer & cert, const Security::PrivateKeyPointer & pkey, const Security::CertPointer &orig);
119 bool pure_find(std::string const & key, const Security::CertPointer & expectedOrig, Security::CertPointer & cert, Security::PrivateKeyPointer & pkey);
129 static bool WriteEntry(const std::string &filename, const Security::CertPointer & cert, const Security::PrivateKeyPointer & pkey, const Security::CertPointer &orig);
132 static bool ReadEntry(std::string filename, Security::CertPointer & cert, Security::PrivateKeyPointer & pkey, Security::CertPointer &orig);
const std::string size_full
Full path of the file to store the db size.
Definition: certificate_db.h:179
static const std::string cert_dir
Base name of the directory to store the certs.
Definition: certificate_db.h:171
static void sq_TXT_DB_delete(TXT_DB *db, const char **row)
Removes the first matching row from TXT_DB. Ignores failures.
Definition: certificate_db.cc:174
static bool ReadEntry(std::string filename, Security::CertPointer &cert, Security::PrivateKeyPointer &pkey, Security::CertPointer &orig)
loads a db entry from the file
Definition: certificate_db.cc:646
A wrapper for OpenSSL database row of TXT_DB database.
Definition: certificate_db.h:79
void addSize(std::string const &filename)
Increase db size by the given file size and update size_file.
Definition: certificate_db.cc:454
static const size_t min_db_size
Min size of disk db. If real size < min_db_size the db will be disabled.
Definition: certificate_db.h:174
void setValue(size_t number, char const *value)
Set cell's value in row.
Definition: certificate_db.cc:156
bool addCertAndPrivateKey(std::string const &useKey, const Security::CertPointer &cert, const Security::PrivateKeyPointer &pkey, const Security::CertPointer &orig)
Save certificate to disk.
Definition: certificate_db.cc:284
static void sq_TXT_DB_delete_row(TXT_DB *db, int idx)
Remove the row on position idx from TXT_DB. Ignores failures.
Definition: certificate_db.cc:198
Definition: certificate_db.h:65
void subSize(std::string const &filename)
Decrease db size by the given file size and update size_file.
Definition: certificate_db.cc:461
static int index_name_cmp(const char **a, const char **b)
Callback compare function for names. Used to create TXT_DB index of names..
Definition: certificate_db.cc:244
static IMPLEMENT_LHASH_HASH_FN(index_serial_hash, const char **) static IMPLEMENT_LHASH_COMP_FN(index_serial_cmp
Locker(Lock &lock, const char *aFileName, int lineNo)
locks the lock if the lock was unlocked
Definition: certificate_db.cc:99
Definition: Xaction.cc:48
static void Create(std::string const &db_path)
Create and initialize a database under the db_path.
Definition: certificate_db.cc:368
static bool WriteEntry(const std::string &filename, const Security::CertPointer &cert, const Security::PrivateKeyPointer &pkey, const Security::CertPointer &orig)
stores the db entry into a file
Definition: certificate_db.cc:631
std::unique_ptr< TXT_DB, HardFun< void, TXT_DB *, &TXT_DB_free > > TXT_DB_Pointer
Definition: gadgets.h:56
static int index_serial_cmp(const char **a, const char **b)
Callback compare function for serials. Used to create TXT_DB index of serials.
Definition: certificate_db.cc:233
static unsigned long index_name_hash(const char **a)
Callback hash function for names. Used to create TXT_DB index of names..
Definition: certificate_db.cc:240
bool find(std::string const &key, const Security::CertPointer &expectedOrig, Security::CertPointer &cert, Security::PrivateKeyPointer &pkey)
finds matching generated certificate and its private key
Definition: certificate_db.cc:263
void deleteRow(const char **row, int rowIndex)
Delete a row from TXT_DB.
Definition: certificate_db.cc:533
static void Check(std::string const &db_path, size_t max_db_size, size_t fs_block_size)
Check the database stored under the db_path.
Definition: certificate_db.cc:392
bool purgeCert(std::string const &key)
Delete a certificate from database.
Definition: certificate_db.cc:270
const std::string cert_full
Full path of the directory to store the certs.
Definition: certificate_db.h:178
static const char **static const char **static const std::string db_file
Base name of the database index file.
Definition: certificate_db.h:170
static unsigned long index_serial_hash(const char **a)
Callback hash function for serials. Used to create TXT_DB index of serials.
Definition: certificate_db.cc:226
bool pure_find(std::string const &key, const Security::CertPointer &expectedOrig, Security::CertPointer &cert, Security::PrivateKeyPointer &pkey)
Only find certificate in current db and return it.
Definition: certificate_db.cc:423
CertificateDb(std::string const &db_path, size_t aMax_db_size, size_t aFs_block_size)
Definition: certificate_db.cc:252
size_t getFileSize(std::string const &filename)
get file size on disk.
Definition: certificate_db.cc:484