MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / ValidateDate

Function ValidateDate

extra/yassl/taocrypt/src/asn.cpp:122–141  ·  view source on GitHub ↗

Make sure before and after dates are valid

Source from the content-addressed store, hash-verified

120
121// Make sure before and after dates are valid
122bool ValidateDate(const byte* date, byte format, CertDecoder::DateType dt)
123{
124 tm certTime;
125
126 if (!ASN1_TIME_extract(date, format, &certTime))
127 return false;
128
129 time_t ltime = time(0);
130 tm* localTime = gmtime(&ltime);
131
132 if (dt == CertDecoder::BEFORE) {
133 if (*localTime < certTime)
134 return false;
135 }
136 else
137 if (*localTime > certTime)
138 return false;
139
140 return true;
141}
142
143
144class BadCertificate {};

Callers 1

GetDateMethod · 0.85

Calls 1

ASN1_TIME_extractFunction · 0.85

Tested by

no test coverage detected