| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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() |
| OLD | NEW |