|
23 | 23 | #include "Conf.h" |
24 | 24 | #include "crypto/Digest.h" |
25 | 25 | #include "crypto/OCSP.h" |
| 26 | +#include "crypto/TS.h" |
26 | 27 | #include "crypto/X509Cert.h" |
27 | 28 | #include "crypto/X509CertStore.h" |
28 | 29 | #include "util/DateTime.h" |
@@ -86,7 +87,7 @@ X509Cert SignatureXAdES_LT::OCSPCertificate() const |
86 | 87 | */ |
87 | 88 | string SignatureXAdES_LT::OCSPProducedAt() const |
88 | 89 | { |
89 | | - return util::date::ASN1TimeToXSD(getOCSPResponseValue().producedAt()); |
| 90 | + return util::date::to_string(getOCSPResponseValue().producedAt()); |
90 | 91 | } |
91 | 92 |
|
92 | 93 | string SignatureXAdES_LT::trustedSigningTime() const |
@@ -167,24 +168,26 @@ void SignatureXAdES_LT::validate(const std::string &policy) const |
167 | 168 | } |
168 | 169 | else |
169 | 170 | { |
170 | | - struct tm producedAt = util::date::ASN1TimeToTM(ocsp.producedAt()); |
| 171 | + tm producedAt = ocsp.producedAt(); |
| 172 | + string producedAt_s = util::date::to_string(producedAt); |
171 | 173 | time_t producedAt_t = util::date::mkgmtime(producedAt); |
172 | | - time_t timeT = util::date::string2time_t(TimeStampTime()); |
173 | | - if(timeT > producedAt_t) |
| 174 | + tm timeStampTime = TimeStamp().time(); |
| 175 | + time_t timeStampTime_t = util::date::mkgmtime(timeStampTime); |
| 176 | + if(timeStampTime_t > producedAt_t) |
174 | 177 | { |
175 | 178 | /* |
176 | 179 | * ETSI TS 103 171 V2.1.1 (2012-03) |
177 | 180 | * 8 Requirements for LT-Level Conformance |
178 | 181 | * This clause defines those requirements that XAdES signatures conformant to T-Level, have to fulfil to also be |
179 | 182 | * conformant to LT-Level. |
180 | 183 | */ |
181 | | - Exception e(EXCEPTION_PARAMS("TimeStamp time is greater than OCSP producedAt TS: %s OCSP: %s", TimeStampTime().c_str(), ocsp.producedAt().c_str())); |
| 184 | + Exception e(EXCEPTION_PARAMS("TimeStamp time is greater than OCSP producedAt TS: %s OCSP: %s", TimeStampTime().c_str(), producedAt_s.c_str())); |
182 | 185 | e.setCode(Exception::OCSPBeforeTimeStamp); |
183 | 186 | exception.addCause(e); |
184 | 187 | } |
185 | | - if((producedAt_t - timeT > 15 * 60) && !Exception::hasWarningIgnore(Exception::ProducedATLateWarning)) |
| 188 | + if((producedAt_t - timeStampTime_t > 15 * 60) && !Exception::hasWarningIgnore(Exception::ProducedATLateWarning)) |
186 | 189 | { |
187 | | - Exception e(EXCEPTION_PARAMS("TimeStamp time and OCSP producedAt are over 15m off TS: %s OCSP: %s", TimeStampTime().c_str(), ocsp.producedAt().c_str())); |
| 190 | + Exception e(EXCEPTION_PARAMS("TimeStamp time and OCSP producedAt are over 15m off TS: %s OCSP: %s", TimeStampTime().c_str(), producedAt_s.c_str())); |
188 | 191 | e.setCode(Exception::ProducedATLateWarning); |
189 | 192 | exception.addCause(e); |
190 | 193 | } |
@@ -267,7 +270,7 @@ void SignatureXAdES_LT::addCertificateValue(const string& certId, const X509Cert |
267 | 270 |
|
268 | 271 | void SignatureXAdES_LT::addOCSPValue(const string &id, const OCSP &ocsp) |
269 | 272 | { |
270 | | - DEBUG("SignatureXAdES_LT::addOCSPValue(%s, %s)", id.c_str(), ocsp.producedAt().c_str()); |
| 273 | + DEBUG("SignatureXAdES_LT::addOCSPValue(%s, %s)", id.c_str(), util::date::to_string(ocsp.producedAt()).c_str()); |
271 | 274 |
|
272 | 275 | createUnsignedSignatureProperties(); |
273 | 276 |
|
|
0 commit comments