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

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

Issue 2577683002: Add unit tests for NSS-backed SSLPrivateKeys. (Closed)
Patch Set: build issues Created 4 years 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/net.gypi ('k') | net/ssl/ssl_platform_key_chromecast_unittest.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 23 matching lines...) Expand all
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; } 41 SSLPrivateKey::Type GetType() override { return SSLPrivateKey::Type::RSA; }
42 42
43 std::vector<SSLPrivateKey::Hash> GetDigestPreferences() override { 43 std::vector<SSLPrivateKey::Hash> GetDigestPreferences() override {
44 static const SSLPrivateKey::Hash kHashes[] = { 44 return std::vector<SSLPrivateKey::Hash>{SSLPrivateKey::Hash::SHA256,
45 SSLPrivateKey::Hash::SHA256, SSLPrivateKey::Hash::SHA1, 45 SSLPrivateKey::Hash::SHA1};
46 SSLPrivateKey::Hash::MD5_SHA1};
davidben 2016/12/14 16:03:06 MD5-SHA1 is weird and isn't advertised. (Doesn't m
47 return std::vector<SSLPrivateKey::Hash>(kHashes,
48 kHashes + arraysize(kHashes));
49 } 46 }
50 47
51 size_t GetMaxSignatureLengthInBytes() override { 48 size_t GetMaxSignatureLengthInBytes() override {
52 int len = PK11_SignatureLen(key_.get()); 49 int len = PK11_SignatureLen(key_.get());
53 if (len <= 0) 50 if (len <= 0)
54 return 0; 51 return 0;
55 return static_cast<size_t>(len); 52 return static_cast<size_t>(len);
56 } 53 }
57 54
58 Error SignDigest(SSLPrivateKey::Hash hash, 55 Error SignDigest(SSLPrivateKey::Hash hash,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 return ClientKeyStore::GetInstance()->FetchClientCertPrivateKey( 123 return ClientKeyStore::GetInstance()->FetchClientCertPrivateKey(
127 *certificate); 124 *certificate);
128 } 125 }
129 126
130 return make_scoped_refptr(new ThreadedSSLPrivateKey( 127 return make_scoped_refptr(new ThreadedSSLPrivateKey(
131 base::MakeUnique<SSLPlatformKeyChromecast>(std::move(key)), 128 base::MakeUnique<SSLPlatformKeyChromecast>(std::move(key)),
132 GetSSLPlatformKeyTaskRunner())); 129 GetSSLPlatformKeyTaskRunner()));
133 } 130 }
134 131
135 } // namespace net 132 } // namespace net
OLDNEW
« no previous file with comments | « net/net.gypi ('k') | net/ssl/ssl_platform_key_chromecast_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698