OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2011 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 rtc::scoped_ptr<rtc::SSLCertificate> remote_cert1; | 835 rtc::scoped_ptr<rtc::SSLCertificate> remote_cert1; |
836 rtc::scoped_ptr<rtc::SSLCertificate> remote_cert2; | 836 rtc::scoped_ptr<rtc::SSLCertificate> remote_cert2; |
837 | 837 |
838 // After negotiation, each side has a distinct local certificate, but still no | 838 // After negotiation, each side has a distinct local certificate, but still no |
839 // remote certificate, because connection has not yet occurred. | 839 // remote certificate, because connection has not yet occurred. |
840 ASSERT_TRUE(client1_.transport()->GetCertificate(&certificate1)); | 840 ASSERT_TRUE(client1_.transport()->GetCertificate(&certificate1)); |
841 ASSERT_TRUE(client2_.transport()->GetCertificate(&certificate2)); | 841 ASSERT_TRUE(client2_.transport()->GetCertificate(&certificate2)); |
842 ASSERT_NE(certificate1->ssl_certificate().ToPEMString(), | 842 ASSERT_NE(certificate1->ssl_certificate().ToPEMString(), |
843 certificate2->ssl_certificate().ToPEMString()); | 843 certificate2->ssl_certificate().ToPEMString()); |
844 ASSERT_FALSE( | 844 ASSERT_FALSE( |
845 client1_.transport()->GetRemoteCertificate(remote_cert1.accept())); | 845 client1_.transport()->GetRemoteSSLCertificate(remote_cert1.accept())); |
846 ASSERT_FALSE(remote_cert1 != NULL); | 846 ASSERT_FALSE(remote_cert1 != NULL); |
847 ASSERT_FALSE( | 847 ASSERT_FALSE( |
848 client2_.transport()->GetRemoteCertificate(remote_cert2.accept())); | 848 client2_.transport()->GetRemoteSSLCertificate(remote_cert2.accept())); |
849 ASSERT_FALSE(remote_cert2 != NULL); | 849 ASSERT_FALSE(remote_cert2 != NULL); |
850 } | 850 } |
851 | 851 |
852 // Test Certificates state after connection. | 852 // Test Certificates state after connection. |
853 TEST_F(DtlsTransportChannelTest, TestCertificatesAfterConnect) { | 853 TEST_F(DtlsTransportChannelTest, TestCertificatesAfterConnect) { |
854 MAYBE_SKIP_TEST(HaveDtls); | 854 MAYBE_SKIP_TEST(HaveDtls); |
855 PrepareDtls(true, true, rtc::KT_DEFAULT); | 855 PrepareDtls(true, true, rtc::KT_DEFAULT); |
856 ASSERT_TRUE(Connect()); | 856 ASSERT_TRUE(Connect()); |
857 | 857 |
858 rtc::scoped_refptr<rtc::RTCCertificate> certificate1; | 858 rtc::scoped_refptr<rtc::RTCCertificate> certificate1; |
859 rtc::scoped_refptr<rtc::RTCCertificate> certificate2; | 859 rtc::scoped_refptr<rtc::RTCCertificate> certificate2; |
860 rtc::scoped_ptr<rtc::SSLCertificate> remote_cert1; | 860 rtc::scoped_ptr<rtc::SSLCertificate> remote_cert1; |
861 rtc::scoped_ptr<rtc::SSLCertificate> remote_cert2; | 861 rtc::scoped_ptr<rtc::SSLCertificate> remote_cert2; |
862 | 862 |
863 // After connection, each side has a distinct local certificate. | 863 // After connection, each side has a distinct local certificate. |
864 ASSERT_TRUE(client1_.transport()->GetCertificate(&certificate1)); | 864 ASSERT_TRUE(client1_.transport()->GetCertificate(&certificate1)); |
865 ASSERT_TRUE(client2_.transport()->GetCertificate(&certificate2)); | 865 ASSERT_TRUE(client2_.transport()->GetCertificate(&certificate2)); |
866 ASSERT_NE(certificate1->ssl_certificate().ToPEMString(), | 866 ASSERT_NE(certificate1->ssl_certificate().ToPEMString(), |
867 certificate2->ssl_certificate().ToPEMString()); | 867 certificate2->ssl_certificate().ToPEMString()); |
868 | 868 |
869 // Each side's remote certificate is the other side's local certificate. | 869 // Each side's remote certificate is the other side's local certificate. |
870 ASSERT_TRUE( | 870 ASSERT_TRUE( |
871 client1_.transport()->GetRemoteCertificate(remote_cert1.accept())); | 871 client1_.transport()->GetRemoteSSLCertificate(remote_cert1.accept())); |
872 ASSERT_EQ(remote_cert1->ToPEMString(), | 872 ASSERT_EQ(remote_cert1->ToPEMString(), |
873 certificate2->ssl_certificate().ToPEMString()); | 873 certificate2->ssl_certificate().ToPEMString()); |
874 ASSERT_TRUE( | 874 ASSERT_TRUE( |
875 client2_.transport()->GetRemoteCertificate(remote_cert2.accept())); | 875 client2_.transport()->GetRemoteSSLCertificate(remote_cert2.accept())); |
876 ASSERT_EQ(remote_cert2->ToPEMString(), | 876 ASSERT_EQ(remote_cert2->ToPEMString(), |
877 certificate1->ssl_certificate().ToPEMString()); | 877 certificate1->ssl_certificate().ToPEMString()); |
878 } | 878 } |
OLD | NEW |