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

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

Issue 1685023002: Fix API mismatch between NameConstraints::IsPermittedCert's subjectAltName param and ParseExtension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@name-constraints-directorynameparsing
Patch Set: updated comments 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 29 matching lines...) Expand all
40 def __init__(self): 40 def __init__(self):
41 self.names = [] 41 self.names = []
42 42
43 def token(self): 43 def token(self):
44 return "SUBJECT ALTERNATIVE NAME" 44 return "SUBJECT ALTERNATIVE NAME"
45 45
46 def add_name(self, general_name): 46 def add_name(self, general_name):
47 self.names.append(general_name) 47 self.names.append(general_name)
48 48
49 def __str__(self): 49 def __str__(self):
50 s = "asn1 = OCTWRAP,SEQUENCE:subjectAltNameSequence\n" 50 s = "asn1 = SEQUENCE:subjectAltNameSequence\n"
51 s += "[subjectAltNameSequence]\n" 51 s += "[subjectAltNameSequence]\n"
52 s_suffix = "" 52 s_suffix = ""
53 for n, name in enumerate(self.names): 53 for n, name in enumerate(self.names):
54 n1, n2 = (str(name) + '\n').split('\n', 1) 54 n1, n2 = (str(name) + '\n').split('\n', 1)
55 if n2: 55 if n2:
56 s_suffix += n2 + '\n' 56 s_suffix += n2 + '\n'
57 s += '%s%s\n' % (n, n1) 57 s += '%s%s\n' % (n, n1)
58 58
59 return s + s_suffix 59 return s + s_suffix
60 60
(...skipping 463 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
« no previous file with comments | « net/cert/internal/name_constraints_unittest.cc ('k') | net/data/name_constraints_unittest/san-edipartyname.pem » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698