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/signature_verifier.h" | 5 #include "crypto/signature_verifier.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
| 10 #include "base/logging.h" |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/numerics/safe_conversions.h" | 12 #include "base/numerics/safe_conversions.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
13 | 14 |
14 TEST(SignatureVerifierTest, BasicTest) { | 15 TEST(SignatureVerifierTest, BasicTest) { |
15 // The input data in this test comes from real certificates. | 16 // The input data in this test comes from real certificates. |
16 // | 17 // |
17 // tbs_certificate ("to-be-signed certificate", the part of a certificate that | 18 // tbs_certificate ("to-be-signed certificate", the part of a certificate that |
18 // is signed), signature, and algorithm come from the certificate of | 19 // is signed), signature, and algorithm come from the certificate of |
19 // bugs.webkit.org. | 20 // bugs.webkit.org. |
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 &public_key_info[0], | 1136 &public_key_info[0], |
1136 public_key_info.size()); | 1137 public_key_info.size()); |
1137 signature[0] -= 1; | 1138 signature[0] -= 1; |
1138 ASSERT_TRUE(ok); | 1139 ASSERT_TRUE(ok); |
1139 verifier.VerifyUpdate(&message[0], message.size()); | 1140 verifier.VerifyUpdate(&message[0], message.size()); |
1140 ok = verifier.VerifyFinal(); | 1141 ok = verifier.VerifyFinal(); |
1141 EXPECT_FALSE(ok); | 1142 EXPECT_FALSE(ok); |
1142 } | 1143 } |
1143 } | 1144 } |
1144 } | 1145 } |
OLD | NEW |