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

Side by Side Diff: net/data/verify_certificate_chain_unittest/common.py

Issue 2326923002: Introduce CertErrors::ToDebugString(). (Closed)
Patch Set: checkpoint Created 4 years, 3 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
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2015 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Set of helpers to generate signed X.509v3 certificates. 6 """Set of helpers to generate signed X.509v3 certificates.
7 7
8 This works by shelling out calls to the 'openssl req' and 'openssl ca' 8 This works by shelling out calls to the 'openssl req' and 'openssl ca'
9 commands, and passing the appropriate command line flags and configuration file 9 commands, and passing the appropriate command line flags and configuration file
10 (.cnf). 10 (.cnf).
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 # Write the certificate chain to the output file. 446 # Write the certificate chain to the output file.
447 for cert in chain: 447 for cert in chain:
448 test_data += '\n' + cert.get_cert_pem() 448 test_data += '\n' + cert.get_cert_pem()
449 449
450 test_data += '\n' + trust_anchor.get_pem() 450 test_data += '\n' + trust_anchor.get_pem()
451 test_data += '\n' + text_data_to_pem('TIME', utc_time) 451 test_data += '\n' + text_data_to_pem('TIME', utc_time)
452 452
453 verify_result_string = 'SUCCESS' if verify_result else 'FAIL' 453 verify_result_string = 'SUCCESS' if verify_result else 'FAIL'
454 test_data += '\n' + text_data_to_pem('VERIFY_RESULT', verify_result_string) 454 test_data += '\n' + text_data_to_pem('VERIFY_RESULT', verify_result_string)
455 455
456 # TODO(eroman): Make the consumer pass errors as a string.
456 if errors is not None: 457 if errors is not None:
457 test_data += '\n' + text_data_to_pem('ERRORS', '\n'.join(errors)) 458 test_data += '\n' + text_data_to_pem('ERRORS', '\n'.join(errors))
458 459
459 write_string_to_file(test_data, out_pem if out_pem else g_out_pem) 460 write_string_to_file(test_data, out_pem if out_pem else g_out_pem)
460 461
461 462
462 def write_string_to_file(data, path): 463 def write_string_to_file(data, path):
463 with open(path, 'w') as f: 464 with open(path, 'w') as f:
464 f.write(data) 465 f.write(data)
465 466
(...skipping 30 matching lines...) Expand all
496 497
497 498
498 def create_intermediate_certificate(name, issuer): 499 def create_intermediate_certificate(name, issuer):
499 return Certificate(name, TYPE_CA, issuer) 500 return Certificate(name, TYPE_CA, issuer)
500 501
501 502
502 def create_end_entity_certificate(name, issuer): 503 def create_end_entity_certificate(name, issuer):
503 return Certificate(name, TYPE_END_ENTITY, issuer) 504 return Certificate(name, TYPE_END_ENTITY, issuer)
504 505
505 init(sys.argv[0]) 506 init(sys.argv[0])
OLDNEW
« no previous file with comments | « net/data/verify_certificate_chain_unittest/README ('k') | net/tools/cert_verify_tool/verify_using_path_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698