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

Side by Side Diff: chrome/common/net/x509_certificate_model_unittest.cc

Issue 371953003: x509_certificate_model_openssl: implement ProcessSubjectPublicKeyInfo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use BN_bn2bin return value Created 6 years, 5 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 | « chrome/common/net/x509_certificate_model_openssl.cc ('k') | no next file » | 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 "chrome/common/net/x509_certificate_model.h" 5 #include "chrome/common/net/x509_certificate_model.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "net/base/test_data_directory.h" 9 #include "net/base/test_data_directory.h"
10 #include "net/test/cert_test_util.h" 10 #include "net/test/cert_test_util.h"
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 x509_certificate_model::ProcessSecAlgorithmSignature( 354 x509_certificate_model::ProcessSecAlgorithmSignature(
355 cert->os_cert_handle())); 355 cert->os_cert_handle()));
356 EXPECT_EQ("PKCS #1 MD5 With RSA Encryption", 356 EXPECT_EQ("PKCS #1 MD5 With RSA Encryption",
357 x509_certificate_model::ProcessSecAlgorithmSignatureWrap( 357 x509_certificate_model::ProcessSecAlgorithmSignatureWrap(
358 cert->os_cert_handle())); 358 cert->os_cert_handle()));
359 EXPECT_EQ("PKCS #1 RSA Encryption", 359 EXPECT_EQ("PKCS #1 RSA Encryption",
360 x509_certificate_model::ProcessSecAlgorithmSubjectPublicKey( 360 x509_certificate_model::ProcessSecAlgorithmSubjectPublicKey(
361 cert->os_cert_handle())); 361 cert->os_cert_handle()));
362 } 362 }
363 } 363 }
364
365 TEST(X509CertificateModelTest, ProcessSubjectPublicKeyInfo) {
366 {
367 scoped_refptr<net::X509Certificate> cert(net::ImportCertFromFile(
368 net::GetTestCertsDirectory(), "root_ca_cert.pem"));
369 ASSERT_TRUE(cert.get());
370 EXPECT_EQ(
371 "Modulus (2048 bits):\n"
372 " AB A3 84 16 05 AE F4 80 85 81 A7 A8 59 FA BB 0E\n"
373 "5E 7B 04 DC C4 44 7A 41 05 37 9D 45 A1 6B DE E8\n"
374 "FE 0F 89 D3 39 78 EB 68 01 4F 15 C0 4B 13 A4 4C\n"
375 "25 95 ED A4 BB D9 AD F7 54 0C F1 33 4E D7 25 88\n"
376 "B0 28 5E 64 01 F0 33 7C 4D 3B D8 5C 48 04 AF 77\n"
377 "52 6F EA 99 B0 07 E6 6D BB 63 9E 33 AD 18 94 30\n"
378 "96 46 F4 41 D6 69 E3 EE 55 DE FA C3 D4 36 D3 D1\n"
379 "71 87 28 3B B8 FC 4B 2D BF 3C E2 FB 8C E8 FA 99\n"
380 "44 0C BD 5D CB E3 A9 F6 0D 3D 1C EB B6 80 1E BE\n"
381 "A5 51 B5 60 04 77 72 47 96 17 0D 8E 44 EE FA C4\n"
382 "5F AB 31 16 DC 68 9A 9F 9A 79 94 04 B9 0F 14 DF\n"
383 "C1 9A FA 37 AB 7F 70 B8 80 DD 48 25 ED BD 43 67\n"
384 "01 C1 32 9D 76 A1 FE C1 64 D8 00 77 73 D1 3F 21\n"
385 "86 92 72 E8 91 36 45 84 8B B7 14 5E B0 32 5C A3\n"
386 "ED 30 DA 36 45 DB DF 55 41 18 CF FE 36 37 ED BB\n"
387 "D3 09 1F D6 D6 91 D2 D8 5F 73 02 52 D3 AA 0D 23\n"
388 "\n"
389 #if defined(USE_OPENSSL)
390 " Public Exponent (17 bits):\n"
391 #else
392 " Public Exponent (24 bits):\n"
393 #endif
394 " 01 00 01",
395 x509_certificate_model::ProcessSubjectPublicKeyInfo(
396 cert->os_cert_handle()));
397 }
398 {
399 scoped_refptr<net::X509Certificate> cert(net::ImportCertFromFile(
400 net::GetTestCertsDirectory(), "prime256v1-ecdsa-intermediate.pem"));
401 ASSERT_TRUE(cert.get());
402 EXPECT_EQ(
403 "04 D1 35 14 53 74 2F E1 E4 9B 41 9E 42 9D 10 6B\n"
404 "0B F4 16 8F BC A7 C7 A4 39 09 73 34 CB 87 DF 2F\n"
405 "7E 4A 5F B1 B5 E4 DC 49 41 4E A8 81 34 B5 DA 7D\n"
406 "27 7D 05 C1 BD 0A 29 6D AD A3 5D 37 7B 56 B7 1B\n"
407 "60",
408 x509_certificate_model::ProcessSubjectPublicKeyInfo(
409 cert->os_cert_handle()));
410 }
411 }
OLDNEW
« no previous file with comments | « chrome/common/net/x509_certificate_model_openssl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698