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

Unified Diff: crypto/signature_creator_unittest.cc

Issue 1679873005: Switch SignatureVerifier to taking an algorithm enum. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix iOS build Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « crypto/ec_signature_creator_unittest.cc ('k') | crypto/signature_verifier.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/signature_creator_unittest.cc
diff --git a/crypto/signature_creator_unittest.cc b/crypto/signature_creator_unittest.cc
index af1a04212675a4a1f59cc1de88403ff8823b286c..fff065e58dd0f7e40a4b1a1ee22092f1721b9db9 100644
--- a/crypto/signature_creator_unittest.cc
+++ b/crypto/signature_creator_unittest.cc
@@ -14,19 +14,6 @@
#include "crypto/signature_verifier.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace {
-
-// This is the algorithm ID for SHA-1 with RSA encryption.
-const uint8_t kSHA1WithRSAAlgorithmID[] = {0x30, 0x0d, 0x06, 0x09, 0x2a,
- 0x86, 0x48, 0x86, 0xf7, 0x0d,
- 0x01, 0x01, 0x05, 0x05, 0x00};
-
-// This is the algorithm ID for SHA-1 with RSA encryption.
-const uint8_t kSHA256WithRSAAlgorithmID[] = {0x30, 0x0d, 0x06, 0x09, 0x2a,
- 0x86, 0x48, 0x86, 0xf7, 0x0d,
- 0x01, 0x01, 0x0B, 0x05, 0x00};
-}
-
TEST(SignatureCreatorTest, BasicTest) {
// Do a verify round trip.
scoped_ptr<crypto::RSAPrivateKey> key_original(
@@ -56,9 +43,8 @@ TEST(SignatureCreatorTest, BasicTest) {
crypto::SignatureVerifier verifier;
ASSERT_TRUE(verifier.VerifyInit(
- kSHA1WithRSAAlgorithmID, sizeof(kSHA1WithRSAAlgorithmID),
- &signature.front(), signature.size(),
- &public_key_info.front(), public_key_info.size()));
+ crypto::SignatureVerifier::RSA_PKCS1_SHA1, &signature.front(),
+ signature.size(), &public_key_info.front(), public_key_info.size()));
verifier.VerifyUpdate(reinterpret_cast<const uint8_t*>(data.c_str()),
data.size());
@@ -91,9 +77,8 @@ TEST(SignatureCreatorTest, SignDigestTest) {
// Verify the input data.
crypto::SignatureVerifier verifier;
ASSERT_TRUE(verifier.VerifyInit(
- kSHA1WithRSAAlgorithmID, sizeof(kSHA1WithRSAAlgorithmID),
- &signature.front(), signature.size(),
- &public_key_info.front(), public_key_info.size()));
+ crypto::SignatureVerifier::RSA_PKCS1_SHA1, &signature.front(),
+ signature.size(), &public_key_info.front(), public_key_info.size()));
verifier.VerifyUpdate(reinterpret_cast<const uint8_t*>(data.c_str()),
data.size());
@@ -127,9 +112,8 @@ TEST(SignatureCreatorTest, SignSHA256DigestTest) {
// Verify the input data.
crypto::SignatureVerifier verifier;
ASSERT_TRUE(verifier.VerifyInit(
- kSHA256WithRSAAlgorithmID, sizeof(kSHA256WithRSAAlgorithmID),
- &signature.front(), signature.size(),
- &public_key_info.front(), public_key_info.size()));
+ crypto::SignatureVerifier::RSA_PKCS1_SHA256, &signature.front(),
+ signature.size(), &public_key_info.front(), public_key_info.size()));
verifier.VerifyUpdate(reinterpret_cast<const uint8_t*>(data.c_str()),
data.size());
« no previous file with comments | « crypto/ec_signature_creator_unittest.cc ('k') | crypto/signature_verifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698