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 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 TransportSecurityState state; | 737 TransportSecurityState state; |
738 TransportSecurityState::DomainState domain_state; | 738 TransportSecurityState::DomainState domain_state; |
739 const base::Time current_time(base::Time::Now()); | 739 const base::Time current_time(base::Time::Now()); |
740 const base::Time expiry = current_time + base::TimeDelta::FromSeconds(1000); | 740 const base::Time expiry = current_time + base::TimeDelta::FromSeconds(1000); |
741 domain_state.upgrade_expiry = expiry; | 741 domain_state.upgrade_expiry = expiry; |
742 EnableHost(&state, "www.google.com", domain_state); | 742 EnableHost(&state, "www.google.com", domain_state); |
743 | 743 |
744 EXPECT_TRUE(state.GetDomainState("www.google.com", true, &domain_state)); | 744 EXPECT_TRUE(state.GetDomainState("www.google.com", true, &domain_state)); |
745 } | 745 } |
746 | 746 |
747 static const uint8 kSidePinLeafSPKI[] = { | |
748 0x30, 0x5c, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, | |
749 0x01, 0x01, 0x05, 0x00, 0x03, 0x4b, 0x00, 0x30, 0x48, 0x02, 0x41, 0x00, 0xe4, | |
750 0x1d, 0xcc, 0xf2, 0x92, 0xe7, 0x7a, 0xc6, 0x36, 0xf7, 0x1a, 0x62, 0x31, 0x7d, | |
751 0x37, 0xea, 0x0d, 0xa2, 0xa8, 0x12, 0x2b, 0xc2, 0x1c, 0x82, 0x3e, 0xa5, 0x70, | |
752 0x4a, 0x83, 0x5d, 0x9b, 0x84, 0x82, 0x70, 0xa4, 0x88, 0x98, 0x98, 0x41, 0x29, | |
753 0x31, 0xcb, 0x6e, 0x2a, 0x54, 0x65, 0x14, 0x60, 0xcc, 0x00, 0xe8, 0x10, 0x30, | |
754 0x0a, 0x4a, 0xd1, 0xa7, 0x52, 0xfe, 0x2d, 0x31, 0x2a, 0x1d, 0x0d, 0x02, 0x03, | |
755 0x01, 0x00, 0x01, | |
756 }; | |
757 | |
758 static const uint8 kSidePinInfo[] = { | |
759 0x01, 0x00, 0x53, 0x50, 0x49, 0x4e, 0xa0, 0x00, 0x03, 0x00, 0x53, 0x49, 0x47, | |
760 0x00, 0x50, 0x55, 0x42, 0x4b, 0x41, 0x4c, 0x47, 0x4f, 0x47, 0x00, 0x41, 0x00, | |
761 0x04, 0x00, 0x30, 0x45, 0x02, 0x21, 0x00, 0xfb, 0x26, 0xd5, 0xe8, 0x76, 0x35, | |
762 0x96, 0x6d, 0x91, 0x9b, 0x5b, 0x27, 0xe6, 0x09, 0x1c, 0x7b, 0x6c, 0xcd, 0xc8, | |
763 0x10, 0x25, 0x95, 0xc0, 0xa5, 0xf6, 0x6c, 0x6f, 0xfb, 0x59, 0x1e, 0x2d, 0xf4, | |
764 0x02, 0x20, 0x33, 0x0a, 0xf8, 0x8b, 0x3e, 0xc4, 0xca, 0x75, 0x28, 0xdf, 0x5f, | |
765 0xab, 0xe4, 0x46, 0xa0, 0xdd, 0x2d, 0xe5, 0xad, 0xc3, 0x81, 0x44, 0x70, 0xb2, | |
766 0x10, 0x87, 0xe8, 0xc3, 0xd6, 0x6e, 0x12, 0x5d, 0x04, 0x67, 0x0b, 0x7d, 0xf2, | |
767 0x99, 0x75, 0x57, 0x99, 0x3a, 0x98, 0xf8, 0xe4, 0xdf, 0x79, 0xdf, 0x8e, 0x02, | |
768 0x2c, 0xbe, 0xd8, 0xfd, 0x75, 0x80, 0x18, 0xb1, 0x6f, 0x43, 0xd9, 0x8a, 0x79, | |
769 0xc3, 0x6e, 0x18, 0xdf, 0x79, 0xc0, 0x59, 0xab, 0xd6, 0x77, 0x37, 0x6a, 0x94, | |
770 0x5a, 0x7e, 0xfb, 0xa9, 0xc5, 0x54, 0x14, 0x3a, 0x7b, 0x97, 0x17, 0x2a, 0xb6, | |
771 0x1e, 0x59, 0x4f, 0x2f, 0xb1, 0x15, 0x1a, 0x34, 0x50, 0x32, 0x35, 0x36, | |
772 }; | |
773 | |
774 static const uint8 kSidePinExpectedHash[20] = { | |
775 0xb5, 0x91, 0x66, 0x47, 0x43, 0x16, 0x62, 0x86, 0xd4, 0x1e, 0x5d, 0x36, 0xe1, | |
776 0xc4, 0x09, 0x3d, 0x2d, 0x1d, 0xea, 0x1e, | |
777 }; | |
778 | |
779 TEST_F(TransportSecurityStateTest, GooglePinnedProperties) { | 747 TEST_F(TransportSecurityStateTest, GooglePinnedProperties) { |
780 EXPECT_FALSE(TransportSecurityState::IsGooglePinnedProperty( | 748 EXPECT_FALSE(TransportSecurityState::IsGooglePinnedProperty( |
781 "www.example.com", true)); | 749 "www.example.com", true)); |
782 EXPECT_FALSE(TransportSecurityState::IsGooglePinnedProperty( | 750 EXPECT_FALSE(TransportSecurityState::IsGooglePinnedProperty( |
783 "www.paypal.com", true)); | 751 "www.paypal.com", true)); |
784 EXPECT_FALSE(TransportSecurityState::IsGooglePinnedProperty( | 752 EXPECT_FALSE(TransportSecurityState::IsGooglePinnedProperty( |
785 "mail.twitter.com", true)); | 753 "mail.twitter.com", true)); |
786 EXPECT_FALSE(TransportSecurityState::IsGooglePinnedProperty( | 754 EXPECT_FALSE(TransportSecurityState::IsGooglePinnedProperty( |
787 "www.google.com.int", true)); | 755 "www.google.com.int", true)); |
788 EXPECT_FALSE(TransportSecurityState::IsGooglePinnedProperty( | 756 EXPECT_FALSE(TransportSecurityState::IsGooglePinnedProperty( |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 // Expect to fail for SNI hosts when not searching the SNI list: | 801 // Expect to fail for SNI hosts when not searching the SNI list: |
834 EXPECT_FALSE(TransportSecurityState::IsGooglePinnedProperty( | 802 EXPECT_FALSE(TransportSecurityState::IsGooglePinnedProperty( |
835 "gmail.com", false)); | 803 "gmail.com", false)); |
836 EXPECT_FALSE(TransportSecurityState::IsGooglePinnedProperty( | 804 EXPECT_FALSE(TransportSecurityState::IsGooglePinnedProperty( |
837 "googlegroups.com", false)); | 805 "googlegroups.com", false)); |
838 EXPECT_FALSE(TransportSecurityState::IsGooglePinnedProperty( | 806 EXPECT_FALSE(TransportSecurityState::IsGooglePinnedProperty( |
839 "www.googlegroups.com", false)); | 807 "www.googlegroups.com", false)); |
840 } | 808 } |
841 | 809 |
842 } // namespace net | 810 } // namespace net |
OLD | NEW |