1# coding: utf-8 2# 3# This file is part of pyasn1-modules software. 4# 5# Created by Stanisław Pitucha with asn1ate tool. 6# Copyright (c) 2005-2017, Ilya Etingof <etingof@gmail.com> 7# License: http://pyasn1.sf.net/license.html 8# 9# Internet X.509 Public Key Infrastructure Certificate and Certificate 10# Revocation List (CRL) Profile 11# 12# ASN.1 source from: 13# http://www.ietf.org/rfc/rfc3280.txt 14# 15from pyasn1.type import char 16from pyasn1.type import constraint 17from pyasn1.type import namedtype 18from pyasn1.type import namedval 19from pyasn1.type import tag 20from pyasn1.type import univ 21from pyasn1.type import useful 22 23MAX = float('inf') 24 25 26def _OID(*components): 27 output = [] 28 for x in tuple(components): 29 if isinstance(x, univ.ObjectIdentifier): 30 output.extend(list(x)) 31 else: 32 output.append(int(x)) 33 34 return univ.ObjectIdentifier(output) 35 36 37unformatted_postal_address = univ.Integer(16) 38 39ub_organizational_units = univ.Integer(4) 40 41ub_organizational_unit_name_length = univ.Integer(32) 42 43 44class OrganizationalUnitName(char.PrintableString): 45 pass 46 47 48OrganizationalUnitName.subtypeSpec = constraint.ValueSizeConstraint(1, ub_organizational_unit_name_length) 49 50 51class OrganizationalUnitNames(univ.SequenceOf): 52 pass 53 54 55OrganizationalUnitNames.componentType = OrganizationalUnitName() 56OrganizationalUnitNames.subtypeSpec = constraint.ValueSizeConstraint(1, ub_organizational_units) 57 58 59class AttributeType(univ.ObjectIdentifier): 60 pass 61 62 63id_at = _OID(2, 5, 4) 64 65id_at_name = _OID(id_at, 41) 66 67ub_pds_parameter_length = univ.Integer(30) 68 69 70class PDSParameter(univ.Set): 71 pass 72 73 74PDSParameter.componentType = namedtype.NamedTypes( 75 namedtype.OptionalNamedType('printable-string', char.PrintableString().subtype( 76 subtypeSpec=constraint.ValueSizeConstraint(1, ub_pds_parameter_length))), 77 namedtype.OptionalNamedType('teletex-string', char.TeletexString().subtype( 78 subtypeSpec=constraint.ValueSizeConstraint(1, ub_pds_parameter_length))) 79) 80 81 82class PhysicalDeliveryOrganizationName(PDSParameter): 83 pass 84 85 86ub_organization_name_length = univ.Integer(64) 87 88ub_domain_defined_attribute_type_length = univ.Integer(8) 89 90ub_domain_defined_attribute_value_length = univ.Integer(128) 91 92 93class TeletexDomainDefinedAttribute(univ.Sequence): 94 pass 95 96 97TeletexDomainDefinedAttribute.componentType = namedtype.NamedTypes( 98 namedtype.NamedType('type', char.TeletexString().subtype( 99 subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_defined_attribute_type_length))), 100 namedtype.NamedType('value', char.TeletexString().subtype( 101 subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_defined_attribute_value_length))) 102) 103 104id_pkix = _OID(1, 3, 6, 1, 5, 5, 7) 105 106id_qt = _OID(id_pkix, 2) 107 108 109class PresentationAddress(univ.Sequence): 110 pass 111 112 113PresentationAddress.componentType = namedtype.NamedTypes( 114 namedtype.OptionalNamedType('pSelector', univ.OctetString().subtype( 115 explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))), 116 namedtype.OptionalNamedType('sSelector', univ.OctetString().subtype( 117 explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))), 118 namedtype.OptionalNamedType('tSelector', univ.OctetString().subtype( 119 explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))), 120 namedtype.NamedType('nAddresses', univ.SetOf(componentType=univ.OctetString()).subtype( 121 explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))) 122) 123 124 125class AlgorithmIdentifier(univ.Sequence): 126 pass 127 128 129AlgorithmIdentifier.componentType = namedtype.NamedTypes( 130 namedtype.NamedType('algorithm', univ.ObjectIdentifier()), 131 namedtype.OptionalNamedType('parameters', univ.Any()) 132) 133 134 135class UniqueIdentifier(univ.BitString): 136 pass 137 138 139class Extension(univ.Sequence): 140 pass 141 142 143Extension.componentType = namedtype.NamedTypes( 144 namedtype.NamedType('extnID', univ.ObjectIdentifier()), 145 namedtype.DefaultedNamedType('critical', univ.Boolean().subtype(value=0)), 146 namedtype.NamedType('extnValue', univ.OctetString()) 147) 148 149 150class Extensions(univ.SequenceOf): 151 pass 152 153 154Extensions.componentType = Extension() 155Extensions.subtypeSpec = constraint.ValueSizeConstraint(1, MAX) 156 157 158class CertificateSerialNumber(univ.Integer): 159 pass 160 161 162class SubjectPublicKeyInfo(univ.Sequence): 163 pass 164 165 166SubjectPublicKeyInfo.componentType = namedtype.NamedTypes( 167 namedtype.NamedType('algorithm', AlgorithmIdentifier()), 168 namedtype.NamedType('subjectPublicKey', univ.BitString()) 169) 170 171 172class Time(univ.Choice): 173 pass 174 175 176Time.componentType = namedtype.NamedTypes( 177 namedtype.NamedType('utcTime', useful.UTCTime()), 178 namedtype.NamedType('generalTime', useful.GeneralizedTime()) 179) 180 181 182class Validity(univ.Sequence): 183 pass 184 185 186Validity.componentType = namedtype.NamedTypes( 187 namedtype.NamedType('notBefore', Time()), 188 namedtype.NamedType('notAfter', Time()) 189) 190 191 192class Version(univ.Integer): 193 pass 194 195 196Version.namedValues = namedval.NamedValues( 197 ('v1', 0), 198 ('v2', 1), 199 ('v3', 2) 200) 201 202 203class AttributeValue(univ.Any): 204 pass 205 206 207class AttributeTypeAndValue(univ.Sequence): 208 pass 209 210 211AttributeTypeAndValue.componentType = namedtype.NamedTypes( 212 namedtype.NamedType('type', AttributeType()), 213 namedtype.NamedType('value', AttributeValue()) 214) 215 216 217class RelativeDistinguishedName(univ.SetOf): 218 pass 219 220 221RelativeDistinguishedName.componentType = AttributeTypeAndValue() 222RelativeDistinguishedName.subtypeSpec = constraint.ValueSizeConstraint(1, MAX) 223 224 225class RDNSequence(univ.SequenceOf): 226 pass 227 228 229RDNSequence.componentType = RelativeDistinguishedName() 230 231 232class Name(univ.Choice): 233 pass 234 235 236Name.componentType = namedtype.NamedTypes( 237 namedtype.NamedType('rdnSequence', RDNSequence()) 238) 239 240 241class TBSCertificate(univ.Sequence): 242 pass 243 244 245TBSCertificate.componentType = namedtype.NamedTypes( 246 namedtype.DefaultedNamedType('version', 247 Version().subtype(explicitTag=tag.Tag(tag.tagClassContext, 248 tag.tagFormatSimple, 0)).subtype(value="v1")), 249 namedtype.NamedType('serialNumber', CertificateSerialNumber()), 250 namedtype.NamedType('signature', AlgorithmIdentifier()), 251 namedtype.NamedType('issuer', Name()), 252 namedtype.NamedType('validity', Validity()), 253 namedtype.NamedType('subject', Name()), 254 namedtype.NamedType('subjectPublicKeyInfo', SubjectPublicKeyInfo()), 255 namedtype.OptionalNamedType('issuerUniqueID', UniqueIdentifier().subtype( 256 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))), 257 namedtype.OptionalNamedType('subjectUniqueID', UniqueIdentifier().subtype( 258 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))), 259 namedtype.OptionalNamedType('extensions', 260 Extensions().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))) 261) 262 263 264class Certificate(univ.Sequence): 265 pass 266 267 268Certificate.componentType = namedtype.NamedTypes( 269 namedtype.NamedType('tbsCertificate', TBSCertificate()), 270 namedtype.NamedType('signatureAlgorithm', AlgorithmIdentifier()), 271 namedtype.NamedType('signature', univ.BitString()) 272) 273 274ub_surname_length = univ.Integer(40) 275 276 277class TeletexOrganizationName(char.TeletexString): 278 pass 279 280 281TeletexOrganizationName.subtypeSpec = constraint.ValueSizeConstraint(1, ub_organization_name_length) 282 283ub_e163_4_sub_address_length = univ.Integer(40) 284 285teletex_common_name = univ.Integer(2) 286 287ub_country_name_alpha_length = univ.Integer(2) 288 289ub_country_name_numeric_length = univ.Integer(3) 290 291 292class CountryName(univ.Choice): 293 pass 294 295 296CountryName.tagSet = univ.Choice.tagSet.tagExplicitly(tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 1)) 297CountryName.componentType = namedtype.NamedTypes( 298 namedtype.NamedType('x121-dcc-code', char.NumericString().subtype( 299 subtypeSpec=constraint.ValueSizeConstraint(ub_country_name_numeric_length, ub_country_name_numeric_length))), 300 namedtype.NamedType('iso-3166-alpha2-code', char.PrintableString().subtype( 301 subtypeSpec=constraint.ValueSizeConstraint(ub_country_name_alpha_length, ub_country_name_alpha_length))) 302) 303 304extension_OR_address_components = univ.Integer(12) 305 306id_at_dnQualifier = _OID(id_at, 46) 307 308ub_e163_4_number_length = univ.Integer(15) 309 310 311class ExtendedNetworkAddress(univ.Choice): 312 pass 313 314 315ExtendedNetworkAddress.componentType = namedtype.NamedTypes( 316 namedtype.NamedType('e163-4-address', univ.Sequence(componentType=namedtype.NamedTypes( 317 namedtype.NamedType('number', char.NumericString().subtype( 318 subtypeSpec=constraint.ValueSizeConstraint(1, ub_e163_4_number_length)).subtype( 319 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))), 320 namedtype.OptionalNamedType('sub-address', char.NumericString().subtype( 321 subtypeSpec=constraint.ValueSizeConstraint(1, ub_e163_4_sub_address_length)).subtype( 322 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))) 323 )) 324 ), 325 namedtype.NamedType('psap-address', PresentationAddress().subtype( 326 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))) 327) 328 329terminal_type = univ.Integer(23) 330 331id_domainComponent = _OID(0, 9, 2342, 19200300, 100, 1, 25) 332 333ub_state_name = univ.Integer(128) 334 335 336class X520StateOrProvinceName(univ.Choice): 337 pass 338 339 340X520StateOrProvinceName.componentType = namedtype.NamedTypes( 341 namedtype.NamedType('teletexString', 342 char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name))), 343 namedtype.NamedType('printableString', 344 char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name))), 345 namedtype.NamedType('universalString', 346 char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name))), 347 namedtype.NamedType('utf8String', 348 char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name))), 349 namedtype.NamedType('bmpString', 350 char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name))) 351) 352 353ub_organization_name = univ.Integer(64) 354 355 356class X520OrganizationName(univ.Choice): 357 pass 358 359 360X520OrganizationName.componentType = namedtype.NamedTypes( 361 namedtype.NamedType('teletexString', char.TeletexString().subtype( 362 subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name))), 363 namedtype.NamedType('printableString', char.PrintableString().subtype( 364 subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name))), 365 namedtype.NamedType('universalString', char.UniversalString().subtype( 366 subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name))), 367 namedtype.NamedType('utf8String', 368 char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name))), 369 namedtype.NamedType('bmpString', 370 char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name))) 371) 372 373ub_emailaddress_length = univ.Integer(128) 374 375 376class ExtensionPhysicalDeliveryAddressComponents(PDSParameter): 377 pass 378 379 380id_at_surname = _OID(id_at, 4) 381 382ub_common_name_length = univ.Integer(64) 383 384id_ad = _OID(id_pkix, 48) 385 386ub_numeric_user_id_length = univ.Integer(32) 387 388 389class NumericUserIdentifier(char.NumericString): 390 pass 391 392 393NumericUserIdentifier.subtypeSpec = constraint.ValueSizeConstraint(1, ub_numeric_user_id_length) 394 395 396class OrganizationName(char.PrintableString): 397 pass 398 399 400OrganizationName.subtypeSpec = constraint.ValueSizeConstraint(1, ub_organization_name_length) 401 402ub_domain_name_length = univ.Integer(16) 403 404 405class AdministrationDomainName(univ.Choice): 406 pass 407 408 409AdministrationDomainName.tagSet = univ.Choice.tagSet.tagExplicitly( 410 tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 2)) 411AdministrationDomainName.componentType = namedtype.NamedTypes( 412 namedtype.NamedType('numeric', char.NumericString().subtype( 413 subtypeSpec=constraint.ValueSizeConstraint(0, ub_domain_name_length))), 414 namedtype.NamedType('printable', char.PrintableString().subtype( 415 subtypeSpec=constraint.ValueSizeConstraint(0, ub_domain_name_length))) 416) 417 418 419class PrivateDomainName(univ.Choice): 420 pass 421 422 423PrivateDomainName.componentType = namedtype.NamedTypes( 424 namedtype.NamedType('numeric', char.NumericString().subtype( 425 subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_name_length))), 426 namedtype.NamedType('printable', char.PrintableString().subtype( 427 subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_name_length))) 428) 429 430ub_generation_qualifier_length = univ.Integer(3) 431 432ub_given_name_length = univ.Integer(16) 433 434ub_initials_length = univ.Integer(5) 435 436 437class PersonalName(univ.Set): 438 pass 439 440 441PersonalName.componentType = namedtype.NamedTypes( 442 namedtype.NamedType('surname', char.PrintableString().subtype( 443 subtypeSpec=constraint.ValueSizeConstraint(1, ub_surname_length)).subtype( 444 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))), 445 namedtype.OptionalNamedType('given-name', char.PrintableString().subtype( 446 subtypeSpec=constraint.ValueSizeConstraint(1, ub_given_name_length)).subtype( 447 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))), 448 namedtype.OptionalNamedType('initials', char.PrintableString().subtype( 449 subtypeSpec=constraint.ValueSizeConstraint(1, ub_initials_length)).subtype( 450 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))), 451 namedtype.OptionalNamedType('generation-qualifier', char.PrintableString().subtype( 452 subtypeSpec=constraint.ValueSizeConstraint(1, ub_generation_qualifier_length)).subtype( 453 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))) 454) 455 456ub_terminal_id_length = univ.Integer(24) 457 458 459class TerminalIdentifier(char.PrintableString): 460 pass 461 462 463TerminalIdentifier.subtypeSpec = constraint.ValueSizeConstraint(1, ub_terminal_id_length) 464 465ub_x121_address_length = univ.Integer(16) 466 467 468class X121Address(char.NumericString): 469 pass 470 471 472X121Address.subtypeSpec = constraint.ValueSizeConstraint(1, ub_x121_address_length) 473 474 475class NetworkAddress(X121Address): 476 pass 477 478 479class BuiltInStandardAttributes(univ.Sequence): 480 pass 481 482 483BuiltInStandardAttributes.componentType = namedtype.NamedTypes( 484 namedtype.OptionalNamedType('country-name', CountryName()), 485 namedtype.OptionalNamedType('administration-domain-name', AdministrationDomainName()), 486 namedtype.OptionalNamedType('network-address', NetworkAddress().subtype( 487 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))), 488 namedtype.OptionalNamedType('terminal-identifier', TerminalIdentifier().subtype( 489 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))), 490 namedtype.OptionalNamedType('private-domain-name', PrivateDomainName().subtype( 491 explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2))), 492 namedtype.OptionalNamedType('organization-name', OrganizationName().subtype( 493 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))), 494 namedtype.OptionalNamedType('numeric-user-identifier', NumericUserIdentifier().subtype( 495 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4))), 496 namedtype.OptionalNamedType('personal-name', PersonalName().subtype( 497 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 5))), 498 namedtype.OptionalNamedType('organizational-unit-names', OrganizationalUnitNames().subtype( 499 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 6))) 500) 501 502ub_domain_defined_attributes = univ.Integer(4) 503 504 505class BuiltInDomainDefinedAttribute(univ.Sequence): 506 pass 507 508 509BuiltInDomainDefinedAttribute.componentType = namedtype.NamedTypes( 510 namedtype.NamedType('type', char.PrintableString().subtype( 511 subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_defined_attribute_type_length))), 512 namedtype.NamedType('value', char.PrintableString().subtype( 513 subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_defined_attribute_value_length))) 514) 515 516 517class BuiltInDomainDefinedAttributes(univ.SequenceOf): 518 pass 519 520 521BuiltInDomainDefinedAttributes.componentType = BuiltInDomainDefinedAttribute() 522BuiltInDomainDefinedAttributes.subtypeSpec = constraint.ValueSizeConstraint(1, ub_domain_defined_attributes) 523 524ub_extension_attributes = univ.Integer(256) 525 526 527class ExtensionAttribute(univ.Sequence): 528 pass 529 530 531ExtensionAttribute.componentType = namedtype.NamedTypes( 532 namedtype.NamedType('extension-attribute-type', univ.Integer().subtype( 533 subtypeSpec=constraint.ValueRangeConstraint(0, ub_extension_attributes)).subtype( 534 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))), 535 namedtype.NamedType('extension-attribute-value', 536 univ.Any().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))) 537) 538 539 540class ExtensionAttributes(univ.SetOf): 541 pass 542 543 544ExtensionAttributes.componentType = ExtensionAttribute() 545ExtensionAttributes.subtypeSpec = constraint.ValueSizeConstraint(1, ub_extension_attributes) 546 547 548class ORAddress(univ.Sequence): 549 pass 550 551 552ORAddress.componentType = namedtype.NamedTypes( 553 namedtype.NamedType('built-in-standard-attributes', BuiltInStandardAttributes()), 554 namedtype.OptionalNamedType('built-in-domain-defined-attributes', BuiltInDomainDefinedAttributes()), 555 namedtype.OptionalNamedType('extension-attributes', ExtensionAttributes()) 556) 557 558id_pe = _OID(id_pkix, 1) 559 560ub_title = univ.Integer(64) 561 562 563class X520Title(univ.Choice): 564 pass 565 566 567X520Title.componentType = namedtype.NamedTypes( 568 namedtype.NamedType('teletexString', 569 char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title))), 570 namedtype.NamedType('printableString', 571 char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title))), 572 namedtype.NamedType('universalString', 573 char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title))), 574 namedtype.NamedType('utf8String', 575 char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title))), 576 namedtype.NamedType('bmpString', char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title))) 577) 578 579id_at_organizationalUnitName = _OID(id_at, 11) 580 581 582class EmailAddress(char.IA5String): 583 pass 584 585 586EmailAddress.subtypeSpec = constraint.ValueSizeConstraint(1, ub_emailaddress_length) 587 588physical_delivery_country_name = univ.Integer(8) 589 590id_at_givenName = _OID(id_at, 42) 591 592 593class TeletexCommonName(char.TeletexString): 594 pass 595 596 597TeletexCommonName.subtypeSpec = constraint.ValueSizeConstraint(1, ub_common_name_length) 598 599id_qt_cps = _OID(id_qt, 1) 600 601 602class LocalPostalAttributes(PDSParameter): 603 pass 604 605 606class StreetAddress(PDSParameter): 607 pass 608 609 610id_kp = _OID(id_pkix, 3) 611 612 613class DirectoryString(univ.Choice): 614 pass 615 616 617DirectoryString.componentType = namedtype.NamedTypes( 618 namedtype.NamedType('teletexString', 619 char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))), 620 namedtype.NamedType('printableString', 621 char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))), 622 namedtype.NamedType('universalString', 623 char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))), 624 namedtype.NamedType('utf8String', char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))), 625 namedtype.NamedType('bmpString', char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))) 626) 627 628 629class DomainComponent(char.IA5String): 630 pass 631 632 633id_at_initials = _OID(id_at, 43) 634 635id_qt_unotice = _OID(id_qt, 2) 636 637ub_pds_name_length = univ.Integer(16) 638 639 640class PDSName(char.PrintableString): 641 pass 642 643 644PDSName.subtypeSpec = constraint.ValueSizeConstraint(1, ub_pds_name_length) 645 646 647class PosteRestanteAddress(PDSParameter): 648 pass 649 650 651class DistinguishedName(RDNSequence): 652 pass 653 654 655class CommonName(char.PrintableString): 656 pass 657 658 659CommonName.subtypeSpec = constraint.ValueSizeConstraint(1, ub_common_name_length) 660 661ub_serial_number = univ.Integer(64) 662 663 664class X520SerialNumber(char.PrintableString): 665 pass 666 667 668X520SerialNumber.subtypeSpec = constraint.ValueSizeConstraint(1, ub_serial_number) 669 670id_at_generationQualifier = _OID(id_at, 44) 671 672ub_organizational_unit_name = univ.Integer(64) 673 674id_ad_ocsp = _OID(id_ad, 1) 675 676 677class TeletexOrganizationalUnitName(char.TeletexString): 678 pass 679 680 681TeletexOrganizationalUnitName.subtypeSpec = constraint.ValueSizeConstraint(1, ub_organizational_unit_name_length) 682 683 684class TeletexPersonalName(univ.Set): 685 pass 686 687 688TeletexPersonalName.componentType = namedtype.NamedTypes( 689 namedtype.NamedType('surname', char.TeletexString().subtype( 690 subtypeSpec=constraint.ValueSizeConstraint(1, ub_surname_length)).subtype( 691 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))), 692 namedtype.OptionalNamedType('given-name', char.TeletexString().subtype( 693 subtypeSpec=constraint.ValueSizeConstraint(1, ub_given_name_length)).subtype( 694 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))), 695 namedtype.OptionalNamedType('initials', char.TeletexString().subtype( 696 subtypeSpec=constraint.ValueSizeConstraint(1, ub_initials_length)).subtype( 697 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))), 698 namedtype.OptionalNamedType('generation-qualifier', char.TeletexString().subtype( 699 subtypeSpec=constraint.ValueSizeConstraint(1, ub_generation_qualifier_length)).subtype( 700 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))) 701) 702 703 704class TeletexDomainDefinedAttributes(univ.SequenceOf): 705 pass 706 707 708TeletexDomainDefinedAttributes.componentType = TeletexDomainDefinedAttribute() 709TeletexDomainDefinedAttributes.subtypeSpec = constraint.ValueSizeConstraint(1, ub_domain_defined_attributes) 710 711 712class TBSCertList(univ.Sequence): 713 pass 714 715 716TBSCertList.componentType = namedtype.NamedTypes( 717 namedtype.OptionalNamedType('version', Version()), 718 namedtype.NamedType('signature', AlgorithmIdentifier()), 719 namedtype.NamedType('issuer', Name()), 720 namedtype.NamedType('thisUpdate', Time()), 721 namedtype.OptionalNamedType('nextUpdate', Time()), 722 namedtype.OptionalNamedType('revokedCertificates', 723 univ.SequenceOf(componentType=univ.Sequence(componentType=namedtype.NamedTypes( 724 namedtype.NamedType('userCertificate', CertificateSerialNumber()), 725 namedtype.NamedType('revocationDate', Time()), 726 namedtype.OptionalNamedType('crlEntryExtensions', Extensions()) 727 )) 728 )), 729 namedtype.OptionalNamedType('crlExtensions', 730 Extensions().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))) 731) 732 733local_postal_attributes = univ.Integer(21) 734 735pkcs_9 = _OID(1, 2, 840, 113549, 1, 9) 736 737 738class PhysicalDeliveryCountryName(univ.Choice): 739 pass 740 741 742PhysicalDeliveryCountryName.componentType = namedtype.NamedTypes( 743 namedtype.NamedType('x121-dcc-code', char.NumericString().subtype( 744 subtypeSpec=constraint.ValueSizeConstraint(ub_country_name_numeric_length, ub_country_name_numeric_length))), 745 namedtype.NamedType('iso-3166-alpha2-code', char.PrintableString().subtype( 746 subtypeSpec=constraint.ValueSizeConstraint(ub_country_name_alpha_length, ub_country_name_alpha_length))) 747) 748 749ub_name = univ.Integer(32768) 750 751 752class X520name(univ.Choice): 753 pass 754 755 756X520name.componentType = namedtype.NamedTypes( 757 namedtype.NamedType('teletexString', 758 char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name))), 759 namedtype.NamedType('printableString', 760 char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name))), 761 namedtype.NamedType('universalString', 762 char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name))), 763 namedtype.NamedType('utf8String', 764 char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name))), 765 namedtype.NamedType('bmpString', char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name))) 766) 767 768id_emailAddress = _OID(pkcs_9, 1) 769 770 771class TerminalType(univ.Integer): 772 pass 773 774 775TerminalType.namedValues = namedval.NamedValues( 776 ('telex', 3), 777 ('teletex', 4), 778 ('g3-facsimile', 5), 779 ('g4-facsimile', 6), 780 ('ia5-terminal', 7), 781 ('videotex', 8) 782) 783 784 785class X520OrganizationalUnitName(univ.Choice): 786 pass 787 788 789X520OrganizationalUnitName.componentType = namedtype.NamedTypes( 790 namedtype.NamedType('teletexString', char.TeletexString().subtype( 791 subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name))), 792 namedtype.NamedType('printableString', char.PrintableString().subtype( 793 subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name))), 794 namedtype.NamedType('universalString', char.UniversalString().subtype( 795 subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name))), 796 namedtype.NamedType('utf8String', char.UTF8String().subtype( 797 subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name))), 798 namedtype.NamedType('bmpString', char.BMPString().subtype( 799 subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name))) 800) 801 802id_at_commonName = _OID(id_at, 3) 803 804pds_name = univ.Integer(7) 805 806post_office_box_address = univ.Integer(18) 807 808ub_locality_name = univ.Integer(128) 809 810 811class X520LocalityName(univ.Choice): 812 pass 813 814 815X520LocalityName.componentType = namedtype.NamedTypes( 816 namedtype.NamedType('teletexString', 817 char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name))), 818 namedtype.NamedType('printableString', char.PrintableString().subtype( 819 subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name))), 820 namedtype.NamedType('universalString', char.UniversalString().subtype( 821 subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name))), 822 namedtype.NamedType('utf8String', 823 char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name))), 824 namedtype.NamedType('bmpString', 825 char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name))) 826) 827 828id_ad_timeStamping = _OID(id_ad, 3) 829 830id_at_countryName = _OID(id_at, 6) 831 832physical_delivery_personal_name = univ.Integer(13) 833 834teletex_personal_name = univ.Integer(4) 835 836teletex_organizational_unit_names = univ.Integer(5) 837 838 839class PhysicalDeliveryPersonalName(PDSParameter): 840 pass 841 842 843ub_postal_code_length = univ.Integer(16) 844 845 846class PostalCode(univ.Choice): 847 pass 848 849 850PostalCode.componentType = namedtype.NamedTypes( 851 namedtype.NamedType('numeric-code', char.NumericString().subtype( 852 subtypeSpec=constraint.ValueSizeConstraint(1, ub_postal_code_length))), 853 namedtype.NamedType('printable-code', char.PrintableString().subtype( 854 subtypeSpec=constraint.ValueSizeConstraint(1, ub_postal_code_length))) 855) 856 857 858class X520countryName(char.PrintableString): 859 pass 860 861 862X520countryName.subtypeSpec = constraint.ValueSizeConstraint(2, 2) 863 864postal_code = univ.Integer(9) 865 866id_ad_caRepository = _OID(id_ad, 5) 867 868extension_physical_delivery_address_components = univ.Integer(15) 869 870 871class PostOfficeBoxAddress(PDSParameter): 872 pass 873 874 875class PhysicalDeliveryOfficeName(PDSParameter): 876 pass 877 878 879id_at_title = _OID(id_at, 12) 880 881id_at_serialNumber = _OID(id_at, 5) 882 883id_ad_caIssuers = _OID(id_ad, 2) 884 885ub_integer_options = univ.Integer(256) 886 887 888class CertificateList(univ.Sequence): 889 pass 890 891 892CertificateList.componentType = namedtype.NamedTypes( 893 namedtype.NamedType('tbsCertList', TBSCertList()), 894 namedtype.NamedType('signatureAlgorithm', AlgorithmIdentifier()), 895 namedtype.NamedType('signature', univ.BitString()) 896) 897 898 899class PhysicalDeliveryOfficeNumber(PDSParameter): 900 pass 901 902 903class TeletexOrganizationalUnitNames(univ.SequenceOf): 904 pass 905 906 907TeletexOrganizationalUnitNames.componentType = TeletexOrganizationalUnitName() 908TeletexOrganizationalUnitNames.subtypeSpec = constraint.ValueSizeConstraint(1, ub_organizational_units) 909 910physical_delivery_office_name = univ.Integer(10) 911 912ub_common_name = univ.Integer(64) 913 914 915class ExtensionORAddressComponents(PDSParameter): 916 pass 917 918 919ub_pseudonym = univ.Integer(128) 920 921poste_restante_address = univ.Integer(19) 922 923id_at_organizationName = _OID(id_at, 10) 924 925physical_delivery_office_number = univ.Integer(11) 926 927id_at_pseudonym = _OID(id_at, 65) 928 929 930class X520CommonName(univ.Choice): 931 pass 932 933 934X520CommonName.componentType = namedtype.NamedTypes( 935 namedtype.NamedType('teletexString', 936 char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name))), 937 namedtype.NamedType('printableString', 938 char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name))), 939 namedtype.NamedType('universalString', 940 char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name))), 941 namedtype.NamedType('utf8String', 942 char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name))), 943 namedtype.NamedType('bmpString', 944 char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name))) 945) 946 947physical_delivery_organization_name = univ.Integer(14) 948 949 950class X520dnQualifier(char.PrintableString): 951 pass 952 953 954id_at_stateOrProvinceName = _OID(id_at, 8) 955 956common_name = univ.Integer(1) 957 958id_at_localityName = _OID(id_at, 7) 959 960ub_match = univ.Integer(128) 961 962ub_unformatted_address_length = univ.Integer(180) 963 964 965class Attribute(univ.Sequence): 966 pass 967 968 969Attribute.componentType = namedtype.NamedTypes( 970 namedtype.NamedType('type', AttributeType()), 971 namedtype.NamedType('values', univ.SetOf(componentType=AttributeValue())) 972) 973 974extended_network_address = univ.Integer(22) 975 976unique_postal_name = univ.Integer(20) 977 978ub_pds_physical_address_lines = univ.Integer(6) 979 980 981class UnformattedPostalAddress(univ.Set): 982 pass 983 984 985UnformattedPostalAddress.componentType = namedtype.NamedTypes( 986 namedtype.OptionalNamedType('printable-address', univ.SequenceOf(componentType=char.PrintableString().subtype( 987 subtypeSpec=constraint.ValueSizeConstraint(1, ub_pds_parameter_length)))), 988 namedtype.OptionalNamedType('teletex-string', char.TeletexString().subtype( 989 subtypeSpec=constraint.ValueSizeConstraint(1, ub_unformatted_address_length))) 990) 991 992 993class UniquePostalName(PDSParameter): 994 pass 995 996 997class X520Pseudonym(univ.Choice): 998 pass 999 1000 1001X520Pseudonym.componentType = namedtype.NamedTypes( 1002 namedtype.NamedType('teletexString', 1003 char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_pseudonym))), 1004 namedtype.NamedType('printableString', 1005 char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_pseudonym))), 1006 namedtype.NamedType('universalString', 1007 char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_pseudonym))), 1008 namedtype.NamedType('utf8String', 1009 char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_pseudonym))), 1010 namedtype.NamedType('bmpString', 1011 char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_pseudonym))) 1012) 1013 1014teletex_organization_name = univ.Integer(3) 1015 1016teletex_domain_defined_attributes = univ.Integer(6) 1017 1018street_address = univ.Integer(17) 1019 1020id_kp_OCSPSigning = _OID(id_kp, 9) 1021 1022id_ce = _OID(2, 5, 29) 1023 1024id_ce_certificatePolicies = _OID(id_ce, 32) 1025 1026 1027class EDIPartyName(univ.Sequence): 1028 pass 1029 1030 1031EDIPartyName.componentType = namedtype.NamedTypes( 1032 namedtype.OptionalNamedType('nameAssigner', DirectoryString().subtype( 1033 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))), 1034 namedtype.NamedType('partyName', 1035 DirectoryString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))) 1036) 1037 1038 1039class AnotherName(univ.Sequence): 1040 pass 1041 1042 1043AnotherName.componentType = namedtype.NamedTypes( 1044 namedtype.NamedType('type-id', univ.ObjectIdentifier()), 1045 namedtype.NamedType('value', univ.Any().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))) 1046) 1047 1048 1049class GeneralName(univ.Choice): 1050 pass 1051 1052 1053GeneralName.componentType = namedtype.NamedTypes( 1054 namedtype.NamedType('otherName', 1055 AnotherName().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))), 1056 namedtype.NamedType('rfc822Name', 1057 char.IA5String().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))), 1058 namedtype.NamedType('dNSName', 1059 char.IA5String().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))), 1060 namedtype.NamedType('x400Address', 1061 ORAddress().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))), 1062 namedtype.NamedType('directoryName', 1063 Name().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 4))), 1064 namedtype.NamedType('ediPartyName', 1065 EDIPartyName().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 5))), 1066 namedtype.NamedType('uniformResourceIdentifier', 1067 char.IA5String().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 6))), 1068 namedtype.NamedType('iPAddress', 1069 univ.OctetString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 7))), 1070 namedtype.NamedType('registeredID', univ.ObjectIdentifier().subtype( 1071 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 8))) 1072) 1073 1074 1075class GeneralNames(univ.SequenceOf): 1076 pass 1077 1078 1079GeneralNames.componentType = GeneralName() 1080GeneralNames.subtypeSpec = constraint.ValueSizeConstraint(1, MAX) 1081 1082 1083class IssuerAltName(GeneralNames): 1084 pass 1085 1086 1087id_ce_cRLDistributionPoints = _OID(id_ce, 31) 1088 1089 1090class CertPolicyId(univ.ObjectIdentifier): 1091 pass 1092 1093 1094class PolicyMappings(univ.SequenceOf): 1095 pass 1096 1097 1098PolicyMappings.componentType = univ.Sequence(componentType=namedtype.NamedTypes( 1099 namedtype.NamedType('issuerDomainPolicy', CertPolicyId()), 1100 namedtype.NamedType('subjectDomainPolicy', CertPolicyId()) 1101)) 1102 1103PolicyMappings.subtypeSpec = constraint.ValueSizeConstraint(1, MAX) 1104 1105 1106class PolicyQualifierId(univ.ObjectIdentifier): 1107 pass 1108 1109 1110holdInstruction = _OID(2, 2, 840, 10040, 2) 1111 1112id_ce_subjectDirectoryAttributes = _OID(id_ce, 9) 1113 1114id_holdinstruction_callissuer = _OID(holdInstruction, 2) 1115 1116 1117class SubjectDirectoryAttributes(univ.SequenceOf): 1118 pass 1119 1120 1121SubjectDirectoryAttributes.componentType = Attribute() 1122SubjectDirectoryAttributes.subtypeSpec = constraint.ValueSizeConstraint(1, MAX) 1123 1124anyPolicy = _OID(id_ce_certificatePolicies, 0) 1125 1126id_ce_subjectAltName = _OID(id_ce, 17) 1127 1128id_kp_emailProtection = _OID(id_kp, 4) 1129 1130 1131class ReasonFlags(univ.BitString): 1132 pass 1133 1134 1135ReasonFlags.namedValues = namedval.NamedValues( 1136 ('unused', 0), 1137 ('keyCompromise', 1), 1138 ('cACompromise', 2), 1139 ('affiliationChanged', 3), 1140 ('superseded', 4), 1141 ('cessationOfOperation', 5), 1142 ('certificateHold', 6), 1143 ('privilegeWithdrawn', 7), 1144 ('aACompromise', 8) 1145) 1146 1147 1148class DistributionPointName(univ.Choice): 1149 pass 1150 1151 1152DistributionPointName.componentType = namedtype.NamedTypes( 1153 namedtype.NamedType('fullName', 1154 GeneralNames().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))), 1155 namedtype.NamedType('nameRelativeToCRLIssuer', RelativeDistinguishedName().subtype( 1156 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))) 1157) 1158 1159 1160class DistributionPoint(univ.Sequence): 1161 pass 1162 1163 1164DistributionPoint.componentType = namedtype.NamedTypes( 1165 namedtype.OptionalNamedType('distributionPoint', DistributionPointName().subtype( 1166 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))), 1167 namedtype.OptionalNamedType('reasons', ReasonFlags().subtype( 1168 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))), 1169 namedtype.OptionalNamedType('cRLIssuer', GeneralNames().subtype( 1170 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))) 1171) 1172 1173id_ce_keyUsage = _OID(id_ce, 15) 1174 1175 1176class PolicyQualifierInfo(univ.Sequence): 1177 pass 1178 1179 1180PolicyQualifierInfo.componentType = namedtype.NamedTypes( 1181 namedtype.NamedType('policyQualifierId', PolicyQualifierId()), 1182 namedtype.NamedType('qualifier', univ.Any()) 1183) 1184 1185 1186class PolicyInformation(univ.Sequence): 1187 pass 1188 1189 1190PolicyInformation.componentType = namedtype.NamedTypes( 1191 namedtype.NamedType('policyIdentifier', CertPolicyId()), 1192 namedtype.OptionalNamedType('policyQualifiers', univ.SequenceOf(componentType=PolicyQualifierInfo())) 1193) 1194 1195 1196class CertificatePolicies(univ.SequenceOf): 1197 pass 1198 1199 1200CertificatePolicies.componentType = PolicyInformation() 1201CertificatePolicies.subtypeSpec = constraint.ValueSizeConstraint(1, MAX) 1202 1203id_ce_basicConstraints = _OID(id_ce, 19) 1204 1205 1206class HoldInstructionCode(univ.ObjectIdentifier): 1207 pass 1208 1209 1210class KeyPurposeId(univ.ObjectIdentifier): 1211 pass 1212 1213 1214class ExtKeyUsageSyntax(univ.SequenceOf): 1215 pass 1216 1217 1218ExtKeyUsageSyntax.componentType = KeyPurposeId() 1219ExtKeyUsageSyntax.subtypeSpec = constraint.ValueSizeConstraint(1, MAX) 1220 1221 1222class SubjectAltName(GeneralNames): 1223 pass 1224 1225 1226class BasicConstraints(univ.Sequence): 1227 pass 1228 1229 1230BasicConstraints.componentType = namedtype.NamedTypes( 1231 namedtype.DefaultedNamedType('cA', univ.Boolean().subtype(value=0)), 1232 namedtype.OptionalNamedType('pathLenConstraint', 1233 univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, MAX))) 1234) 1235 1236 1237class SkipCerts(univ.Integer): 1238 pass 1239 1240 1241SkipCerts.subtypeSpec = constraint.ValueRangeConstraint(0, MAX) 1242 1243 1244class InhibitAnyPolicy(SkipCerts): 1245 pass 1246 1247 1248class CRLNumber(univ.Integer): 1249 pass 1250 1251 1252CRLNumber.subtypeSpec = constraint.ValueRangeConstraint(0, MAX) 1253 1254 1255class BaseCRLNumber(CRLNumber): 1256 pass 1257 1258 1259class KeyIdentifier(univ.OctetString): 1260 pass 1261 1262 1263class AuthorityKeyIdentifier(univ.Sequence): 1264 pass 1265 1266 1267AuthorityKeyIdentifier.componentType = namedtype.NamedTypes( 1268 namedtype.OptionalNamedType('keyIdentifier', KeyIdentifier().subtype( 1269 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))), 1270 namedtype.OptionalNamedType('authorityCertIssuer', GeneralNames().subtype( 1271 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))), 1272 namedtype.OptionalNamedType('authorityCertSerialNumber', CertificateSerialNumber().subtype( 1273 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))) 1274) 1275 1276id_ce_nameConstraints = _OID(id_ce, 30) 1277 1278id_kp_serverAuth = _OID(id_kp, 1) 1279 1280id_ce_freshestCRL = _OID(id_ce, 46) 1281 1282id_ce_cRLReasons = _OID(id_ce, 21) 1283 1284 1285class CRLDistributionPoints(univ.SequenceOf): 1286 pass 1287 1288 1289CRLDistributionPoints.componentType = DistributionPoint() 1290CRLDistributionPoints.subtypeSpec = constraint.ValueSizeConstraint(1, MAX) 1291 1292 1293class FreshestCRL(CRLDistributionPoints): 1294 pass 1295 1296 1297id_ce_inhibitAnyPolicy = _OID(id_ce, 54) 1298 1299 1300class CRLReason(univ.Enumerated): 1301 pass 1302 1303 1304CRLReason.namedValues = namedval.NamedValues( 1305 ('unspecified', 0), 1306 ('keyCompromise', 1), 1307 ('cACompromise', 2), 1308 ('affiliationChanged', 3), 1309 ('superseded', 4), 1310 ('cessationOfOperation', 5), 1311 ('certificateHold', 6), 1312 ('removeFromCRL', 8), 1313 ('privilegeWithdrawn', 9), 1314 ('aACompromise', 10) 1315) 1316 1317 1318class BaseDistance(univ.Integer): 1319 pass 1320 1321 1322BaseDistance.subtypeSpec = constraint.ValueRangeConstraint(0, MAX) 1323 1324 1325class GeneralSubtree(univ.Sequence): 1326 pass 1327 1328 1329GeneralSubtree.componentType = namedtype.NamedTypes( 1330 namedtype.NamedType('base', GeneralName()), 1331 namedtype.DefaultedNamedType('minimum', BaseDistance().subtype( 1332 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)).subtype(value=0)), 1333 namedtype.OptionalNamedType('maximum', BaseDistance().subtype( 1334 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))) 1335) 1336 1337 1338class GeneralSubtrees(univ.SequenceOf): 1339 pass 1340 1341 1342GeneralSubtrees.componentType = GeneralSubtree() 1343GeneralSubtrees.subtypeSpec = constraint.ValueSizeConstraint(1, MAX) 1344 1345 1346class NameConstraints(univ.Sequence): 1347 pass 1348 1349 1350NameConstraints.componentType = namedtype.NamedTypes( 1351 namedtype.OptionalNamedType('permittedSubtrees', GeneralSubtrees().subtype( 1352 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))), 1353 namedtype.OptionalNamedType('excludedSubtrees', GeneralSubtrees().subtype( 1354 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))) 1355) 1356 1357id_pe_authorityInfoAccess = _OID(id_pe, 1) 1358 1359id_pe_subjectInfoAccess = _OID(id_pe, 11) 1360 1361id_ce_certificateIssuer = _OID(id_ce, 29) 1362 1363id_ce_invalidityDate = _OID(id_ce, 24) 1364 1365 1366class DirectoryString(univ.Choice): 1367 pass 1368 1369 1370DirectoryString.componentType = namedtype.NamedTypes( 1371 namedtype.NamedType('any', univ.Any()) 1372) 1373 1374id_ce_authorityKeyIdentifier = _OID(id_ce, 35) 1375 1376 1377class AccessDescription(univ.Sequence): 1378 pass 1379 1380 1381AccessDescription.componentType = namedtype.NamedTypes( 1382 namedtype.NamedType('accessMethod', univ.ObjectIdentifier()), 1383 namedtype.NamedType('accessLocation', GeneralName()) 1384) 1385 1386 1387class AuthorityInfoAccessSyntax(univ.SequenceOf): 1388 pass 1389 1390 1391AuthorityInfoAccessSyntax.componentType = AccessDescription() 1392AuthorityInfoAccessSyntax.subtypeSpec = constraint.ValueSizeConstraint(1, MAX) 1393 1394id_ce_issuingDistributionPoint = _OID(id_ce, 28) 1395 1396 1397class CPSuri(char.IA5String): 1398 pass 1399 1400 1401class DisplayText(univ.Choice): 1402 pass 1403 1404 1405DisplayText.componentType = namedtype.NamedTypes( 1406 namedtype.NamedType('ia5String', char.IA5String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, 200))), 1407 namedtype.NamedType('visibleString', 1408 char.VisibleString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, 200))), 1409 namedtype.NamedType('bmpString', char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, 200))), 1410 namedtype.NamedType('utf8String', char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, 200))) 1411) 1412 1413 1414class NoticeReference(univ.Sequence): 1415 pass 1416 1417 1418NoticeReference.componentType = namedtype.NamedTypes( 1419 namedtype.NamedType('organization', DisplayText()), 1420 namedtype.NamedType('noticeNumbers', univ.SequenceOf(componentType=univ.Integer())) 1421) 1422 1423 1424class UserNotice(univ.Sequence): 1425 pass 1426 1427 1428UserNotice.componentType = namedtype.NamedTypes( 1429 namedtype.OptionalNamedType('noticeRef', NoticeReference()), 1430 namedtype.OptionalNamedType('explicitText', DisplayText()) 1431) 1432 1433 1434class PrivateKeyUsagePeriod(univ.Sequence): 1435 pass 1436 1437 1438PrivateKeyUsagePeriod.componentType = namedtype.NamedTypes( 1439 namedtype.OptionalNamedType('notBefore', useful.GeneralizedTime().subtype( 1440 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))), 1441 namedtype.OptionalNamedType('notAfter', useful.GeneralizedTime().subtype( 1442 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))) 1443) 1444 1445id_ce_subjectKeyIdentifier = _OID(id_ce, 14) 1446 1447 1448class CertificateIssuer(GeneralNames): 1449 pass 1450 1451 1452class InvalidityDate(useful.GeneralizedTime): 1453 pass 1454 1455 1456class SubjectInfoAccessSyntax(univ.SequenceOf): 1457 pass 1458 1459 1460SubjectInfoAccessSyntax.componentType = AccessDescription() 1461SubjectInfoAccessSyntax.subtypeSpec = constraint.ValueSizeConstraint(1, MAX) 1462 1463 1464class KeyUsage(univ.BitString): 1465 pass 1466 1467 1468KeyUsage.namedValues = namedval.NamedValues( 1469 ('digitalSignature', 0), 1470 ('nonRepudiation', 1), 1471 ('keyEncipherment', 2), 1472 ('dataEncipherment', 3), 1473 ('keyAgreement', 4), 1474 ('keyCertSign', 5), 1475 ('cRLSign', 6), 1476 ('encipherOnly', 7), 1477 ('decipherOnly', 8) 1478) 1479 1480id_ce_extKeyUsage = _OID(id_ce, 37) 1481 1482anyExtendedKeyUsage = _OID(id_ce_extKeyUsage, 0) 1483 1484id_ce_privateKeyUsagePeriod = _OID(id_ce, 16) 1485 1486id_ce_policyMappings = _OID(id_ce, 33) 1487 1488id_ce_cRLNumber = _OID(id_ce, 20) 1489 1490id_ce_policyConstraints = _OID(id_ce, 36) 1491 1492id_holdinstruction_none = _OID(holdInstruction, 1) 1493 1494id_holdinstruction_reject = _OID(holdInstruction, 3) 1495 1496id_kp_timeStamping = _OID(id_kp, 8) 1497 1498 1499class PolicyConstraints(univ.Sequence): 1500 pass 1501 1502 1503PolicyConstraints.componentType = namedtype.NamedTypes( 1504 namedtype.OptionalNamedType('requireExplicitPolicy', 1505 SkipCerts().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))), 1506 namedtype.OptionalNamedType('inhibitPolicyMapping', 1507 SkipCerts().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))) 1508) 1509 1510 1511class SubjectKeyIdentifier(KeyIdentifier): 1512 pass 1513 1514 1515id_kp_clientAuth = _OID(id_kp, 2) 1516 1517id_ce_deltaCRLIndicator = _OID(id_ce, 27) 1518 1519id_ce_issuerAltName = _OID(id_ce, 18) 1520 1521id_kp_codeSigning = _OID(id_kp, 3) 1522 1523id_ce_holdInstructionCode = _OID(id_ce, 23) 1524 1525 1526class IssuingDistributionPoint(univ.Sequence): 1527 pass 1528 1529 1530IssuingDistributionPoint.componentType = namedtype.NamedTypes( 1531 namedtype.OptionalNamedType('distributionPoint', DistributionPointName().subtype( 1532 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))), 1533 namedtype.DefaultedNamedType('onlyContainsUserCerts', univ.Boolean().subtype( 1534 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)).subtype(value=0)), 1535 namedtype.DefaultedNamedType('onlyContainsCACerts', univ.Boolean().subtype( 1536 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)).subtype(value=0)), 1537 namedtype.OptionalNamedType('onlySomeReasons', ReasonFlags().subtype( 1538 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))), 1539 namedtype.DefaultedNamedType('indirectCRL', univ.Boolean().subtype( 1540 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4)).subtype(value=0)), 1541 namedtype.DefaultedNamedType('onlyContainsAttributeCerts', univ.Boolean().subtype( 1542 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 5)).subtype(value=0)) 1543) 1544