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

Side by Side Diff: chrome/browser/policy/test/policy_testserver.py

Issue 211173006: Perform tlslite 0.3.8 -> 0.4.6 renames ahead of time. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Drop the -B Created 6 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 | « no previous file | third_party/tlslite/README.chromium » ('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) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 """A bare-bones test server for testing cloud policy support. 5 """A bare-bones test server for testing cloud policy support.
6 6
7 This implements a simple cloud policy test server that can be used to test 7 This implements a simple cloud policy test server that can be used to test
8 chrome's device management service client. The policy information is read from 8 chrome's device management service client. The policy information is read from
9 the file named device_management in the server's data directory. It contains 9 the file named device_management in the server's data directory. It contains
10 enforced and recommended policies for the device and user scope, and a list 10 enforced and recommended policies for the device and user scope, and a list
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 # Load specified keys from the filesystem. 840 # Load specified keys from the filesystem.
841 for key_path in private_key_paths: 841 for key_path in private_key_paths:
842 try: 842 try:
843 key_str = open(key_path).read() 843 key_str = open(key_path).read()
844 except IOError: 844 except IOError:
845 print 'Failed to load private key from %s' % key_path 845 print 'Failed to load private key from %s' % key_path
846 continue 846 continue
847 try: 847 try:
848 key = tlslite.api.parsePEMKey(key_str, private=True) 848 key = tlslite.api.parsePEMKey(key_str, private=True)
849 except SyntaxError: 849 except SyntaxError:
850 key = tlslite.utils.Python_RSAKey.Python_RSAKey._parsePKCS8( 850 key = tlslite.utils.python_rsakey.Python_RSAKey._parsePKCS8(
851 tlslite.utils.cryptomath.stringToBytes(key_str)) 851 tlslite.utils.cryptomath.stringToBytes(key_str))
852 852
853 assert key is not None 853 assert key is not None
854 key_info = { 'private_key' : key } 854 key_info = { 'private_key' : key }
855 855
856 # Now try to read in a signature, if one exists. 856 # Now try to read in a signature, if one exists.
857 try: 857 try:
858 key_sig = open(key_path + '.sig').read() 858 key_sig = open(key_path + '.sig').read()
859 # Create a dictionary with the wildcard domain + signature 859 # Create a dictionary with the wildcard domain + signature
860 key_info['signatures'] = {'*': key_sig} 860 key_info['signatures'] = {'*': key_sig}
861 except IOError: 861 except IOError:
862 print 'Failed to read validation signature from %s.sig' % key_path 862 print 'Failed to read validation signature from %s.sig' % key_path
863 self.keys.append(key_info) 863 self.keys.append(key_info)
864 else: 864 else:
865 # Use the canned private keys if none were passed from the command line. 865 # Use the canned private keys if none were passed from the command line.
866 for signing_key in SIGNING_KEYS: 866 for signing_key in SIGNING_KEYS:
867 decoded_key = base64.b64decode(signing_key['key']); 867 decoded_key = base64.b64decode(signing_key['key']);
868 key = tlslite.utils.Python_RSAKey.Python_RSAKey._parsePKCS8( 868 key = tlslite.utils.python_rsakey.Python_RSAKey._parsePKCS8(
869 tlslite.utils.cryptomath.stringToBytes(decoded_key)) 869 tlslite.utils.cryptomath.stringToBytes(decoded_key))
870 assert key is not None 870 assert key is not None
871 # Grab the signature dictionary for this key and decode all of the 871 # Grab the signature dictionary for this key and decode all of the
872 # signatures. 872 # signatures.
873 signature_dict = signing_key['signatures'] 873 signature_dict = signing_key['signatures']
874 decoded_signatures = {} 874 decoded_signatures = {}
875 for domain in signature_dict: 875 for domain in signature_dict:
876 decoded_signatures[domain] = base64.b64decode(signature_dict[domain]) 876 decoded_signatures[domain] = base64.b64decode(signature_dict[domain])
877 self.keys.append({'private_key': key, 877 self.keys.append({'private_key': key,
878 'signatures': decoded_signatures}) 878 'signatures': decoded_signatures})
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 if (self.options.log_to_console): 1184 if (self.options.log_to_console):
1185 logger.addHandler(logging.StreamHandler()) 1185 logger.addHandler(logging.StreamHandler())
1186 if (self.options.log_file): 1186 if (self.options.log_file):
1187 logger.addHandler(logging.FileHandler(self.options.log_file)) 1187 logger.addHandler(logging.FileHandler(self.options.log_file))
1188 1188
1189 testserver_base.TestServerRunner.run_server(self) 1189 testserver_base.TestServerRunner.run_server(self)
1190 1190
1191 1191
1192 if __name__ == '__main__': 1192 if __name__ == '__main__':
1193 sys.exit(PolicyServerRunner().main()) 1193 sys.exit(PolicyServerRunner().main())
OLDNEW
« no previous file with comments | « no previous file | third_party/tlslite/README.chromium » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698