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

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

Issue 6805019: Move crypto files out of base, to a top level directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fixes comments by eroman Created 9 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 | Annotate | Revision Log
« no previous file with comments | « remoting/host/host_key_pair.cc ('k') | remoting/host/simple_host_process.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 // This is a tool used by register_host.py to generate RSA keypair. It just 5 // This is a tool used by register_host.py to generate RSA keypair. It just
6 // generates new keys and prints them on stdout. 6 // generates new keys and prints them on stdout.
7 // 7 //
8 // This code will need to be integrated with the host registration UI. 8 // This code will need to be integrated with the host registration UI.
9 9
10 #include <stdio.h> 10 #include <stdio.h>
11 11
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/at_exit.h" 14 #include "base/at_exit.h"
15 #include "base/base64.h" 15 #include "base/base64.h"
16 #include "base/crypto/rsa_private_key.h" 16 #include "crypto/rsa_private_key.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 18
19 int main(int argc, char** argv) { 19 int main(int argc, char** argv) {
20 base::AtExitManager exit_manager; 20 base::AtExitManager exit_manager;
21 21
22 scoped_ptr<base::RSAPrivateKey> key(base::RSAPrivateKey::Create(2048)); 22 scoped_ptr<crypto::RSAPrivateKey> key(crypto::RSAPrivateKey::Create(2048));
23 23
24 std::vector<uint8> private_key_buf; 24 std::vector<uint8> private_key_buf;
25 key->ExportPrivateKey(&private_key_buf); 25 key->ExportPrivateKey(&private_key_buf);
26 std::string private_key_str(private_key_buf.begin(), private_key_buf.end()); 26 std::string private_key_str(private_key_buf.begin(), private_key_buf.end());
27 std::string private_key_base64; 27 std::string private_key_base64;
28 base::Base64Encode(private_key_str, &private_key_base64); 28 base::Base64Encode(private_key_str, &private_key_base64);
29 printf("%s\n", private_key_base64.c_str()); 29 printf("%s\n", private_key_base64.c_str());
30 30
31 std::vector<uint8> public_key_buf; 31 std::vector<uint8> public_key_buf;
32 key->ExportPublicKey(&public_key_buf); 32 key->ExportPublicKey(&public_key_buf);
33 std::string public_key_str(public_key_buf.begin(), public_key_buf.end()); 33 std::string public_key_str(public_key_buf.begin(), public_key_buf.end());
34 std::string public_key_base64; 34 std::string public_key_base64;
35 base::Base64Encode(public_key_str, &public_key_base64); 35 base::Base64Encode(public_key_str, &public_key_base64);
36 printf("%s\n", public_key_base64.c_str()); 36 printf("%s\n", public_key_base64.c_str());
37 } 37 }
OLDNEW
« no previous file with comments | « remoting/host/host_key_pair.cc ('k') | remoting/host/simple_host_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698