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

Side by Side Diff: net/data/name_constraints_unittest/generate_name_constraints.py

Issue 1686003002: Fix GeneralName directoryName parsing in new (unused) name constraints code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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/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 random 9 import random
10 import subprocess 10 import subprocess
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 s = 'x400Address = IMPLICIT:3,SEQUENCE:x400AddressSequence%i\n' % i 130 s = 'x400Address = IMPLICIT:3,SEQUENCE:x400AddressSequence%i\n' % i
131 s += '[x400AddressSequence%i]\n' % i 131 s += '[x400AddressSequence%i]\n' % i
132 s += 'builtinstandardattributes = SEQUENCE:BuiltInStandardAttributes%i\n' % i 132 s += 'builtinstandardattributes = SEQUENCE:BuiltInStandardAttributes%i\n' % i
133 s += '[BuiltInStandardAttributes%i]\n' % i 133 s += '[BuiltInStandardAttributes%i]\n' % i
134 s += 'countryname = EXPLICIT:1A,PRINTABLESTRING:US\n' 134 s += 'countryname = EXPLICIT:1A,PRINTABLESTRING:US\n'
135 return s 135 return s
136 136
137 137
138 def directory_name(name): 138 def directory_name(name):
139 return str(name).replace( 139 return str(name).replace(
140 'asn1 = SEQUENCE', 'directoryName = IMPLICIT:4,SEQUENCE') 140 'asn1 = SEQUENCE', 'directoryName = EXPLICIT:4,SEQUENCE')
141 141
142 142
143 def edi_party_name(): 143 def edi_party_name():
144 i = random.randint(0, sys.maxint) 144 i = random.randint(0, sys.maxint)
145 s = 'ediPartyName = IMPLICIT:5,SEQUENCE:ediPartyNameSequence%i\n' % i 145 s = 'ediPartyName = IMPLICIT:5,SEQUENCE:ediPartyNameSequence%i\n' % i
146 s += '[ediPartyNameSequence%i]\n' % i 146 s += '[ediPartyNameSequence%i]\n' % i
147 s += 'partyName = IMPLICIT:1,UTF8:foo\n' 147 s += 'partyName = IMPLICIT:1,UTF8:foo\n'
148 return s 148 return s
149 149
150 150
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 dns_name("permitted.example.com"), minimum=1, maximum=2)) 524 dns_name("permitted.example.com"), minimum=1, maximum=2))
525 generate(c, "dnsname-with_min_1_and_max.pem") 525 generate(c, "dnsname-with_min_1_and_max.pem")
526 526
527 c = NameConstraintsGenerator() 527 c = NameConstraintsGenerator()
528 c.add_permitted(with_min_max(dns_name("permitted.example.com"), maximum=2)) 528 c.add_permitted(with_min_max(dns_name("permitted.example.com"), maximum=2))
529 generate(c, "dnsname-with_max.pem") 529 generate(c, "dnsname-with_max.pem")
530 530
531 531
532 if __name__ == '__main__': 532 if __name__ == '__main__':
533 main() 533 main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698