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

Side by Side Diff: content/browser/media/webrtc_identity_store.h

Issue 15969025: Generates the DTLS identity in browser process and returns it to render process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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
« no previous file with comments | « no previous file | content/browser/media/webrtc_identity_store.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 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 CONTENT_BROWSER_MEDIA_WEBRTC_IDENTITY_STORE_H_
6 #define CONTENT_BROWSER_MEDIA_WEBRTC_IDENTITY_STORE_H_
7
8 #include <string>
9
10 #include "base/callback.h"
11 #include "content/common/content_export.h"
12
13 class GURL;
14
15 namespace base {
16 class TaskRunner;
17 } // namespace base
18
19 namespace content {
20
21 class WebRTCIdentityStoreTest;
22
23 // A class for creating and fetching DTLS identities, i.e. the private key and
24 // the self-signed certificate.
25 class CONTENT_EXPORT WebRTCIdentityStore {
26 public:
27 typedef base::Callback<void(int error,
28 const std::string& certificate,
29 const std::string& private_key)>
30 CompletionCallback;
31
32 WebRTCIdentityStore();
33 ~WebRTCIdentityStore();
34
35 // Retrieve the cached DTLS private key and certificate, i.e. identity, for
36 // the |origin| and |identity_name| pair, or generate a new identity using
37 // |common_name| if such an identity does not exist.
38 // If the given |common_name| is different from the common name in the cached
39 // identity that has the same origin and identity_name, a new private key and
40 // a new certificate will be generated, overwriting the old one.
41 // TODO(jiayl): implement identity caching through a persistent storage.
42 //
43 // |origin| is the origin of the DTLS connection;
44 // |identity_name| is used to identify an identity within an origin; it is
45 // opaque to WebRTCIdentityStore and remains private to the caller, i.e. not
46 // present in the certificate;
47 // |common_name| is the common name used to generate the certificate and will
48 // be shared with the peer of the DTLS connection. Identities created for
49 // different origins or different identity names may have the same common
50 // name.
51 // |callback| is the callback to return the result.
52 //
53 // Returns the Closure used to cancel the request if the request is accepted.
54 // The Closure can only be called before the request completes.
55 base::Closure RequestIdentity(const GURL& origin,
56 const std::string& identity_name,
57 const std::string& common_name,
58 const CompletionCallback& callback);
59
60 private:
61 friend class WebRTCIdentityStoreTest;
62
63 void SetTaskRunnerForTesting(
64 const scoped_refptr<base::TaskRunner>& task_runner);
65
66 // The TaskRunner for doing work on a worker thread.
67 scoped_refptr<base::TaskRunner> task_runner_;
68
69 DISALLOW_COPY_AND_ASSIGN(WebRTCIdentityStore);
70 };
71
72 } // namespace content
73
74 #endif // CONTENT_BROWSER_MEDIA_WEBRTC_IDENTITY_STORE_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/media/webrtc_identity_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698