prof.id = std::stoi( id );
prof.eku = map->at( "eku" );
prof.ku = map->at( "ku" );
+ prof.maxValidity = std::stoi( map->at( "days" ) ) * /* DAYS */24 * 60 * 60;
std::string cas = map->at( "ca" );
// Construct the Certificate
X509Cert c = X509Cert();
- std::shared_ptr<X509> retsh = std::shared_ptr<X509>( X509_new(), X509_free );
- X509* ret = retsh.get();
-
- if( !ret ) {
- throw "Creating X509 failed.";
- }
X509_NAME* subjectP = X509_NAME_new();
to = from + /*2 Years */ 2 * 365 * 24 * 60 * 60;
}
- time_t limit = /*2 Years (max possible) */ 2 * 366 * 24 * 60 * 60;
+ time_t limit = prof.maxValidity;
if( to - from > limit || to - from < 0 ) {
to = from + limit;
#include <string>
#include <vector>
#include <cinttypes>
+#include <ctime>
#include <openssl/ssl.h>
std::string ku;
std::vector<std::shared_ptr<CAConfig>> ca;
+ std::time_t maxValidity;
std::shared_ptr<CAConfig> getCA() {
for( auto it = ca.rbegin(); it != ca.rend(); it++ ) {
if( X509_cmp_current_time( ( *it )->notBefore.get() ) < 0 ) {
ca=unassured
eku=
ku=
+days=10
EOF
mkdir -p ca/unassured