OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/crypto/symmetric_key.h" | 5 #include "base/crypto/symmetric_key.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 TEST(SymmetricKeyTest, GenerateRandomKey) { | 14 TEST(SymmetricKeyTest, GenerateRandomKey) { |
15 scoped_ptr<base::SymmetricKey> key( | 15 scoped_ptr<base::SymmetricKey> key( |
16 base::SymmetricKey::GenerateRandomKey(base::SymmetricKey::AES, 256)); | 16 base::SymmetricKey::GenerateRandomKey(base::SymmetricKey::AES, 256)); |
17 ASSERT_TRUE(NULL != key.get()); | 17 ASSERT_TRUE(NULL != key.get()); |
18 std::string raw_key; | 18 std::string raw_key; |
19 EXPECT_TRUE(key->GetRawKey(&raw_key)); | 19 EXPECT_TRUE(key->GetRawKey(&raw_key)); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", | 217 "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", |
218 "pass phrase exceeds block size", | 218 "pass phrase exceeds block size", |
219 20, | 219 20, |
220 256, | 220 256, |
221 "e0739745dc28b8721ba402e05214d2ac1eab54cf72bee1fba388297a09eb493c", | 221 "e0739745dc28b8721ba402e05214d2ac1eab54cf72bee1fba388297a09eb493c", |
222 }, | 222 }, |
223 }; | 223 }; |
224 | 224 |
225 INSTANTIATE_TEST_CASE_P(, SymmetricKeyDeriveKeyFromPasswordTest, | 225 INSTANTIATE_TEST_CASE_P(, SymmetricKeyDeriveKeyFromPasswordTest, |
226 testing::ValuesIn(kTestVectors)); | 226 testing::ValuesIn(kTestVectors)); |
OLD | NEW |