Skip to content

Commit

Permalink
Verify OCSP certificate by producedat time
Browse files Browse the repository at this point in the history
IB-3995
  • Loading branch information
metsma committed Jun 15, 2015
1 parent 9897b10 commit a7a7f5a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/crypto/OCSP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "Conf.h"
#include "crypto/OpenSSLHelpers.h"
#include "crypto/X509CertStore.h"
#include "util/DateTime.h"

#include <algorithm>

Expand Down Expand Up @@ -442,6 +443,10 @@ void OCSP::verifyResponse(const X509Cert &cert) const
}
});

tm t = util::date::ASN1TimeToTM(producedAt());
X509_VERIFY_PARAM_set_time(store->param, util::date::mkgmtime(t));
X509_STORE_set_flags(store.get(), X509_V_FLAG_USE_CHECK_TIME);

//X509_STORE_set_trust(store.get(), X509_TRUST_TRUSTED);
//X509_STORE_set_purpose(store.get(), NID_OCSP_sign);

Expand Down
4 changes: 4 additions & 0 deletions src/util/DateTime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ time_t digidoc::util::date::string2time_t(const string &time)
,0
#endif
};
return mkgmtime(t);
}

time_t digidoc::util::date::mkgmtime(struct tm &t)
{
#ifdef _WIN32
return _mkgmtime(&t);
#else
Expand Down
1 change: 1 addition & 0 deletions src/util/DateTime.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ namespace digidoc
{
namespace date
{
time_t mkgmtime(struct tm &t);
tm ASN1TimeToTM(const std::string &date);
std::string xsd2string(const xml_schema::DateTime &time);
time_t string2time_t(const std::string &time);
Expand Down

0 comments on commit a7a7f5a

Please sign in to comment.