OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "net/http/transport_security_state.h" | 5 #include "net/http/transport_security_state.h" |
6 | 6 |
7 #if defined(USE_OPENSSL) | 7 #if defined(USE_OPENSSL) |
8 #include <openssl/ecdsa.h> | 8 #include <openssl/ecdsa.h> |
9 #include <openssl/ssl.h> | 9 #include <openssl/ssl.h> |
10 #else // !defined(USE_OPENSSL) | 10 #else // !defined(USE_OPENSSL) |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 } | 630 } |
631 | 631 |
632 bool TransportSecurityState::AddHPKPHeader(const std::string& host, | 632 bool TransportSecurityState::AddHPKPHeader(const std::string& host, |
633 const std::string& value, | 633 const std::string& value, |
634 const SSLInfo& ssl_info) { | 634 const SSLInfo& ssl_info) { |
635 base::Time now = base::Time::Now(); | 635 base::Time now = base::Time::Now(); |
636 TransportSecurityState::DomainState domain_state; | 636 TransportSecurityState::DomainState domain_state; |
637 if (ParseHPKPHeader(now, value, ssl_info.public_key_hashes, | 637 if (ParseHPKPHeader(now, value, ssl_info.public_key_hashes, |
638 &domain_state.dynamic_spki_hashes_expiry, | 638 &domain_state.dynamic_spki_hashes_expiry, |
639 &domain_state.dynamic_spki_hashes)) { | 639 &domain_state.dynamic_spki_hashes)) { |
640 domain_state.upgrade_mode = DomainState::MODE_DEFAULT; | |
641 domain_state.created = now; | 640 domain_state.created = now; |
642 EnableHost(host, domain_state); | 641 EnableHost(host, domain_state); |
643 return true; | 642 return true; |
644 } | 643 } |
645 return false; | 644 return false; |
646 } | 645 } |
647 | 646 |
648 bool TransportSecurityState::AddHSTS(const std::string& host, | 647 bool TransportSecurityState::AddHSTS(const std::string& host, |
649 const base::Time& expiry, | 648 const base::Time& expiry, |
650 bool include_subdomains) { | 649 bool include_subdomains) { |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 return true; | 844 return true; |
846 } | 845 } |
847 | 846 |
848 bool TransportSecurityState::DomainState::HasPublicKeyPins() const { | 847 bool TransportSecurityState::DomainState::HasPublicKeyPins() const { |
849 return static_spki_hashes.size() > 0 || | 848 return static_spki_hashes.size() > 0 || |
850 bad_static_spki_hashes.size() > 0 || | 849 bad_static_spki_hashes.size() > 0 || |
851 dynamic_spki_hashes.size() > 0; | 850 dynamic_spki_hashes.size() > 0; |
852 } | 851 } |
853 | 852 |
854 } // namespace | 853 } // namespace |
OLD | NEW |