OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_ | 5 #ifndef CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_ |
6 #define CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_ | 6 #define CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_ |
7 | 7 |
8 #include <string> | |
9 | |
8 #include "base/time/time.h" | 10 #include "base/time/time.h" |
9 #include "net/cert/x509_certificate.h" | 11 #include "net/cert/x509_certificate.h" |
12 #include "url/gurl.h" | |
10 | 13 |
11 // This class calculates the severity scores for the different type of SSL | 14 // This class calculates the severity scores for the different type of SSL |
12 // errors. | 15 // errors. |
16 // Note - commented functions still need to be impelemented. | |
13 class SSLErrorClassification { | 17 class SSLErrorClassification { |
14 public: | 18 public: |
15 SSLErrorClassification(base::Time current_time, | 19 SSLErrorClassification(base::Time current_time, |
16 const net::X509Certificate& cert); | 20 const::GURL& url, |
21 const::net::X509Certificate& cert); | |
17 ~SSLErrorClassification(); | 22 ~SSLErrorClassification(); |
18 | 23 |
19 // This method checks whether the user clock is in the past or not. | 24 // This method checks whether the system time is in the past. |
20 static bool IsUserClockInThePast(base::Time time_now); | 25 static bool IsUserClockInThePast(base::Time time_now); |
21 | 26 |
22 // This method checks whether the system time is too far in the future or | 27 // This method checks whether the system time is too far in the future or |
23 // the user is using a version of Chrome which is more than 1 year old. | 28 // the user is using a version of Chrome which is more than 1 year old. |
24 static bool IsUserClockInTheFuture(base::Time time_now); | 29 static bool IsUserClockInTheFuture(base::Time time_now); |
25 | 30 |
26 // A method which calculates the severity score when the ssl error is | 31 // A method which calculates the severity score when the ssl error is |
27 // CERT_DATE_INVALID. | 32 // CERT_DATE_INVALID. |
28 float InvalidDateSeverityScore() const; | 33 float InvalidDateSeverityScore() const; |
29 | 34 |
35 // A method which calculates the severity score when the ssl error is | |
36 // CERT_COMMON_NAME_INVALID. | |
37 float InvalidCommonNameSeverityScore() const; | |
38 | |
39 // A method which calculates the severity score when the | |
40 // ssl error is CERT_AUTHORITY_INVALID. | |
41 // float InvalidAuthoritySeverityScore(); | |
felt
2014/07/15 00:52:44
Please don't include commented-out methods here, j
radhikabhar
2014/07/15 17:34:09
Done.
| |
42 | |
30 static void RecordUMAStatistics(bool overridable); | 43 static void RecordUMAStatistics(bool overridable); |
31 base::TimeDelta TimePassedSinceExpiry() const; | 44 base::TimeDelta TimePassedSinceExpiry() const; |
32 | 45 |
33 private: | 46 private: |
34 FRIEND_TEST_ALL_PREFIXES(SSLErrorClassification, TestDateInvalidScore); | 47 FRIEND_TEST_ALL_PREFIXES(SSLErrorClassification, TestDateInvalidScore); |
48 FRIEND_TEST_ALL_PREFIXES(SSLErrorClassification, TestNameMismatch); | |
35 | 49 |
50 bool IsWWWDifference() const; | |
felt
2014/07/15 00:52:44
Can you either give these more descriptive names o
radhikabhar
2014/07/15 17:34:09
Done.
| |
51 bool IsRegisteredDomainMatch() const; | |
52 bool IsRegisteredDomainInverseMatch() const; | |
53 bool IsHostNameTooBroad() const; | |
54 // bool IsCDNError(); | |
55 bool IsSelfSigned() const; | |
56 // bool IsIntermediateCertificateIssues(); | |
57 | |
58 float CalculateScoreCheckEnvironment() const; | |
59 // float CalculateScoreCheckWebsiteSettings(): | |
36 float CalculateScoreTimePassedSinceExpiry() const; | 60 float CalculateScoreTimePassedSinceExpiry() const; |
37 | 61 |
38 // This stores the current time. | 62 // This stores the current time. |
39 base::Time current_time_; | 63 base::Time current_time_; |
40 | 64 |
65 const GURL request_url_; | |
66 | |
41 // This stores the certificate. | 67 // This stores the certificate. |
42 const net::X509Certificate& cert_; | 68 const net::X509Certificate& cert_; |
43 }; | 69 }; |
44 | 70 |
45 #endif // CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_ | 71 #endif // CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_ |
OLD | NEW |