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

Side by Side Diff: remoting/host/support_access_verifier.cc

Issue 7048020: Don't use letters in me2mom access code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | remoting/protocol/auth_token_utils.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "remoting/host/support_access_verifier.h" 5 #include "remoting/host/support_access_verifier.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/rand_util.h" 11 #include "base/rand_util.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "remoting/host/host_config.h" 13 #include "remoting/host/host_config.h"
14 #include "remoting/protocol/auth_token_utils.h" 14 #include "remoting/protocol/auth_token_utils.h"
15 15
16 namespace remoting { 16 namespace remoting {
17 17
18 namespace { 18 namespace {
19 // 5 characters long from 34-letter alphabet gives 4.5M possible 19 // 8 characters long from 10-letter alphabet gives 100M possible
20 // host secrets with uniform distribution, which should be enough 20 // host secrets with uniform distribution, which should be enough
21 // for short-term passwords. 21 // for short-term passwords.
22 const int kHostSecretLength = 5; 22 const int kHostSecretLength = 8;
23 23 const char kHostSecretAlphabet[] = "0123456789";
24 // The following set includes 10 digits and Latin alphabet except I
25 // and O. I and O are not used to avoid confusion with 1 and 0.
26 const char kHostSecretAlphabet[] = "ABCDEFGHJKLMNPQRSTUVWXYZ0123456789";
27 24
28 // Generates cryptographically strong random number in the range [0, max). 25 // Generates cryptographically strong random number in the range [0, max).
29 int CryptoRandomInt(int max) { 26 int CryptoRandomInt(int max) {
30 uint32 random_int32; 27 uint32 random_int32;
31 base::RandBytes(&random_int32, sizeof(random_int32)); 28 base::RandBytes(&random_int32, sizeof(random_int32));
32 return random_int32 % max; 29 return random_int32 % max;
33 } 30 }
34 31
35 std::string GenerateRandomHostSecret() { 32 std::string GenerateRandomHostSecret() {
36 std::vector<char> result; 33 std::vector<char> result;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 void SupportAccessVerifier::OnMe2MomHostRegistered( 67 void SupportAccessVerifier::OnMe2MomHostRegistered(
71 bool successful, const std::string& support_id) { 68 bool successful, const std::string& support_id) {
72 if (successful) { 69 if (successful) {
73 support_id_ = support_id; 70 support_id_ = support_id;
74 } else { 71 } else {
75 LOG(ERROR) << "Failed to register support host"; 72 LOG(ERROR) << "Failed to register support host";
76 } 73 }
77 } 74 }
78 75
79 } // namespace remoting 76 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | remoting/protocol/auth_token_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698