// 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;
signlog << "FINE: Signed" << std::endl;
std::shared_ptr<SignedCertificate> output = c.sign( ca->caKey, cert->md );
signlog << "FINE: all went well" << std::endl;
- signlog << "FINE: crt went to: " << writeBackFile( num, output->certificate, ca->path ) << std::endl;
+ std::string fn = writeBackFile( num, output->certificate, ca->path );
+
+ if( fn.empty() ) {
+ signlog << "ERROR: failed to get filename for storage of signed certificate." << std::endl;
+ throw "Storage location could not be determined";
+ }
+
+ signlog << "FINE: crt went to: " << fn << std::endl;
output->ca_name = ca->name;
output->log = signlog.str();
return output;