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

Side by Side Diff: net/ssl/ssl_private_key.h

Issue 1178193002: Sign CertificateVerify messages on a background thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef NET_SSL_SSL_PRIVATE_KEY_H_
6 #define NET_SSL_SSL_PRIVATE_KEY_H_
7
8 #include <vector>
9
10 #include "base/callback_forward.h"
11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/strings/string_piece.h"
14 #include "net/base/net_errors.h"
15
16 namespace net {
17
18 // An interface for a private key for use with SSL client authentication.
19 class SSLPrivateKey {
Ryan Sleevi 2015/06/12 23:37:20 It's unclear why you split this and the threaded i
davidben 2015/06/15 21:28:25 SSLClientSocketOpenSSL doesn't care that the opera
20 public:
21 using SignCallback = base::Callback<void(Error, const std::vector<uint8_t>&)>;
Ryan Sleevi 2015/06/12 23:37:20 Blergh; I generally hate typedefs like these; I fi
davidben 2015/06/15 21:28:25 It's used a medium-ish amount of times between thi
Ryan Sleevi 2015/06/15 22:35:27 I guess it depends on whether or not you're using
davidben 2015/06/15 22:41:20 Hrm? I'm not sure I follow. Is there any consumer
Ryan Sleevi 2015/06/15 23:02:06 Well, strictly speaking, callbacks are meant to br
22
23 enum class Type {
24 RSA,
25 ECDSA,
26 };
27
28 enum class Hash {
29 MD5_SHA1,
30 MD5,
31 SHA1,
32 SHA224,
33 SHA256,
34 SHA384,
35 SHA512,
36 };
37
38 SSLPrivateKey() {}
39 virtual ~SSLPrivateKey() {}
40
41 // Returns whether the key is an RSA key or an ECDSA key.
42 virtual Type GetType() = 0;
Ryan Sleevi 2015/06/12 23:37:20 :/ This seems to violate http://google-styleguide
davidben 2015/06/15 21:28:24 Per out-of-band discussion, added a comment to Get
43
44 // Returns true if the key supports signing hashes of type |hash|.
45 virtual bool SupportsHash(Hash hash) = 0;
46
47 // Returns the maximum size of a signature. For an RSA key, this must be the
48 // size of the modulus in bytes.
49 virtual size_t GetMaxSignatureLength() = 0;
Ryan Sleevi 2015/06/12 23:37:20 I suppose this API works because we assume asymetr
davidben 2015/06/15 21:28:25 I'm not sure what you mean. It's the caller's job
50
51 // Asynchronously signs an |input| which was computed with the hash |hash|. On
52 // completion, it calls |callback| with the signature or an error code if the
53 // operation failed. For an RSA key, the signature is a PKCS#1 signature. The
54 // SSLPrivateKey implementation is responsible for prepending the DigestInfo
55 // prefix and adding PKCS#1 padding.
56 virtual void SignDigest(Hash hash,
57 const base::StringPiece& input,
58 const SignCallback& callback) = 0;
59
60 private:
61 DISALLOW_COPY_AND_ASSIGN(SSLPrivateKey);
62 };
63
64 } // namespace net
65
66 #endif // NET_SSL_SSL_PRIVATE_KEY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698