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 28 matching lines...) Expand all Loading... | |
39 class SSLIdentityTest : public testing::Test { | 39 class SSLIdentityTest : public testing::Test { |
40 public: | 40 public: |
41 SSLIdentityTest() : | 41 SSLIdentityTest() : |
42 identity1_(), identity2_() { | 42 identity1_(), identity2_() { |
43 } | 43 } |
44 | 44 |
45 ~SSLIdentityTest() { | 45 ~SSLIdentityTest() { |
46 } | 46 } |
47 | 47 |
48 virtual void SetUp() { | 48 virtual void SetUp() { |
49 identity1_.reset(SSLIdentity::Generate("test1")); | 49 // Confirmed to work with KT_RSA and KT_ECDSA. |
juberti1
2015/06/26 19:16:01
This needs to specifically test both KT_RSA and KT
torbjorng (webrtc)
2015/07/02 12:35:08
OK. I have fixed this and cleaned things up to av
| |
50 identity2_.reset(SSLIdentity::Generate("test2")); | 50 identity1_.reset(SSLIdentity::Generate("test1", rtc::KT_DEFAULT)); |
51 // Confirmed to work with KT_RSA and KT_ECDSA. | |
52 identity2_.reset(SSLIdentity::Generate("test2", rtc::KT_DEFAULT)); | |
51 | 53 |
52 ASSERT_TRUE(identity1_); | 54 ASSERT_TRUE(identity1_); |
53 ASSERT_TRUE(identity2_); | 55 ASSERT_TRUE(identity2_); |
54 | 56 |
55 test_cert_.reset( | 57 test_cert_.reset( |
56 rtc::SSLCertificate::FromPEMString(kTestCertificate)); | 58 rtc::SSLCertificate::FromPEMString(kTestCertificate)); |
57 ASSERT_TRUE(test_cert_); | 59 ASSERT_TRUE(test_cert_); |
58 } | 60 } |
59 | 61 |
60 void TestGetSignatureDigestAlgorithm() { | 62 void TestGetSignatureDigestAlgorithm() { |
61 std::string digest_algorithm; | 63 std::string digest_algorithm; |
62 // Both NSSIdentity::Generate and OpenSSLIdentity::Generate are | 64 // Both NSSIdentity::Generate and OpenSSLIdentity::Generate are |
juberti1
2015/06/26 19:16:01
comment is incorrect
| |
63 // hard-coded to generate RSA-SHA256 certificates. | 65 // hard-coded to generate RSA-SHA256 certificates. |
64 ASSERT_TRUE(identity1_->certificate().GetSignatureDigestAlgorithm( | 66 ASSERT_TRUE(identity1_->certificate().GetSignatureDigestAlgorithm( |
65 &digest_algorithm)); | 67 &digest_algorithm)); |
66 ASSERT_EQ(rtc::DIGEST_SHA_256, digest_algorithm); | 68 ASSERT_EQ(rtc::DIGEST_SHA_256, digest_algorithm); |
67 ASSERT_TRUE(identity2_->certificate().GetSignatureDigestAlgorithm( | 69 ASSERT_TRUE(identity2_->certificate().GetSignatureDigestAlgorithm( |
68 &digest_algorithm)); | 70 &digest_algorithm)); |
69 ASSERT_EQ(rtc::DIGEST_SHA_256, digest_algorithm); | 71 ASSERT_EQ(rtc::DIGEST_SHA_256, digest_algorithm); |
70 | 72 |
71 // The test certificate has an MD5-based signature. | 73 // The test certificate has an MD5-based signature. |
72 ASSERT_TRUE(test_cert_->GetSignatureDigestAlgorithm(&digest_algorithm)); | 74 ASSERT_TRUE(test_cert_->GetSignatureDigestAlgorithm(&digest_algorithm)); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
191 EXPECT_TRUE(SSLIdentity::PemToDer("CERTIFICATE", kTestCertificate, &der)); | 193 EXPECT_TRUE(SSLIdentity::PemToDer("CERTIFICATE", kTestCertificate, &der)); |
192 | 194 |
193 EXPECT_EQ(kTestCertificate, SSLIdentity::DerToPem( | 195 EXPECT_EQ(kTestCertificate, SSLIdentity::DerToPem( |
194 "CERTIFICATE", | 196 "CERTIFICATE", |
195 reinterpret_cast<const unsigned char*>(der.data()), der.length())); | 197 reinterpret_cast<const unsigned char*>(der.data()), der.length())); |
196 } | 198 } |
197 | 199 |
198 TEST_F(SSLIdentityTest, GetSignatureDigestAlgorithm) { | 200 TEST_F(SSLIdentityTest, GetSignatureDigestAlgorithm) { |
199 TestGetSignatureDigestAlgorithm(); | 201 TestGetSignatureDigestAlgorithm(); |
200 } | 202 } |
OLD | NEW |