Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1374)

Side by Side Diff: crypto/ec_signature_creator_unittest.cc

Issue 10910226: crypto: change ECSignatureCreator defaults to match SPDY. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « crypto/ec_signature_creator_openssl.cc ('k') | net/spdy/spdy_credential_builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ec_signature_creator.h" 5 #include "crypto/ec_signature_creator.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 std::string data("Hello, World!"); 47 std::string data("Hello, World!");
48 std::vector<uint8> signature; 48 std::vector<uint8> signature;
49 ASSERT_TRUE(signer->Sign(reinterpret_cast<const uint8*>(data.c_str()), 49 ASSERT_TRUE(signer->Sign(reinterpret_cast<const uint8*>(data.c_str()),
50 data.size(), 50 data.size(),
51 &signature)); 51 &signature));
52 52
53 std::vector<uint8> public_key_info; 53 std::vector<uint8> public_key_info;
54 ASSERT_TRUE(key_original->ExportPublicKey(&public_key_info)); 54 ASSERT_TRUE(key_original->ExportPublicKey(&public_key_info));
55 55
56 // This is the algorithm ID for SHA-1 with EC encryption. 56 // This is the algorithm ID for SHA-256 with EC encryption.
57 const uint8 kECDSAWithSHA1AlgorithmID[] = { 57 const uint8 kECDSAWithSHA256AlgorithmID[] = {
58 0x30, 0x0b, 58 0x30, 0x0c,
59 0x06, 0x07, 59 0x06, 0x08,
60 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x01, 60 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02,
61 0x05, 0x00 61 0x05, 0x00
62 }; 62 };
63 crypto::SignatureVerifier verifier; 63 crypto::SignatureVerifier verifier;
64 ASSERT_TRUE(verifier.VerifyInit( 64 ASSERT_TRUE(verifier.VerifyInit(
65 kECDSAWithSHA1AlgorithmID, sizeof(kECDSAWithSHA1AlgorithmID), 65 kECDSAWithSHA256AlgorithmID, sizeof(kECDSAWithSHA256AlgorithmID),
66 &signature.front(), signature.size(), 66 &signature[0], signature.size(),
67 &public_key_info.front(), public_key_info.size())); 67 &public_key_info.front(), public_key_info.size()));
68 68
69 verifier.VerifyUpdate(reinterpret_cast<const uint8*>(data.c_str()), 69 verifier.VerifyUpdate(reinterpret_cast<const uint8*>(data.c_str()),
70 data.size()); 70 data.size());
71 ASSERT_TRUE(verifier.VerifyFinal()); 71 ASSERT_TRUE(verifier.VerifyFinal());
72 } 72 }
73 #endif // !defined(USE_OPENSSL) 73 #endif // !defined(USE_OPENSSL)
OLDNEW
« no previous file with comments | « crypto/ec_signature_creator_openssl.cc ('k') | net/spdy/spdy_credential_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698