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

Side by Side Diff: net/data/verify_name_match_unittest/scripts/generate_names.py

Issue 1214933009: Class for parsing and evaluating RFC 5280 NameConstraints. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@compare_DN2
Patch Set: changes for comment #16 Created 5 years, 1 month 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
« no previous file with comments | « net/data/verify_name_match_unittest/scripts/generate-names.py ('k') | net/der/tag.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2015 The Chromium Authors. All rights reserved. 2 # Copyright 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 import base64 6 import base64
7 import copy 7 import copy
8 import os 8 import os
9 import subprocess 9 import subprocess
10 import tempfile 10 import tempfile
(...skipping 26 matching lines...) Expand all
37 s += attr_modifier + ',' 37 s += attr_modifier + ','
38 s += '%s:"%s"\n' % (attr_value_type, attr_value) 38 s += '%s:"%s"\n' % (attr_value_type, attr_value)
39 39
40 return s 40 return s
41 41
42 42
43 class NameGenerator: 43 class NameGenerator:
44 def __init__(self): 44 def __init__(self):
45 self.rdns = [] 45 self.rdns = []
46 46
47 def token(self):
48 return "NAME"
49
47 def add_rdn(self): 50 def add_rdn(self):
48 rdn = RDN() 51 rdn = RDN()
49 self.rdns.append(rdn) 52 self.rdns.append(rdn)
50 return rdn 53 return rdn
51 54
52 def __str__(self): 55 def __str__(self):
53 s = 'asn1 = SEQUENCE:rdnSequence\n\n[rdnSequence]\n' 56 s = 'asn1 = SEQUENCE:rdnSequence%i\n\n[rdnSequence%i]\n' % (
57 id(self), id(self))
54 for n, rdn in enumerate(self.rdns): 58 for n, rdn in enumerate(self.rdns):
55 s += 'rdn%i = SET:rdnSet%i\n' % (n, n) 59 s += 'rdn%i = SET:rdnSet%i_%i\n' % (n, id(self), n)
56 60
57 s += '\n' 61 s += '\n'
58 62
59 for n, rdn in enumerate(self.rdns): 63 for n, rdn in enumerate(self.rdns):
60 s += '[rdnSet%i]\n%s\n' % (n, rdn) 64 s += '[rdnSet%i_%i]\n%s\n' % (id(self), n, rdn)
61 65
62 return s 66 return s
63 67
64 68
65 def generate(s, fn): 69 def generate(s, fn):
66 out_fn = os.path.join('..', 'names', fn + '.pem') 70 out_fn = os.path.join('..', 'names', fn + '.pem')
67 conf_tempfile = tempfile.NamedTemporaryFile() 71 conf_tempfile = tempfile.NamedTemporaryFile()
68 conf_tempfile.write(str(s)) 72 conf_tempfile.write(str(s))
69 conf_tempfile.flush() 73 conf_tempfile.flush()
70 der_tmpfile = tempfile.NamedTemporaryFile() 74 der_tmpfile = tempfile.NamedTemporaryFile()
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 rdn0 = SET:rdnSet0 325 rdn0 = SET:rdnSet0
322 [rdnSet0] 326 [rdnSet0]
323 attrTypeAndValue0=SEQUENCE:attrTypeAndValueSequence0_0 327 attrTypeAndValue0=SEQUENCE:attrTypeAndValueSequence0_0
324 [attrTypeAndValueSequence0_0] 328 [attrTypeAndValueSequence0_0]
325 type=OID:countryName 329 type=OID:countryName
326 value=PRINTABLESTRING:"US" 330 value=PRINTABLESTRING:"US"
327 """, "valid-minimal") 331 """, "valid-minimal")
328 332
329 if __name__ == '__main__': 333 if __name__ == '__main__':
330 main() 334 main()
OLDNEW
« no previous file with comments | « net/data/verify_name_match_unittest/scripts/generate-names.py ('k') | net/der/tag.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698