| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "crypto/ec_private_key.h" | 5 #include "crypto/ec_private_key.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 std::string raw_public_key; | 216 std::string raw_public_key; |
| 217 EXPECT_TRUE(keypair_openssl->ExportRawPublicKey(&raw_public_key)); | 217 EXPECT_TRUE(keypair_openssl->ExportRawPublicKey(&raw_public_key)); |
| 218 EXPECT_EQ(std::string(reinterpret_cast<const char*>(kOpenSSLRawPublicKey), | 218 EXPECT_EQ(std::string(reinterpret_cast<const char*>(kOpenSSLRawPublicKey), |
| 219 arraysize(kOpenSSLRawPublicKey)), | 219 arraysize(kOpenSSLRawPublicKey)), |
| 220 raw_public_key); | 220 raw_public_key); |
| 221 } | 221 } |
| 222 | 222 |
| 223 // The Android code writes out Channel IDs differently from the NSS | 223 // The Android code writes out Channel IDs differently from the NSS |
| 224 // implementation; the empty password is converted to "\0\0". The OpenSSL port | 224 // implementation; the empty password is converted to "\0\0". The OpenSSL port |
| 225 // should support either. | 225 // should support either. |
| 226 #if defined(USE_OPENSSL) | |
| 227 TEST(ECPrivateKeyUnitTest, LoadOldOpenSSLKeyTest) { | 226 TEST(ECPrivateKeyUnitTest, LoadOldOpenSSLKeyTest) { |
| 228 static const uint8_t kOpenSSLKey[] = { | 227 static const uint8_t kOpenSSLKey[] = { |
| 229 0x30, 0x82, 0x01, 0xa1, 0x30, 0x1b, 0x06, 0x0a, 0x2a, 0x86, 0x48, 0x86, | 228 0x30, 0x82, 0x01, 0xa1, 0x30, 0x1b, 0x06, 0x0a, 0x2a, 0x86, 0x48, 0x86, |
| 230 0xf7, 0x0d, 0x01, 0x0c, 0x01, 0x03, 0x30, 0x0d, 0x04, 0x08, 0x86, 0xaa, | 229 0xf7, 0x0d, 0x01, 0x0c, 0x01, 0x03, 0x30, 0x0d, 0x04, 0x08, 0x86, 0xaa, |
| 231 0xd7, 0xdf, 0x3b, 0x91, 0x97, 0x60, 0x02, 0x01, 0x01, 0x04, 0x82, 0x01, | 230 0xd7, 0xdf, 0x3b, 0x91, 0x97, 0x60, 0x02, 0x01, 0x01, 0x04, 0x82, 0x01, |
| 232 0x80, 0xcb, 0x2a, 0x14, 0xaa, 0x4f, 0x38, 0x4c, 0xe1, 0x49, 0x00, 0xe2, | 231 0x80, 0xcb, 0x2a, 0x14, 0xaa, 0x4f, 0x38, 0x4c, 0xe1, 0x49, 0x00, 0xe2, |
| 233 0x1a, 0x3a, 0x75, 0x87, 0x7e, 0x3d, 0xea, 0x4d, 0x53, 0xd4, 0x46, 0x47, | 232 0x1a, 0x3a, 0x75, 0x87, 0x7e, 0x3d, 0xea, 0x4d, 0x53, 0xd4, 0x46, 0x47, |
| 234 0x23, 0x8f, 0xa1, 0x72, 0x51, 0x92, 0x86, 0x8b, 0xeb, 0x53, 0xe6, 0x6a, | 233 0x23, 0x8f, 0xa1, 0x72, 0x51, 0x92, 0x86, 0x8b, 0xeb, 0x53, 0xe6, 0x6a, |
| 235 0x0a, 0x6b, 0xb6, 0xa0, 0xdc, 0x0f, 0xdc, 0x20, 0xc3, 0x45, 0x85, 0xf1, | 234 0x0a, 0x6b, 0xb6, 0xa0, 0xdc, 0x0f, 0xdc, 0x20, 0xc3, 0x45, 0x85, 0xf1, |
| 236 0x95, 0x90, 0x5c, 0xf4, 0xfa, 0xee, 0x47, 0xaf, 0x35, 0xd0, 0xd0, 0xd3, | 235 0x95, 0x90, 0x5c, 0xf4, 0xfa, 0xee, 0x47, 0xaf, 0x35, 0xd0, 0xd0, 0xd3, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 | 295 |
| 297 std::unique_ptr<crypto::ECPrivateKey> keypair_openssl( | 296 std::unique_ptr<crypto::ECPrivateKey> keypair_openssl( |
| 298 crypto::ECPrivateKey::CreateFromEncryptedPrivateKeyInfo( | 297 crypto::ECPrivateKey::CreateFromEncryptedPrivateKeyInfo( |
| 299 "", | 298 "", |
| 300 std::vector<uint8_t>(std::begin(kOpenSSLKey), std::end(kOpenSSLKey)), | 299 std::vector<uint8_t>(std::begin(kOpenSSLKey), std::end(kOpenSSLKey)), |
| 301 std::vector<uint8_t>(std::begin(kOpenSSLPublicKey), | 300 std::vector<uint8_t>(std::begin(kOpenSSLPublicKey), |
| 302 std::end(kOpenSSLPublicKey)))); | 301 std::end(kOpenSSLPublicKey)))); |
| 303 | 302 |
| 304 EXPECT_TRUE(keypair_openssl.get()); | 303 EXPECT_TRUE(keypair_openssl.get()); |
| 305 } | 304 } |
| 306 #endif // defined(USE_OPENSSL) | |
| OLD | NEW |