9 #include <openssl/ssl.h>
11 #include "db/database.h"
19 std::shared_ptr<X509> ca;
20 std::shared_ptr<EVP_PKEY> caKey;
21 std::shared_ptr<ASN1_TIME> notBefore;
23 CAConfig( const std::string& name );
25 bool crlNeedsResign();
34 std::vector<std::shared_ptr<CAConfig>> ca;
35 std::time_t maxValidity;
36 std::shared_ptr<CAConfig> getCA() {
37 std::shared_ptr<CAConfig> min = nullptr;
38 for( auto it = ca.rbegin(); it != ca.rend(); it++ ) {
39 if( X509_cmp_current_time( ( *it )->notBefore.get() ) < 0) {
41 if(strcmp(min->name.c_str(), (*it)->name.c_str()) < 0){
50 return min == nullptr ? ca[0] : min;
54 extern std::shared_ptr<int> ssl_lib_ref;
56 std::shared_ptr<X509> loadX509FromFile( const std::string& filename );
57 std::shared_ptr<EVP_PKEY> loadPkeyFromFile( const std::string& filename );
59 std::shared_ptr<SSL_CTX> generateSSLContext( bool server );
60 std::shared_ptr<BIO> openSerial( const std::string& name );
61 std::string timeToString( std::shared_ptr<ASN1_TIME> time );
63 void extractTimes( std::shared_ptr<X509> source, std::shared_ptr<SignedCertificate> cert );