Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2245)

Unified Diff: net/der/parse_values.cc

Issue 2091103002: Add CheckOCSPDateValid() to net/cert/internal (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add tests for ConvertBaseUTCTime Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/der/parse_values.cc
diff --git a/net/der/parse_values.cc b/net/der/parse_values.cc
index 903daafdc0d7221e29607486f46e6064c795564e..93f6650d81005cba4271c18668fbd8b721196a04 100644
--- a/net/der/parse_values.cc
+++ b/net/der/parse_values.cc
@@ -6,6 +6,7 @@
#include "base/logging.h"
#include "base/numerics/safe_math.h"
+#include "base/time/time.h"
#include "net/der/parse_values.h"
namespace net {
@@ -383,6 +384,21 @@ bool ParseGeneralizedTime(const Input& in, GeneralizedTime* value) {
return true;
}
+der::GeneralizedTime ConvertBaseUTCTime(const base::Time& time) {
+ base::Time::Exploded exploded;
+ time.UTCExplode(&exploded);
+
+ der::GeneralizedTime result;
+ result.year = exploded.year;
+ result.month = exploded.month;
+ result.day = exploded.day_of_month;
+ result.hours = exploded.hour;
+ result.minutes = exploded.minute;
+ result.seconds = exploded.second;
+ DCHECK(ValidateGeneralizedTime(result));
Ryan Sleevi 2016/06/28 17:33:30 Why DCHECK here? A DCHECK signals that there's a c
dadrian 2016/06/28 19:15:27 Presumably we should handle this the same way expl
dadrian 2016/06/29 22:54:02 Nvm, just removed the DCHECK().
+ return result;
+}
+
} // namespace der
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698