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/cert/x509_util.h" | 5 #include "net/cert/x509_util.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 &der_cert)); | 181 &der_cert)); |
182 | 182 |
183 scoped_refptr<X509Certificate> cert = | 183 scoped_refptr<X509Certificate> cert = |
184 X509Certificate::CreateFromBytes(der_cert.data(), der_cert.size()); | 184 X509Certificate::CreateFromBytes(der_cert.data(), der_cert.size()); |
185 ASSERT_TRUE(cert.get()); | 185 ASSERT_TRUE(cert.get()); |
186 | 186 |
187 EXPECT_EQ("subject", cert->subject().GetDisplayName()); | 187 EXPECT_EQ("subject", cert->subject().GetDisplayName()); |
188 EXPECT_FALSE(cert->HasExpired()); | 188 EXPECT_FALSE(cert->HasExpired()); |
189 } | 189 } |
190 | 190 |
191 #if defined(USE_OPENSSL) | |
192 // This is a test case based on | 191 // This is a test case based on |
193 // http://blogs.msdn.com/b/openspecification/archive/2013/03/26/ntlm-and-channel
-binding-hash-aka-exteneded-protection-for-authentication.aspx | 192 // http://blogs.msdn.com/b/openspecification/archive/2013/03/26/ntlm-and-channel
-binding-hash-aka-exteneded-protection-for-authentication.aspx |
194 // There doesn't seem to be too many public test vectors for channel bindings. | 193 // There doesn't seem to be too many public test vectors for channel bindings. |
195 TEST(X509UtilTest, CreateChannelBindings_SHA1) { | 194 TEST(X509UtilTest, CreateChannelBindings_SHA1) { |
196 // Certificate: | 195 // Certificate: |
197 // Data: | 196 // Data: |
198 // Version: 3 (0x2) | 197 // Version: 3 (0x2) |
199 // Serial Number: | 198 // Serial Number: |
200 // (Negative)34:96:86:32:ae:8a:3a:48:b4:98:cf:7c:93:87:bb:d9 | 199 // (Negative)34:96:86:32:ae:8a:3a:48:b4:98:cf:7c:93:87:bb:d9 |
201 // Signature Algorithm: sha1WithRSA | 200 // Signature Algorithm: sha1WithRSA |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 | 690 |
692 scoped_refptr<X509Certificate> cert = X509Certificate::CreateFromBytes( | 691 scoped_refptr<X509Certificate> cert = X509Certificate::CreateFromBytes( |
693 reinterpret_cast<const char*>(kCertificateDataDER), | 692 reinterpret_cast<const char*>(kCertificateDataDER), |
694 sizeof(kCertificateDataDER)); | 693 sizeof(kCertificateDataDER)); |
695 | 694 |
696 std::string channel_bindings; | 695 std::string channel_bindings; |
697 ASSERT_FALSE( | 696 ASSERT_FALSE( |
698 x509_util::GetTLSServerEndPointChannelBinding(*cert, &channel_bindings)); | 697 x509_util::GetTLSServerEndPointChannelBinding(*cert, &channel_bindings)); |
699 EXPECT_TRUE(channel_bindings.empty()); | 698 EXPECT_TRUE(channel_bindings.empty()); |
700 } | 699 } |
701 #endif | |
702 | 700 |
703 } // namespace x509_util | 701 } // namespace x509_util |
704 | 702 |
705 } // namespace net | 703 } // namespace net |
OLD | NEW |