OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/signature_creator.h" | 5 #include "crypto/signature_creator.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
| 10 #include <string> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/sha1.h" | 13 #include "base/sha1.h" |
13 #include "crypto/rsa_private_key.h" | 14 #include "crypto/rsa_private_key.h" |
14 #include "crypto/sha2.h" | 15 #include "crypto/sha2.h" |
15 #include "crypto/signature_verifier.h" | 16 #include "crypto/signature_verifier.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
17 | 18 |
18 TEST(SignatureCreatorTest, BasicTest) { | 19 TEST(SignatureCreatorTest, BasicTest) { |
19 // Do a verify round trip. | 20 // Do a verify round trip. |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // Verify the input data. | 114 // Verify the input data. |
114 crypto::SignatureVerifier verifier; | 115 crypto::SignatureVerifier verifier; |
115 ASSERT_TRUE(verifier.VerifyInit( | 116 ASSERT_TRUE(verifier.VerifyInit( |
116 crypto::SignatureVerifier::RSA_PKCS1_SHA256, &signature.front(), | 117 crypto::SignatureVerifier::RSA_PKCS1_SHA256, &signature.front(), |
117 signature.size(), &public_key_info.front(), public_key_info.size())); | 118 signature.size(), &public_key_info.front(), public_key_info.size())); |
118 | 119 |
119 verifier.VerifyUpdate(reinterpret_cast<const uint8_t*>(data.c_str()), | 120 verifier.VerifyUpdate(reinterpret_cast<const uint8_t*>(data.c_str()), |
120 data.size()); | 121 data.size()); |
121 ASSERT_TRUE(verifier.VerifyFinal()); | 122 ASSERT_TRUE(verifier.VerifyFinal()); |
122 } | 123 } |
OLD | NEW |