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

Side by Side Diff: net/tools/testserver/minica.py

Issue 10188005: testserver: pass options through bytes() before using with binary data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | no next file » | 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 import asn1 5 import asn1
6 import hashlib 6 import hashlib
7 import os 7 import os
8 8
9 9
10 # This file implements very minimal certificate and OCSP generation. It's 10 # This file implements very minimal certificate and OCSP generation. It's
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 def GenerateCertKeyAndOCSP(subject = "127.0.0.1", 311 def GenerateCertKeyAndOCSP(subject = "127.0.0.1",
312 ocsp_url = "http://127.0.0.1", 312 ocsp_url = "http://127.0.0.1",
313 ocsp_revoked = False): 313 ocsp_revoked = False):
314 '''GenerateCertKeyAndOCSP returns a (cert_and_key_pem, ocsp_der) where: 314 '''GenerateCertKeyAndOCSP returns a (cert_and_key_pem, ocsp_der) where:
315 * cert_and_key_pem contains a certificate and private key in PEM format 315 * cert_and_key_pem contains a certificate and private key in PEM format
316 with the given subject common name and OCSP URL. 316 with the given subject common name and OCSP URL.
317 * ocsp_der contains a DER encoded OCSP response or None if ocsp_url is 317 * ocsp_der contains a DER encoded OCSP response or None if ocsp_url is
318 None''' 318 None'''
319 319
320 serial = RandomNumber(16) 320 serial = RandomNumber(16)
321 cert_der = MakeCertificate(ISSUER_CN, subject, serial, KEY, KEY, ocsp_url) 321 cert_der = MakeCertificate(ISSUER_CN, bytes(subject), serial, KEY, KEY,
322 bytes(ocsp_url))
322 cert_pem = DERToPEM(cert_der) 323 cert_pem = DERToPEM(cert_der)
323 324
324 ocsp_der = None 325 ocsp_der = None
325 if ocsp_url is not None: 326 if ocsp_url is not None:
326 ocsp_der = MakeOCSPResponse(ISSUER_CN, KEY, serial, ocsp_revoked) 327 ocsp_der = MakeOCSPResponse(ISSUER_CN, KEY, serial, ocsp_revoked)
327 328
328 return (cert_pem + KEY_PEM, ocsp_der) 329 return (cert_pem + KEY_PEM, ocsp_der)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698