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> |
11 #include <openssl/rsa.h> | 11 #include <openssl/rsa.h> |
12 | 12 |
13 #include "base/android/build_info.h" | 13 #include "base/android/build_info.h" |
14 #include "base/android/jni_android.h" | 14 #include "base/android/jni_android.h" |
15 #include "base/android/jni_array.h" | 15 #include "base/android/jni_array.h" |
16 #include "base/android/scoped_java_ref.h" | 16 #include "base/android/scoped_java_ref.h" |
17 #include "base/bind.h" | 17 #include "base/bind.h" |
18 #include "base/callback.h" | 18 #include "base/callback.h" |
19 #include "base/compiler_specific.h" | 19 #include "base/compiler_specific.h" |
20 #include "base/files/file_path.h" | 20 #include "base/files/file_path.h" |
21 #include "base/files/file_util.h" | 21 #include "base/files/file_util.h" |
22 #include "base/files/scoped_file.h" | 22 #include "base/files/scoped_file.h" |
23 #include "base/strings/string_number_conversions.h" | 23 #include "base/strings/string_number_conversions.h" |
24 #include "base/strings/string_util.h" | 24 #include "base/strings/string_util.h" |
25 #include "crypto/auto_cbb.h" | 25 #include "crypto/auto_cbb.h" |
26 #include "crypto/openssl_util.h" | 26 #include "crypto/openssl_util.h" |
27 #include "net/android/keystore.h" | 27 #include "net/android/keystore.h" |
28 #include "net/android/keystore_openssl.h" | 28 #include "net/android/keystore_openssl.h" |
29 #include "net/base/test_data_directory.h" | |
30 #include "net/ssl/scoped_openssl_types.h" | 29 #include "net/ssl/scoped_openssl_types.h" |
31 #include "net/test/jni/AndroidKeyStoreTestUtil_jni.h" | 30 #include "net/test/jni/AndroidKeyStoreTestUtil_jni.h" |
| 31 #include "net/test/test_data_directory.h" |
32 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
33 | 33 |
34 // Technical note: | 34 // Technical note: |
35 // | 35 // |
36 // This source file not only checks that signing with | 36 // This source file not only checks that signing with |
37 // RawSignDigestWithPrivateKey() works correctly, it also verifies that | 37 // RawSignDigestWithPrivateKey() works correctly, it also verifies that |
38 // the generated signature matches 100% of what OpenSSL generates when | 38 // the generated signature matches 100% of what OpenSSL generates when |
39 // calling RSA_sign(NID_md5_sha1,...), DSA_sign(0, ...) or | 39 // calling RSA_sign(NID_md5_sha1,...), DSA_sign(0, ...) or |
40 // ECDSA_sign(0, ...). | 40 // ECDSA_sign(0, ...). |
41 // | 41 // |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 std::string signature; | 546 std::string signature; |
547 DoKeySigningWithWrapper(wrapper_key.get(), | 547 DoKeySigningWithWrapper(wrapper_key.get(), |
548 openssl_key.get(), | 548 openssl_key.get(), |
549 message, | 549 message, |
550 &signature); | 550 &signature); |
551 ASSERT_TRUE(VerifyTestECDSASignature(message, signature)); | 551 ASSERT_TRUE(VerifyTestECDSASignature(message, signature)); |
552 } | 552 } |
553 | 553 |
554 } // namespace android | 554 } // namespace android |
555 } // namespace net | 555 } // namespace net |
OLD | NEW |