OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <openssl/bn.h> | 5 #include <openssl/bn.h> |
6 #include <openssl/dsa.h> | 6 #include <openssl/dsa.h> |
7 #include <openssl/ecdsa.h> | 7 #include <openssl/ecdsa.h> |
8 #include <openssl/err.h> | 8 #include <openssl/err.h> |
9 #include <openssl/evp.h> | 9 #include <openssl/evp.h> |
10 #include <openssl/pem.h> | 10 #include <openssl/pem.h> |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 SignWithOpenSSL(message, wrapper_key, &wrapper_signature); | 401 SignWithOpenSSL(message, wrapper_key, &wrapper_signature); |
402 ASSERT_NE(0U, wrapper_signature.size()); | 402 ASSERT_NE(0U, wrapper_signature.size()); |
403 | 403 |
404 result->assign( | 404 result->assign( |
405 reinterpret_cast<const char*>(&wrapper_signature[0]), | 405 reinterpret_cast<const char*>(&wrapper_signature[0]), |
406 wrapper_signature.size()); | 406 wrapper_signature.size()); |
407 } | 407 } |
408 | 408 |
409 } // namespace | 409 } // namespace |
410 | 410 |
411 TEST(AndroidKeyStore,GetRSAKeyModulus) { | 411 TEST(AndroidKeyStore, GetRSAKeyModulus) { |
412 crypto::OpenSSLErrStackTracer err_trace(FROM_HERE); | 412 crypto::OpenSSLErrStackTracer err_trace(FROM_HERE); |
413 InitEnv(); | 413 InitEnv(); |
414 | 414 |
415 // Load the test RSA key. | 415 // Load the test RSA key. |
416 crypto::ScopedEVP_PKEY pkey(ImportPrivateKeyFile(kTestRsaKeyFile)); | 416 crypto::ScopedEVP_PKEY pkey(ImportPrivateKeyFile(kTestRsaKeyFile)); |
417 ASSERT_TRUE(pkey.get()); | 417 ASSERT_TRUE(pkey.get()); |
418 | 418 |
419 // Convert it to encoded PKCS#8 bytes. | 419 // Convert it to encoded PKCS#8 bytes. |
420 std::string pkcs8_data; | 420 std::string pkcs8_data; |
421 ASSERT_TRUE(GetPrivateKeyPkcs8Bytes(pkey, &pkcs8_data)); | 421 ASSERT_TRUE(GetPrivateKeyPkcs8Bytes(pkey, &pkcs8_data)); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 std::string signature; | 548 std::string signature; |
549 DoKeySigningWithWrapper(wrapper_key.get(), | 549 DoKeySigningWithWrapper(wrapper_key.get(), |
550 openssl_key.get(), | 550 openssl_key.get(), |
551 message, | 551 message, |
552 &signature); | 552 &signature); |
553 ASSERT_TRUE(VerifyTestECDSASignature(message, signature)); | 553 ASSERT_TRUE(VerifyTestECDSASignature(message, signature)); |
554 } | 554 } |
555 | 555 |
556 } // namespace android | 556 } // namespace android |
557 } // namespace net | 557 } // namespace net |
OLD | NEW |