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

Side by Side Diff: net/ssl/ssl_platform_key_chromecast.cc

Issue 2822283002: Remove SSLPrivateKey metadata hooks. (Closed)
Patch Set: emaxx comment Created 3 years, 8 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
« no previous file with comments | « net/ssl/ssl_platform_key_android_unittest.cc ('k') | net/ssl/ssl_platform_key_mac.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <keyhi.h> 5 #include <keyhi.h>
6 #include <pk11pub.h> 6 #include <pk11pub.h>
7 #include <prerror.h> 7 #include <prerror.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 20 matching lines...) Expand all
31 err_name = ""; 31 err_name = "";
32 LOG(ERROR) << "Could not sign digest: " << err << " (" << err_name << ")"; 32 LOG(ERROR) << "Could not sign digest: " << err << " (" << err_name << ")";
33 } 33 }
34 34
35 class SSLPlatformKeyChromecast : public ThreadedSSLPrivateKey::Delegate { 35 class SSLPlatformKeyChromecast : public ThreadedSSLPrivateKey::Delegate {
36 public: 36 public:
37 SSLPlatformKeyChromecast(crypto::ScopedSECKEYPrivateKey key) 37 SSLPlatformKeyChromecast(crypto::ScopedSECKEYPrivateKey key)
38 : key_(std::move(key)) {} 38 : key_(std::move(key)) {}
39 ~SSLPlatformKeyChromecast() override {} 39 ~SSLPlatformKeyChromecast() override {}
40 40
41 SSLPrivateKey::Type GetType() override { return SSLPrivateKey::Type::RSA; }
42
43 std::vector<SSLPrivateKey::Hash> GetDigestPreferences() override { 41 std::vector<SSLPrivateKey::Hash> GetDigestPreferences() override {
44 return std::vector<SSLPrivateKey::Hash>{SSLPrivateKey::Hash::SHA256, 42 return std::vector<SSLPrivateKey::Hash>{SSLPrivateKey::Hash::SHA256,
45 SSLPrivateKey::Hash::SHA1}; 43 SSLPrivateKey::Hash::SHA1};
46 } 44 }
47 45
48 size_t GetMaxSignatureLengthInBytes() override {
49 int len = PK11_SignatureLen(key_.get());
50 if (len <= 0)
51 return 0;
52 return static_cast<size_t>(len);
53 }
54
55 Error SignDigest(SSLPrivateKey::Hash hash, 46 Error SignDigest(SSLPrivateKey::Hash hash,
56 const base::StringPiece& input, 47 const base::StringPiece& input,
57 std::vector<uint8_t>* signature) override { 48 std::vector<uint8_t>* signature) override {
58 SECItem digest_item; 49 SECItem digest_item;
59 digest_item.data = 50 digest_item.data =
60 const_cast<uint8_t*>(reinterpret_cast<const uint8_t*>(input.data())); 51 const_cast<uint8_t*>(reinterpret_cast<const uint8_t*>(input.data()));
61 digest_item.len = input.size(); 52 digest_item.len = input.size();
62 53
63 bssl::UniquePtr<uint8_t> free_digest_info; 54 bssl::UniquePtr<uint8_t> free_digest_info;
64 // PK11_Sign expects the caller to prepend the DigestInfo. 55 // PK11_Sign expects the caller to prepend the DigestInfo.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 return ClientKeyStore::GetInstance()->FetchClientCertPrivateKey( 114 return ClientKeyStore::GetInstance()->FetchClientCertPrivateKey(
124 *certificate); 115 *certificate);
125 } 116 }
126 117
127 return make_scoped_refptr(new ThreadedSSLPrivateKey( 118 return make_scoped_refptr(new ThreadedSSLPrivateKey(
128 base::MakeUnique<SSLPlatformKeyChromecast>(std::move(key)), 119 base::MakeUnique<SSLPlatformKeyChromecast>(std::move(key)),
129 GetSSLPlatformKeyTaskRunner())); 120 GetSSLPlatformKeyTaskRunner()));
130 } 121 }
131 122
132 } // namespace net 123 } // namespace net
OLDNEW
« no previous file with comments | « net/ssl/ssl_platform_key_android_unittest.cc ('k') | net/ssl/ssl_platform_key_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698