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

Side by Side Diff: chrome/browser/chromeos/platform_keys/platform_keys_nss.cc

Issue 2898573002: Refactor client cert private key handling. (Closed)
Patch Set: rebase on https://codereview.chromium.org/2899083006/ Created 3 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <cert.h> 5 #include <cert.h>
6 #include <cryptohi.h> 6 #include <cryptohi.h>
7 #include <keyhi.h> 7 #include <keyhi.h>
8 #include <secder.h> 8 #include <secder.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 {base::MayBlock(), base::TaskPriority::BACKGROUND, 539 {base::MayBlock(), base::TaskPriority::BACKGROUND,
540 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, 540 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
541 base::Bind(&SignRSAOnWorkerThread, base::Passed(&state))); 541 base::Bind(&SignRSAOnWorkerThread, base::Passed(&state)));
542 } 542 }
543 543
544 // Called when ClientCertStoreChromeOS::GetClientCerts is done. Builds the list 544 // Called when ClientCertStoreChromeOS::GetClientCerts is done. Builds the list
545 // of net::CertificateList and calls back. Used by 545 // of net::CertificateList and calls back. Used by
546 // SelectCertificatesOnIOThread(). 546 // SelectCertificatesOnIOThread().
547 void DidSelectCertificatesOnIOThread( 547 void DidSelectCertificatesOnIOThread(
548 std::unique_ptr<SelectCertificatesState> state, 548 std::unique_ptr<SelectCertificatesState> state,
549 net::CertificateList certs) { 549 net::ClientCertIdentityList identities) {
550 DCHECK_CURRENTLY_ON(BrowserThread::IO); 550 DCHECK_CURRENTLY_ON(BrowserThread::IO);
551 state->CallBack(FROM_HERE, 551 // XXX convert the ClientCertIdentityList to a CertificateList since
552 base::MakeUnique<net::CertificateList>(std::move(certs)), 552 // returning ClientCertIdentities would require changing platformKeys
553 std::string() /* no error */); 553 // extension api.
554 std::unique_ptr<net::CertificateList> certs =
555 base::MakeUnique<net::CertificateList>();
556 for (const std::unique_ptr<net::ClientCertIdentity>& identity : identities)
557 certs->push_back(identity->certificate());
558 state->CallBack(FROM_HERE, std::move(certs), std::string() /* no error */);
554 } 559 }
555 560
556 // Continues selecting certificates on the IO thread. Used by 561 // Continues selecting certificates on the IO thread. Used by
557 // SelectClientCertificates(). 562 // SelectClientCertificates().
558 void SelectCertificatesOnIOThread( 563 void SelectCertificatesOnIOThread(
559 std::unique_ptr<SelectCertificatesState> state) { 564 std::unique_ptr<SelectCertificatesState> state) {
560 DCHECK_CURRENTLY_ON(BrowserThread::IO); 565 DCHECK_CURRENTLY_ON(BrowserThread::IO);
561 state->cert_store_.reset(new ClientCertStoreChromeOS( 566 state->cert_store_.reset(new ClientCertStoreChromeOS(
562 nullptr, // no additional provider 567 nullptr, // no additional provider
563 base::MakeUnique<ClientCertFilterChromeOS>(state->use_system_key_slot_, 568 base::MakeUnique<ClientCertFilterChromeOS>(state->use_system_key_slot_,
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 NSSOperationState* state_ptr = state.get(); 904 NSSOperationState* state_ptr = state.get();
900 GetCertDatabase(std::string() /* don't get any specific slot */, 905 GetCertDatabase(std::string() /* don't get any specific slot */,
901 base::Bind(&GetTokensWithDB, base::Passed(&state)), 906 base::Bind(&GetTokensWithDB, base::Passed(&state)),
902 browser_context, 907 browser_context,
903 state_ptr); 908 state_ptr);
904 } 909 }
905 910
906 } // namespace platform_keys 911 } // namespace platform_keys
907 912
908 } // namespace chromeos 913 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698