10 #include <openssl/ssl.h>
12 #include "db/database.h"
20 std::shared_ptr<X509> ca;
21 std::shared_ptr<EVP_PKEY> caKey;
22 std::shared_ptr<ASN1_TIME> notBefore;
24 CAConfig( const std::string& name );
26 bool crlNeedsResign();
35 std::vector<std::shared_ptr<CAConfig>> ca;
36 std::time_t maxValidity;
37 std::shared_ptr<CAConfig> getCA() {
38 std::shared_ptr<CAConfig> min = nullptr;
40 for( auto it = ca.rbegin(); it != ca.rend(); it++ ) {
41 if( X509_cmp_current_time( ( *it )->notBefore.get() ) < 0 ) {
42 if( min != nullptr ) {
43 if( strcmp( min->name.c_str(), ( *it )->name.c_str() ) < 0 ) {
52 return min ? min : ca[0];
56 extern std::shared_ptr<int> ssl_lib_ref;
58 std::shared_ptr<X509> loadX509FromFile( const std::string& filename );
59 std::shared_ptr<EVP_PKEY> loadPkeyFromFile( const std::string& filename );
61 std::shared_ptr<SSL_CTX> generateSSLContext( bool server );
62 std::shared_ptr<BIO> openSerial( const std::string& name );
63 std::string timeToString( std::shared_ptr<ASN1_TIME> time );
65 void extractTimes( std::shared_ptr<X509> source, std::shared_ptr<SignedCertificate> cert );